rive-app / rive-app/rive-react

Update play animation based on changes to the params

Open
#24 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
58
Avg merge
3h 23m
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the useRive hook implementation and tracing how riveParams create the current animation instance. Verify the behavior with the isDark example: changing animations should create a new instance using the updated values, with previous artboard state intentionally discarded.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.