Fix interpolator being called after last animation iteration #12781
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
This PR makes sure that an animation's interpolator isn't called after the last iteration of the animation.
What is the current behavior?
Currently, if the step is greater than the animation duration, the easing and interpolating functions are called for a new iteration, even if the iteration count has already been reached. Note that those values aren't externally observable: they're basically discarded.
What is the updated/expected behavior with this PR?
The easing and interpolating functions aren't called after the animation complete.
How was the solution implemented (if it's not obvious)?
Return immediately after completing the last iteration. Previously, the code continued and computed a new value using the easing and interpolation functions, and tried to push it to the observers. (Note that the observable being already completed prevented
PublishNext
from doing anything.)A test has been added.
Fixed issues