RFR: 8358820: Allow interpolation outside of range [0,1]
Michael Strauß
mstrauss at openjdk.org
Fri Jun 6 23:28:41 UTC 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:<br>
<img src="https://github.com/user-attachments/assets/368b6142-052d-4ead-8a59-cbddf4a19660" width="400"/><br>
The following function is also not representable, but would be very useful for [bouncy animations](https://easings.net/#easeOutBack):<br>
<img src="https://github.com/user-attachments/assets/af02b044-ae4c-4250-b181-72178ad9f3f3" width="400"/>
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 Y any coordinate.
-------------
Commit messages:
- Allow interpolation outside of range [0,1]
Changes: https://git.openjdk.org/jfx/pull/1822/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1822&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8358820
Stats: 785 lines in 52 files changed: 536 ins; 33 del; 216 mod
Patch: https://git.openjdk.org/jfx/pull/1822.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1822/head:pull/1822
PR: https://git.openjdk.org/jfx/pull/1822
More information about the openjfx-dev
mailing list