rive-react
rive-react copied to clipboard
Update play animation based on changes to the params
Right now changes to the riveParams passed into the useRive hook aren't listened to. E.g if you try to change the animation as follows, it will not update when isDark changes:
const params = {
src: 'lightdarkmode.riv',
autoplay: true,
animations: isDark ? "dark" : "light", // this is not working
};
These changes should be listened to and update the current file. We will do this by creating a new instance of the animation/state machine with these updated values, meaning any previous artboard state will be lost. If previous artboard state wishes to be kept, the user should use stop()/play() instead