On Tue, 25 Nov 2025 01:42:42 GMT, Michael Strauß <[email protected]> wrote:

>> Implementation of the 
>> [linear](https://www.w3.org/TR/css-easing-2/#the-linear-easing-function) 
>> easing function, which is now widely supported by all browsers, but still 
>> missing in JavaFX.
>> 
>> It allows developers to approximate arbitrary easing functions with linear 
>> segments:
>> 
>> 
>> linear(
>>     /* Start to 1st bounce */
>>     0, 0.063, 0.25, 0.563, 1 36.4%,
>>     /* 1st to 2nd bounce */
>>     0.812, 0.75, 0.813, 1 72.7%,
>>     /* 2nd to 3rd bounce */
>>     0.953, 0.938, 0.953, 1 90.9%,
>>     /* 3rd bounce to end */
>>     0.984, 1 100% 100%
>>   )
>> 
>> 
>> <img 
>> src="https://github.com/user-attachments/assets/73aac0d4-0185-47c5-8791-bdb247eb69c8";
>>  width="400"/>
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   rename LINEAR() to ofLinear()

Looks good!

Turns out the fears about infinities are basically unfounded - it appears the 
CssParser does not like scientific notation, and I could not get it to trip 
with a very small decimal step.

Example:


  transition-timing-function: linear(0, 1.4E-45, 0.063, 0.25, 0.563, 1 36.4%,
                                     0.812, 0.75, 0.813, 1 72.7%,
                                     0.953, 0.938, 0.953, 1 90.9%,
                                     0.984, 1 100% 100%);


bails out with 


Unexpected token '1.4E' at [7,40]
Nov 25, 2025 7:47:46 AM javafx.css.CssParser reportException
WARNING: Please report java.lang.NullPointerException at:
        javafx.graphics/javafx.css.CssParser.term(CssParser.java:5127)
        javafx.graphics/javafx.css.CssParser.expr(CssParser.java:5021)

modules/javafx.graphics/src/main/java/javafx/animation/Interpolator.java line 
98:

> 96: 
> 97:     /**
> 98:      * Returns a piecewise-linear interpolator with the specified control 
> points.

Question: do we need to specify that a new instance is returned each time (as 
opposed to some sort of caching as with `Integer.valueOf`)?

-------------

Marked as reviewed by angorya (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1977#pullrequestreview-3505622326
PR Review Comment: https://git.openjdk.org/jfx/pull/1977#discussion_r2560417091

Reply via email to