RFR: 8236753: Animations do not play backwards after being stopped

Nir Lisker nlisker at openjdk.java.net
Thu Jan 16 01:10:11 UTC 2020

On Thu, 16 Jan 2020 01:06:30 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> The fix looks good to me.
>> After this change the steps needed for playing an `Animation` backwards will change.
>> Earlier this was documented with `Animation.play()` API as below.
>> -------------
>> To play an `Animation` backwards from the end:
>> animation.setRate(negative rate);
>> animation.jumpTo(overall duration of animation);
>> animation.play();
>> -------------
>> After this PR call to `jumpTo()` won't be needed here.
>> So this PR may need a document change for `Animation.play()`.
>> Also to note that the behavior of above mentioned three calls remains same with the changes in this change.
>> If cycleCount is set to 2 does the animation play the same number of times with or without the jumpTo both before and after this change?
> Before the change:
> * With `jumpTo`: plays backwards 2 times.
> * Without `jumpTo`: doesn't play no mater how many times you call `play()`. Compare with the case where `cycleCount` is 1, in which case the first call does nothing (moves the playing head to the start) and the second one plays backwards.
> After the change:
> * With `jumpTo`: plays backwards 2 times.
> * Without `jumpTo`: plays backwards 2 times.
>> If the jumpTo isn't required, then this isn't this a change in behaviour?
> Current code with `jumpTo` will behave the same. The question (which I presented initially) is whether this behavior is considered a bug or not when it comes to the initial state of an animation. It is certainly a bug when `stop()` is called, so I assume it is similar for the initial state.

> So this PR may need a document change for `Animation.play()`

Yes, and the docs need clarification in other places anyway. The [parent issue](https://bugs.openjdk.java.net/browse/JDK-8210238) from which this bug was isolated talks about these. Not sure at what point I will go over it since `Animation` is going to get some more changes in the (hopefully) near future.


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

More information about the openjfx-dev mailing list