-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8236753: Animations do not play backwards after being stopped #82
8236753: Animations do not play backwards after being stopped #82
Conversation
👋 Welcome back nlisker! A progress list of the required criteria for merging this PR into |
I'll review this next week. This seems a fine candidate for openjfx14, so it (along with a couple other pending reviews that can be for 14) will be a good test of targeting a PR to the stabilization branch. I also request @arapte to review. |
I should add that it will depend on whether there are any regressions. One thing we do need to be careful of is introducing regressions during rampdown. |
The fix looks good to me. To play an
After this PR call to |
Mailing list message from Scott Palmer on openjfx-dev:
If the jumpTo isn?t required, then this isn?t this a change in behaviour? I?m wonder in particular if this has an effect on cycleCount. 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? Scott |
Before the change:
After the change:
Current code with |
Yes, and the docs need clarification in other places anyway. The parent issue from which this bug was isolated talks about these. Not sure at what point I will go over it since |
Based on my testing, and thinking through all of the implications of the fix, I think the proposed fix is correct. I modified the Timeline.java test program attached to JDK-8210238 to add controls for auto-reverse and cycle count (1, 2, or INDEFINITE), and attached it as TimelineTest2.java. I tried several combinations, and the change in behavior looks correct in all cases to me. As you point out in the description, the failing unit test, SequentialTransitionPlayTest.testCycleReverse is coded to test for the existing behavior when you first call play with You also mentioned that jumping, even to the start or end, sets As part of my testing, I ran into what may be a bug, but since the behavior is the same with or without your patch, I think it would be best to file a new bug and deal with it separately (if, in fact, it is a bug). Here are the steps I used:
|
Since the animation plays from the end for an arbitrary duration (at least I think it's arbitrary, compared to a pulse), I changed the assert to check that the property value is in the playing range of the animation and not equals to some specific value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved.
The fix looks fine to me, and now passes all unit tests. The change you made to the test is what I would expect (I had done a similar thing locally to get them to pass when I was testing).
Regarding the question that came up earlier in the review about modifying the docs to remove the call to jumpTo
from the example, I do not recommend changing the docs as part of this fix. The existing example code is still correct. More importantly, the code snippet in question is part of the docs for Animation::play
, and isn't just talking about playing when stopped. If you play after a paused animation and want to play backwards from the end, then the jumpTo
is still needed.
Additionally, there are other questionable aspects of the Animation docs. For example, consider the following:
When rate > 0 (forward play), if an Animation is already positioned at the end, the first cycle will not be played
This is misleading in that it is only true after an explicit call to "jumpTo(end)". If you play a forward animation to completion, then it isn't. My point for bring it up is that I don't really want to make changes to the docs without considering the larger implications.
Please wait for @arapte to finish reviewing.
@nlisker This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type
Since the source branch of this PR was last updated there have been 18 commits pushed to the ➡️ To integrate this PR with the above commit message, type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me.
/integrate |
@nlisker The following commits have been pushed to jfx14 since your change was applied:
Your commit was automatically rebased without conflicts. Pushed as commit 9ae37f1. |
Mailing list message from Nir Lisker on openjfx-dev: Changeset: 9ae37f1 8236753: Animations do not play backwards after being stopped Reviewed-by: kcr, arapte ! modules/javafx.graphics/src/main/java/javafx/animation/Animation.java |
Filed as JDK-8237748. |
Mailing list message from Nir Lisker on openjfx-dev: Changeset: 9ae37f1 8236753: Animations do not play backwards after being stopped Reviewed-by: kcr, arapte ! modules/javafx.graphics/src/main/java/javafx/animation/Animation.java |
@kevinrushforth Any idea why I got another integration message from mlbridgebot 2 days later? |
I just now did a sync from @rwestberg any ideas? |
The private field
lastPlayFinished
is responsible for 2 cases where an animation inSTOPPED
status does not play afterplay()
is called if the rate is negative:STOPPED
andlastPlayFinished
isfalse
. Setting a negative rate and callingplay()
will not jump to the end of the animation (in order to play it backwards) because theif (lastPlayedFinished)
check isfalse
. Creating the animation withlastPlayFinished = true
fixes this. However,SequentialTransitionPlayTest#testCycleReverse
's initial state test implies that the original behavior is correct. That test currently fails with this change. Either the fix is reverted or the test is corrected.STOPPED
already),jumpTo(Duration.ZERO)
setslastPlayFinished
tofalse
, which causes the same issue above withplay()
. SettinglastPlayFinished = true
at the endstop()
fixes this issue.A test was added for case 2 to check that the playing head indeed jumps to the end of the animation. Without this fix, it stays at the start.
I'm still somewhat confused as to what constitutes a "last play finished". Any
jumpTo
resetslastPlayFinished
tofalse
, even if the jump is to the start/end of the animation. In this case, stopping an animation, jumping to its start/end, setting the rate to negative/positive, and playing, will do nothing as the end condition is reached immediately. This is what the behavior that was fixed for cases 1 and 2, but maybe this is also incorrect behavior for jumping to start/end.A test app is included in the "parent" bug, which also mentions a bug relating to pausing and playing backwards, so be mindful of it when testing.
Progress
Issue
JDK-8236753: Animations do not play backwards after being stopped
Approvers