rive-react
rive-react copied to clipboard
No Repeat/OnComplete support.
Hello!
I was wondering if the Rive-React player has built-in support for repeating animations, and for triggering callbacks once an animation is complete.
For repeating, we'd like to perform an animation upon button click, and perform it again for subsequent clicks. We can do this with the following;
onClick={() => {
rive.reset()
rive.play()
}
Which gives us the intended behavior.
On the other hand, we are able to perform an onComplete check by using the onStop listener provided by useRive
, as it is triggered upon animation completion. However, if we use the above reset/play logic, onStop is triggered twice.
Is there any built-in support for these use-cases, or a recommended approach to accomplish this?
Thanks.