Skip to content

How do I access artboard and view model instance with useRive? #337

@anatolii-pyroh

Description

@anatolii-pyroh

My rive file got update, if before I used to use rive.setNumberStateAtPath to change my block lines count, now I need to access view model instance to directly change text in that box, for example change its font size.

From rive docs, I received these instructions on how to do it:

Access the View Model Instance:
Within your application, retrieve the Artboard from the loaded Rive file. Then, access the ViewModelInstance associated with that Artboard. This instance contains the properties you’ve defined and bound in the Rive editor.
Modify Properties at Runtime:
Once you have access to the View ModelInstance, you can get or set its properties to reflect changes in your application. For example, if you have a property controlling font size, you can update it based on user input or other runtime conditions.

BUT, the problem is, there is no properties on my rive to get artboard

Image

Here is how I initialize the rive:

Image

Importing everything from @rive-app/react-canvas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions