Skip to content

8358820: Allow interpolation outside of range [0,1] #1822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mstr2
Copy link
Collaborator

@mstr2 mstr2 commented Jun 6, 2025

JavaFX unnecessarily restricts interpolation in the following ways:

  1. Interpolatable implementations often clamp intermediate values to the interpolation factor range [0,1].
  2. SplineInterpolator doesn't accept Y coordinates outside of [0,1] for its control points. While this was probably done so that the computed interpolation factor doesn't exceed [0,1], the restriction goes far beyond that. For example, the following function is not representable, even though its values are all within the [0,1] range:



    The following function is also not representable, but would be very useful for bouncy animations:

Fortunately, there is no technical reason why JavaFX can't support the full range of animations that can be represented with a cubic Beziér interpolation function.

This PR includes the following changes:

  1. The specification of Interpolatable is changed to require implementations to accept interpolation factors outside of [0,1].
  2. All implementations of Interpolatable now correctly return intermediate values outside of [0,1].
  3. SplineInterpolator now accepts control points with any Y coordinate.

Here's how the result looks like for the previously unrepresentable interpolation function cubic-bezier(0.34, 2.2, 0.64, 1):

/reviewers 2
/csr


Progress

  • Change requires a CSR request matching fixVersion jfx25 to be approved (needs to be created)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8358820: Allow interpolation outside of range [0,1] (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1822/head:pull/1822
$ git checkout pull/1822

Update a local copy of the PR:
$ git checkout pull/1822
$ git pull https://git.openjdk.org/jfx.git pull/1822/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1822

View PR using the GUI difftool:
$ git pr show -t 1822

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1822.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 6, 2025

👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jun 6, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Ready for review label Jun 6, 2025
@openjdk
Copy link

openjdk bot commented Jun 6, 2025

@mstr2
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@openjdk openjdk bot added the csr Need approved CSR to integrate pull request label Jun 6, 2025
@openjdk
Copy link

openjdk bot commented Jun 6, 2025

@mstr2 has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@mstr2 please create a CSR request for issue JDK-8358820 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@mlbridge
Copy link

mlbridge bot commented Jun 6, 2025

Webrevs

@nlisker
Copy link
Collaborator

nlisker commented Jun 7, 2025

Noting that this proposed change supersedes the previous changes that were done for for https://bugs.openjdk.org/browse/JDK-8226911. The proposed behavioral change makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Need approved CSR to integrate pull request rfr Ready for review
Development

Successfully merging this pull request may close these issues.

2 participants