svelte
svelte copied to clipboard
fix: ensure spring animation does not have negative start offset
fixes https://github.com/sveltejs/svelte/issues/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
- [x] 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.
- [x] This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
- [x] 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.
- [x] Remember to
npm run lint!
Tests
- [x] Run the tests tests with
npm testoryarn test
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.