-
Notifications
You must be signed in to change notification settings - Fork 202
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
How do I reset an animation to the beginning? #165
Comments
Is there a way?? |
Hi @JacoFourie, sorry for the delay here; animation controllers should support |
Hi. did you fix it now. I did use Reset in the past but it did nothing. So I was forced to make another animation that would reset the values and call that after I call the reset. |
The Flutter version: 2.8.1 Use case: |
Hi @zplata . The reset does nothing. How should it be used? |
Getting same problems here |
@zplata Is anybody at Rive looking at these errors? |
Hey @JacoFourie, sorry I missed your original tag. I'll try and find some time to repro this with a looping animation and see what's going on (I think I tested with a OneShot before). We definitely keep an eye on the issues of our runtimes and try to balance our resources on these. |
@JacoFourie Wondering if you have any code snippets to share on how you're calling Calling To achieve the effect of stopping an animation and getting it to the first frame on a reset, try the following:
Check out this gist example: https://gist.github.com/zplata/44548006ab4f70e7802ba0035d9f3dce - hopefully this helps! |
@zplata I stop the animation by setting it to false and the issue the reset command. The animation will only reset on the screen when you start it again. I need it to go back to the first frame on the screen when I reset it. |
I made used of drawFrame() and reset() that two commands worked for me |
Another option would be to make use of reset and to only pause the animation on the next Flutter frame. controller.reset();
WidgetsBinding.instance.addPostFrameCallback((_) {
controller.isActive = !controller.isActive;
}); However, what @zplata suggested also works, and may be the better approach. Closing this for now. If anyone stumbles on this and have suggestions/issues feel free to re-open. |
Hi, guys! Still running into this issue. How can I use the cc: @zplata
|
Same question as @eRuaro |
Hi all.
Thank you for building Rive. I have been playing with it and seems to do all I need. I have one question?
If I have a animation that loops all the time, how do I set it back to the start after I set its active state to false? I want the animation to go to the start once I stopped it. Then when I start the animation again it should start from the start. If I set Active to false and later to true again it continues where it left off. I want to reset it. I have used the reset() method but it does nothing when I stop the animation. It seems when I start it again it will start at the beginning but once I stop it it stays where it was stopped.
The text was updated successfully, but these errors were encountered: