Skip to content
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

fix: ensure spring animation does not have negative start offset #4531

Closed
wants to merge 1 commit into from

Conversation

rikschennink
Copy link

@rikschennink rikschennink commented Mar 10, 2020

fixes #4468

In some situations animating a spring causes the spring value to animate in the wrong direction for the first tick.

For example, animating 100 to 0, logging the value inside the spring function shows:

100.1 -> 98 -> 87 -> 80 -> all good

That 100.1 is problematic, it causes a slight jump at the start of the animation.

As stated in the referenced issue I wasn't able to reproduce this with a test or on the REPL, this PR did solve the issue in my project.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. Haven’t included a test as I don’t know what causes the issue.
  • Remember to npm run lint!

Tests

  • Run the tests tests with npm test or yarn test

@stale
Copy link

stale bot commented Jun 26, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 27, 2021
@dummdidumm dummdidumm added this to the 3.x milestone Mar 2, 2023
@benmccann benmccann changed the title Fix spring animation sometimes has negative start offset #4468 fix: ensure spring animation does not have negative start offset Apr 19, 2023
@dummdidumm dummdidumm modified the milestones: 3.x, one day Apr 28, 2023
Copy link

@vignesh1507 vignesh1507 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating it.

@Rich-Harris
Copy link
Member

very belated thanks! I've opened #14541 which fixes the issue from the other direction, by ensuring that we use the same clock in task callbacks as elsewhere — this means that the same fix applies in other places that use loop too. Closing in favour of that PR

@Rich-Harris Rich-Harris closed this Dec 4, 2024
@rikschennink
Copy link
Author

Thanks @Rich-Harris, glad to see this fixed :)

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.

Spring animation sometimes has negative start offset
5 participants