-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Spring animation sometimes has negative start offset #4468
Labels
Comments
rikschennink
added a commit
to rikschennink/svelte
that referenced
this issue
Mar 10, 2020
5 tasks
I ran into the same issue while making a draggable bottom sheet component where the spring used for snapping had a tendency to jump at start. Your fix inside the spring function resolved the issue so hope to see it merged. 👍 |
johanbissemattsson
added a commit
to johanbissemattsson/svelte
that referenced
this issue
Aug 12, 2020
fix spring animation sometimes has negative start offset sveltejs#4468
johanbissemattsson
pushed a commit
to johanbissemattsson/svelte
that referenced
this issue
Oct 25, 2020
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#4531
Describe the bug
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 values shows:
100.1 -> 98 -> 87 -> etc.
That 100.1 is problematic as it causes a slight jump.
To Reproduce
I've not been able to reproduce this in the REPL but I've debugged the spring.ts file.
It seems the value returned by the
now()
function that is set to thelast_time
variable at line 99 can be different from thenow
value in theloop
, which causes the first tick of the spring to be in the past resulting in a negative start point.I suspect setting now inside the animation loop will fix this.
Expected behavior
The value should not jump up before being lowered.
Information about your Svelte project:
Severity
This is causing animations to slightly jump when they start, I'll probably create a custom spring.ts function to work around this.
The text was updated successfully, but these errors were encountered: