RFR: 8241582: Infinite animation does not start from the end when started with a negative rate

Ambarish Rapte arapte at openjdk.java.net
Thu Apr 16 16:28:38 UTC 2020

On Fri, 10 Apr 2020 06:31:39 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

> ### Cause
> `Animation#jumpTo(Duration)` does not handle `Duration.INDEFINITE` properly. This causes
> `InfiniteClipEnvelope#jumpTo(long)` to receive an erroneous value and start the animation not from the end, depending
> on the modulo calculation.  ### Fix
> For infinite cycles, use the `cycleDuration` as the destination since that is the effective end point.
> ### Tests
> * Added an `testJumpTo_IndefiniteCycles` test that fails without the patch and passes after it.
> * Added a `testJumpTo_IndefiniteCycleDuration` that passes both before and after, just to make sure that this type of
>   infinite duration is correct.
> * Removed a test in `SequentialTransition` that fails with this patch, but it passed before it only because the modulo
>   value happened to land in the right place. Changing the duration of one of the child animation can cause it to fail, so
>   the test is faulty anyway at this stage.
> ### Future work
> Playing backwards will still not work correctly, but at least now it start from the correct value. This is the first of
> a series of fixes under the umbrella issue [JDK-8210238](https://bugs.openjdk.java.net/browse/JDK-8210238).

looks good to me.


Marked as reviewed by arapte (Reviewer).

PR: https://git.openjdk.java.net/jfx/pull/169

More information about the openjfx-dev mailing list