Skip to content

Rive state machines not supported #5147

Open
@UmungoBungo

Description

@UmungoBungo

I have worked on this over many days but I'm stumbling at the last step!

https://stackblitz.com/edit/github-gmmxfvca?file=src%2FstateMachineSupport%2FRiveComp.tsx

Image

Compositions in the 'existing-package' folder make use of the existing @remotion/rive package. You can see that the state machine animation isn't animating, while the linearAnimation is fine.

I've pulled apart the @remotion/rive package and added support for the state machine, and that can be viewed in the RiveComposition composition. The difficulty with state machines is that you can't get the current time. And when rendering with concurrency, you aren't advancing it from frame 0, and incrementing 1 frame at a time. My solution is to delete all of the Rive instance for every frame, and re-initialise it.

For some reason when I first load my Rive file (not the scooter animation from the stackblitz example), the state machine is not at 0 seconds. At least, it doesn't look the same as it does in the Rive editor at 0 seconds.
To get around this, I advance the state machine forward by a small increment, and then back again by a small increment. This initializes it to a known value of 0. Not ideal, but I can live with that if I really need to.

Things seem to be ok as you click along the Remotion timeline in the studio - the frames are deterministic 🎉

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions