Skip to content

Fix interpolator being called after last animation iteration #12781

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

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

MrJul
Copy link
Member

@MrJul MrJul commented Sep 4, 2023

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

@grokys grokys enabled auto-merge September 8, 2023 14:44
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039309-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@grokys grokys added this pull request to the merge queue Sep 8, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 8, 2023
@grokys grokys added this pull request to the merge queue Sep 13, 2023
Merged via the queue into AvaloniaUI:master with commit a2b7ca4 Sep 13, 2023
@MrJul MrJul deleted the fix/interpolator-after-completion branch September 15, 2023 10:20
@MrJul MrJul added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Sep 30, 2023
grokys added a commit that referenced this pull request Oct 2, 2023
@grokys grokys added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animator crossing cycle boundaries on InterpolatingAnimator<T>
3 participants