On Mon, 31 Jul 2023 18:01:31 GMT, Michael Strauß <mstra...@openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/scenario/animation/StepInterpolator.java
>>  line 73:
>> 
>>> 71:         }
>>> 72: 
>>> 73:         if (t >= 0 && step < 0) {
>> 
>> `t >= 0` always holds, perhaps the original `t` was meant here?  The `t` 
>> parameter is re-assigned, which may be confusing.
>
> This algorithm is implemented as 
> [specified](https://www.w3.org/TR/css-easing-1/#step-easing-algo), which 
> accounts for the possibility that the interpolator is used for a back-filling 
> animation (`t < 0`). While this is not possible in JavaFX (but may be 
> possible in the future), I think it makes sense to keep the algorithm as is, 
> because it ensures that its results are always correct, even though negative 
> values for `t` are currently out of spec.

Yeah, I figured as much.  I just don't like code that you can't get covered in 
a unit test, or that contradicts itself.  As you can see, I was confused, is it 
a bug or a feature?  Perhaps a comment then to indicate that it's intentional.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/870#discussion_r1280678762

Reply via email to