-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How to Pause/Suspend animation of a Spring (and or Transition) #427
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
Comments
Do you have the option to use hooks? This would make it easier. A Spring is a declaration of intent, to pause would essentially conflict with the props-declaration. You can do it, but only through reaching into internals <Spring ref={r => r && r.controller.cancel()} ... /> |
Thank you for the quick reply. I'd like to pause an ongoing animation, and be able to resume. With your indication I tried to used the controller, as in this pen I couldn't find a cancel method, but stop and start. Reclicking start (after first start, or stop) would not resume the animation. |
I gave it a try with hooks, but am only partially happy with it. https://codepen.io/anon/pen/vvVbNZ?editors=0011 Is that what you had in mind when saying hook would make it easier? Also, the drawback with this approach is that duration seems to be reset. |
The |
Is there a simple way to pause the animation of a Spring?
I've tried to put an infinite friction, but bringing friction back to default would not resume the animation.
Super thanks
The text was updated successfully, but these errors were encountered: