@rive-app/webgl-single 1.0.69 → 1.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rive.d.ts +3 -2
- package/rive.js +122 -83
- package/rive.js.map +1 -1
- package/rive_advanced.mjs.d.ts +20 -17
package/rive_advanced.mjs.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ interface RiveOptions {
|
|
|
2
2
|
locateFile(file: string): string
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
declare function Rive(options
|
|
5
|
+
declare function Rive(options?: RiveOptions): Promise<RiveCanvas>;
|
|
6
6
|
export default Rive;
|
|
7
7
|
|
|
8
8
|
export interface RiveCanvas {
|
|
@@ -10,6 +10,9 @@ interface RiveOptions {
|
|
|
10
10
|
CanvasRenderer: typeof CanvasRenderer;
|
|
11
11
|
LinearAnimationInstance: typeof LinearAnimationInstance;
|
|
12
12
|
StateMachineInstance: typeof StateMachineInstance;
|
|
13
|
+
Mat2D: typeof Mat2D;
|
|
14
|
+
Vec2D: typeof Vec2D;
|
|
15
|
+
AABB: AABB;
|
|
13
16
|
SMIInput: typeof SMIInput;
|
|
14
17
|
renderFactory: CanvasRenderFactory;
|
|
15
18
|
|
|
@@ -21,7 +24,7 @@ interface RiveOptions {
|
|
|
21
24
|
StrokeJoin: typeof StrokeJoin;
|
|
22
25
|
|
|
23
26
|
load(buffer: Uint8Array): Promise<File>;
|
|
24
|
-
makeRenderer(canvas: HTMLCanvasElement | OffscreenCanvas, useOffscreenRenderer
|
|
27
|
+
makeRenderer(canvas: HTMLCanvasElement | OffscreenCanvas, useOffscreenRenderer?: boolean) : CanvasRenderer;
|
|
25
28
|
computeAlignment(fit: Fit, alignment: Alignment, frame: AABB, content: AABB): Mat2D;
|
|
26
29
|
mapXY(matrix: Mat2D, canvasPoints: Vec2D): Vec2D;
|
|
27
30
|
requestAnimationFrame(cb: (timestamp: DOMHighResTimeStamp) => void): number;
|
|
@@ -42,6 +45,8 @@ interface RiveOptions {
|
|
|
42
45
|
clipPath(path: RenderPath): void;
|
|
43
46
|
clear(): void;
|
|
44
47
|
flush(): void;
|
|
48
|
+
translate(x: number, y: number): void;
|
|
49
|
+
rotate(angle: number): void;
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
export declare class RenderPathWrapper {
|
|
@@ -111,15 +116,17 @@ interface RiveOptions {
|
|
|
111
116
|
export declare class Artboard {
|
|
112
117
|
get name(): string;
|
|
113
118
|
get bounds(): AABB;
|
|
119
|
+
get frameOrigin(): boolean;
|
|
120
|
+
set frameOrigin(val: boolean);
|
|
114
121
|
// Deletes the backing wasm artboard instance
|
|
115
122
|
delete(): void;
|
|
116
123
|
advance(sec: number): any;
|
|
117
124
|
draw(renderer: CanvasRenderer): void;
|
|
118
|
-
animationByName(name: string):
|
|
119
|
-
animationByIndex(index: number):
|
|
125
|
+
animationByName(name: string): LinearAnimationInstance;
|
|
126
|
+
animationByIndex(index: number): LinearAnimationInstance;
|
|
120
127
|
animationCount(): number;
|
|
121
|
-
stateMachineByName(name: string):
|
|
122
|
-
stateMachineByIndex(index: number):
|
|
128
|
+
stateMachineByName(name: string): StateMachineInstance;
|
|
129
|
+
stateMachineByIndex(index: number): StateMachineInstance;
|
|
123
130
|
stateMachineCount(): number;
|
|
124
131
|
bone(name: string): Bone;
|
|
125
132
|
node(name: string): Node;
|
|
@@ -145,12 +152,15 @@ interface RiveOptions {
|
|
|
145
152
|
rotation: number;
|
|
146
153
|
scaleX: number;
|
|
147
154
|
scaleY: number;
|
|
155
|
+
worldTransform(): Mat2D;
|
|
156
|
+
parentWorldTransform(result: Mat2D): void;
|
|
148
157
|
}
|
|
149
158
|
|
|
150
159
|
///////////////
|
|
151
160
|
// Animation //
|
|
152
161
|
///////////////
|
|
153
|
-
export declare class
|
|
162
|
+
export declare class LinearAnimationInstance {
|
|
163
|
+
constructor(animation: LinearAnimationInstance, artboard: Artboard);
|
|
154
164
|
get name(): string;
|
|
155
165
|
get duration(): number;
|
|
156
166
|
get fps(): number;
|
|
@@ -158,13 +168,9 @@ interface RiveOptions {
|
|
|
158
168
|
get workEnd(): number;
|
|
159
169
|
get loopValue(): number;
|
|
160
170
|
get speed(): number;
|
|
161
|
-
apply(artboard: Artboard, time: number, mix: number): void;
|
|
162
|
-
}
|
|
163
|
-
export declare class LinearAnimationInstance {
|
|
164
171
|
/** Time of the animation in seconds */
|
|
165
172
|
time: number;
|
|
166
173
|
didLoop: boolean;
|
|
167
|
-
constructor(animation: LinearAnimation, artboard: Artboard);
|
|
168
174
|
advance(sec: number): any;
|
|
169
175
|
/**
|
|
170
176
|
* Apply animation on the artboard
|
|
@@ -175,12 +181,9 @@ interface RiveOptions {
|
|
|
175
181
|
delete(): void;
|
|
176
182
|
}
|
|
177
183
|
|
|
178
|
-
export declare class StateMachine {
|
|
179
|
-
get name(): string;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
184
|
export declare class StateMachineInstance {
|
|
183
|
-
constructor(stateMachine:
|
|
185
|
+
constructor(stateMachine: StateMachineInstance, artboard: Artboard);
|
|
186
|
+
get name(): string;
|
|
184
187
|
inputCount(): number;
|
|
185
188
|
input(i: number): SMIInput;
|
|
186
189
|
advance(sec: number): any;
|
|
@@ -312,7 +315,7 @@ interface RiveOptions {
|
|
|
312
315
|
yy: number;
|
|
313
316
|
tx: number;
|
|
314
317
|
ty: number;
|
|
315
|
-
invert(mat: Mat2D):
|
|
318
|
+
invert(mat: Mat2D): boolean;
|
|
316
319
|
}
|
|
317
320
|
|
|
318
321
|
export declare class Vec2D {
|