-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathtypes.ts
More file actions
34 lines (30 loc) · 1.14 KB
/
types.ts
File metadata and controls
34 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { RefCallback, ComponentProps } from 'react';
import { Rive, RiveParameters } from '@rive-app/canvas';
export type UseRiveParameters = Partial<Omit<RiveParameters, 'canvas'>> | null;
export type UseRiveOptions = {
useDevicePixelRatio: boolean;
fitCanvasToArtboardHeight: boolean;
useOffscreenRenderer: boolean;
usePrefersReducedMotion: boolean;
};
export type Dimensions = {
width: number;
height: number;
};
/**
* @typedef RiveState
* @property canvas - Canvas element the Rive Animation is attached to.
* @property setCanvasRef - Ref callback to be passed to the canvas element.
* @property setContainerRef - Ref callback to be passed to the container element
* of the canvas. This is optional, however if not used then the hook will
* not take care of automatically resizing the canvas to it's outer
* container if the window resizes.
* @property rive - The loaded Rive Animation
*/
export type RiveState = {
canvas: HTMLCanvasElement | null;
setCanvasRef: RefCallback<HTMLCanvasElement>;
setContainerRef: RefCallback<HTMLElement>;
rive: Rive | null;
RiveComponent: (props: ComponentProps<'canvas'>) => JSX.Element;
};