rive-app / rive-react

React runtime for Rive
https://rive-app.github.io/rive-react
MIT License
808 stars 32 forks source link

Start playback animation at specific frame #190

Open annarack opened 1 year ago

annarack commented 1 year ago

Hey!

Currently it's only possible to play/pause/stop an animation. As far as I can see it's not possible get the current frame or to jump to a specific frame or?

zplata commented 1 year ago

Hello 👋 ! If you're just playing a singular animation via the animations property, you should be able to use scrub(animationName: String, value: Number) on the rive object returned from useRive() to scrub (in seconds) to the timestamp you need. This isn't possible on a state machine yet, to be able to scrub to a certain frame/time in a given state.