- New Runtime (Recommended)
- Legacy Runtime
Once you have access to the Rive ref object (via
useRive hook), there are a number of methods available to invoke for controlling your Rive graphic.() => Promise<void>
Starts playing the Rive graphic.
() => Promise<void>
Pauses the Rive graphic.
() => Promise<void>
Resets the Rive graphic to its initial state.
() => void
Low overhead function to ensure the Rive graphic is playing. Use after property value updates to ensure the graphic is updated.
() => Promise<boolean>
Waits for the Rive view to be ready. Resolves to
true once the view is configured, or false if configuration failed. The riveViewRef returned by useRive is only set after this resolves.(viewModelInstance: ViewModelInstance) => void
Binds a view model instance to the Rive view. See the Data Binding documentation for more details.
() => ViewModelInstance | undefined
Gets the currently bound view model instance from the Rive view. Returns the bound
ViewModelInstance, or undefined if none is bound.To wait for the auto-bound instance in a component, prefer useViewModelInstance(riveViewRef, { async: true }).(name: string, value: string, path?: string) => void
Sets the text run value on the Rive view.
(name: string, path?: string) => string
Gets the text run value from the Rive view.
(name: string, value: number, path?: string) => void
Sets a number state machine input on the Rive view.
(name: string, path?: string) => number
Gets a number state machine input from the Rive view.
(name: string, value: boolean, path?: string) => void
Sets a boolean state machine input on the Rive view.
(name: string, path?: string) => boolean
Gets a boolean state machine input from the Rive view.
(name: string, path?: string) => void
Triggers a trigger state machine input on the Rive view.
(onEvent: (event: UnifiedRiveEvent) => void) => void
Adds an event listener to the Rive view.
() => void
Removes all event listeners from the Rive view.