-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Updating duration in useSpring config part way through animation causes object to move "backward" #1163
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@tbntdima what are you expecting to happen here? I've forked the example so I can see the two runners side by side (one has its duration changed): https://codesandbox.io/s/modern-bush-cubzn?file=/src/App.js As I can see spring doesn't reset to the default Are you expecting the object to stay in the same position and slow down because that would be almost like it has an easing function (in this case ease-out). Or are you expecting the entire spring to reset? If so, do you think that makes sense to do so? 🤔 |
@joshuaellis I guess the issue was fixed already (haven't tested yet). |
Okay, it'd be great if you could check out the link I posted above to see if that's whats expected and we could talk further. |
@joshuaellis just checked the link. It seems that the issue is still there. When I click on the button, the first box flickers back a bit, instead of slowing down. |
Okay, so let's say that the box moves over 2000secs, at 1000secs (50%) you change the total duration to 4000 secs makes its current place, 1000seconds to be 25% complete. What you're expecting the box to stay where it is in terms of percentage of competition (in this case 50%) and take double the time to finish the last 50% in double the time? |
@joshuaellis yep, sounds right for me. Not sure if its intuitive for other people, but thats what I would expect on duration change. wdyt? |
I think it would make for a more pleasing animation (no moving backwards) and probably makes more sense in terms of physics..... @creativiii, @CodyJasonBennett what do you think? |
That's how I'd expect that to work! |
Thanks @joshuaellis 🙂 |
When I update the duration via
useState
, animation flickers back, not to initial value though.I think you will understand from codesandbox example. Try to click the button, once the animation is 50% done.
codesandbox example
The text was updated successfully, but these errors were encountered: