You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -31,6 +31,7 @@ There's multiple ways to render Rive using the React runtime. See the associated
31
31
```tsx
32
32
importRiveComponentfrom'@rive-app/react-canvas';
33
33
```
34
+
34
35
The React runtime exports a default React component you can insert as JSX. Under the hood, it renders a `<canvas>` element that runs the animation, and a wrapping `<div>` element that handles sizing of the canvas based on the parent that wraps the component.
35
36
36
37
**When to use this**: Use this for simple rendering cases where you don't need to control playback or setup state machine inputs to advance state machines. It will simply autoplay the first animation it finds in the `.riv`, the animation name you provide it, or the state machine name if you provide one.
@@ -56,20 +57,21 @@ In addition to the props laid out below, the component accepts other props that
56
57
### useRive Hook
57
58
58
59
```tsx
59
-
import {useRive} from'@rive-app/react-canvas';
60
+
import {useRive} from'@rive-app/react-canvas';
60
61
```
61
62
62
63
The runtime also exports a named `useRive` hook that allows for more control at Rive instantiation, since it passes back a `rive` object you can use to manipulate state machines, control playback, and more.
63
64
64
65
**When to use this:** When you need to control your Rive animation in any aspect, such as controlling playback, using state machine inputs to advance state machines, add adding callbacks on certain Rive-specific events such as `onStateChange`, `onPause`, etc.
Copy file name to clipboardExpand all lines: src/components/Rive.tsx
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,11 @@ export interface RiveProps {
28
28
* For `@rive-app/react-webgl`, sets this property to maintain a single WebGL context for multiple canvases. **We recommend to keep the default value** when rendering multiple Rive instances on a page.
29
29
*/
30
30
useOffscreenRenderer?: boolean;
31
-
};
31
+
/**
32
+
* If true, the runtime will respect the users "prefers-reduced-motion" accessibilty option and start the animation paused. Defaults to false.
0 commit comments