@lottiefiles/dotlottie-web 0.63.0 → 0.64.0
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/dist/dotlottie-player.wasm +0 -0
- package/dist/index.cjs +3 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1505 -1505
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +1505 -1505
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/package.json +11 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
//#region src/core/dotlottie-player.types.d.ts
|
|
1
2
|
interface Marker {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
duration: number;
|
|
4
|
+
name: string;
|
|
5
|
+
time: number;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/event-manager.d.ts
|
|
7
9
|
/**
|
|
8
10
|
* Represents the different types of events that can be dispatched.
|
|
9
11
|
*/
|
|
@@ -12,162 +14,161 @@ type EventType = 'complete' | 'frame' | 'load' | 'loadError' | 'renderError' | '
|
|
|
12
14
|
* Maps an event type string to its respective event interface.
|
|
13
15
|
*/
|
|
14
16
|
type EventByType<T extends EventType> = Extract<Event, {
|
|
15
|
-
|
|
17
|
+
type: T;
|
|
16
18
|
}>;
|
|
17
19
|
/**
|
|
18
20
|
* Base interface for all events.
|
|
19
21
|
*/
|
|
20
22
|
interface BaseEvent {
|
|
21
|
-
|
|
23
|
+
type: EventType;
|
|
22
24
|
}
|
|
23
25
|
interface RenderEvent extends BaseEvent {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
currentFrame: number;
|
|
27
|
+
type: 'render';
|
|
26
28
|
}
|
|
27
29
|
interface FreezeEvent extends BaseEvent {
|
|
28
|
-
|
|
30
|
+
type: 'freeze';
|
|
29
31
|
}
|
|
30
32
|
interface UnfreezeEvent extends BaseEvent {
|
|
31
|
-
|
|
33
|
+
type: 'unfreeze';
|
|
32
34
|
}
|
|
33
35
|
interface DestroyEvent extends BaseEvent {
|
|
34
|
-
|
|
36
|
+
type: 'destroy';
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Event fired when a loop action occurs.
|
|
38
40
|
*/
|
|
39
41
|
interface LoopEvent extends BaseEvent {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
loopCount: number;
|
|
43
|
+
type: 'loop';
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* Event fired during frame changes.
|
|
45
47
|
*/
|
|
46
48
|
interface FrameEvent extends BaseEvent {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
currentFrame: number;
|
|
50
|
+
type: 'frame';
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* Event fired when a load action occurs.
|
|
52
54
|
*/
|
|
53
55
|
interface LoadEvent extends BaseEvent {
|
|
54
|
-
|
|
56
|
+
type: 'load';
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
57
59
|
* Event fired when a loading error occurs.
|
|
58
60
|
*/
|
|
59
61
|
interface LoadErrorEvent extends BaseEvent {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
error: Error;
|
|
63
|
+
type: 'loadError';
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* Event fired when a loading error occurs.
|
|
65
67
|
*/
|
|
66
68
|
interface RenderErrorEvent extends BaseEvent {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
error: Error;
|
|
70
|
+
type: 'renderError';
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
73
|
* Event fired when a completion action occurs.
|
|
72
74
|
*/
|
|
73
75
|
interface CompleteEvent extends BaseEvent {
|
|
74
|
-
|
|
76
|
+
type: 'complete';
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
77
79
|
* Event fired when a pause action occurs.
|
|
78
80
|
*/
|
|
79
81
|
interface PauseEvent extends BaseEvent {
|
|
80
|
-
|
|
82
|
+
type: 'pause';
|
|
81
83
|
}
|
|
82
84
|
/**
|
|
83
85
|
* Event fired when a play action occurs.
|
|
84
86
|
*/
|
|
85
87
|
interface PlayEvent extends BaseEvent {
|
|
86
|
-
|
|
88
|
+
type: 'play';
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* Event fired when a stop action occurs.
|
|
90
92
|
*/
|
|
91
93
|
interface StopEvent extends BaseEvent {
|
|
92
|
-
|
|
94
|
+
type: 'stop';
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
95
97
|
* Event fired when a WASM module is initialized and ready.
|
|
96
98
|
*/
|
|
97
99
|
interface ReadyEvent extends BaseEvent {
|
|
98
|
-
|
|
100
|
+
type: 'ready';
|
|
99
101
|
}
|
|
100
102
|
interface StateMachineStartEvent extends BaseEvent {
|
|
101
|
-
|
|
103
|
+
type: 'stateMachineStart';
|
|
102
104
|
}
|
|
103
105
|
interface StateMachineStopEvent extends BaseEvent {
|
|
104
|
-
|
|
106
|
+
type: 'stateMachineStop';
|
|
105
107
|
}
|
|
106
108
|
interface StateMachineTransitionEvent extends BaseEvent {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
fromState: string;
|
|
110
|
+
toState: string;
|
|
111
|
+
type: 'stateMachineTransition';
|
|
110
112
|
}
|
|
111
113
|
interface StateMachineStateEnteredEvent extends BaseEvent {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
state: string;
|
|
115
|
+
type: 'stateMachineStateEntered';
|
|
114
116
|
}
|
|
115
117
|
interface StateMachineStateExitEvent extends BaseEvent {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
state: string;
|
|
119
|
+
type: 'stateMachineStateExit';
|
|
118
120
|
}
|
|
119
121
|
interface StateMachineCustomEvent extends BaseEvent {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
eventName: string;
|
|
123
|
+
type: 'stateMachineCustomEvent';
|
|
122
124
|
}
|
|
123
125
|
interface StateMachineErrorEvent extends BaseEvent {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
error: string;
|
|
127
|
+
type: 'stateMachineError';
|
|
126
128
|
}
|
|
127
129
|
interface StateMachineBooleanInputValueChangeEvent extends BaseEvent {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
inputName: string;
|
|
131
|
+
newValue: boolean;
|
|
132
|
+
oldValue: boolean;
|
|
133
|
+
type: 'stateMachineBooleanInputValueChange';
|
|
132
134
|
}
|
|
133
135
|
interface StateMachineNumericInputValueChangeEvent extends BaseEvent {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
inputName: string;
|
|
137
|
+
newValue: number;
|
|
138
|
+
oldValue: number;
|
|
139
|
+
type: 'stateMachineNumericInputValueChange';
|
|
138
140
|
}
|
|
139
141
|
interface StateMachineStringInputValueChangeEvent extends BaseEvent {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
inputName: string;
|
|
143
|
+
newValue: string;
|
|
144
|
+
oldValue: string;
|
|
145
|
+
type: 'stateMachineStringInputValueChange';
|
|
144
146
|
}
|
|
145
147
|
interface StateMachineInputFiredEvent extends BaseEvent {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
inputName: string;
|
|
149
|
+
type: 'stateMachineInputFired';
|
|
148
150
|
}
|
|
149
151
|
interface StateMachineInternalMessage extends BaseEvent {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
message: string;
|
|
153
|
+
type: 'stateMachineInternalMessage';
|
|
152
154
|
}
|
|
153
155
|
/**
|
|
154
156
|
* Type representing all possible event types.
|
|
155
157
|
*/
|
|
156
158
|
type Event = LoopEvent | FrameEvent | LoadEvent | LoadErrorEvent | RenderErrorEvent | CompleteEvent | PauseEvent | PlayEvent | StopEvent | DestroyEvent | FreezeEvent | UnfreezeEvent | RenderEvent | ReadyEvent | StateMachineStartEvent | StateMachineStopEvent | StateMachineTransitionEvent | StateMachineStateEnteredEvent | StateMachineStateExitEvent | StateMachineCustomEvent | StateMachineErrorEvent | StateMachineBooleanInputValueChangeEvent | StateMachineNumericInputValueChangeEvent | StateMachineStringInputValueChangeEvent | StateMachineInputFiredEvent | StateMachineInternalMessage;
|
|
157
|
-
|
|
158
|
-
(event: EventByType<T>): void;
|
|
159
|
-
}
|
|
159
|
+
type EventListener<T extends EventType> = (event: EventByType<T>) => void;
|
|
160
160
|
/**
|
|
161
161
|
* Manages registration and dispatching of event listeners.
|
|
162
162
|
*/
|
|
163
163
|
declare class EventManager {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
private readonly _eventListeners;
|
|
165
|
+
addEventListener<T extends EventType>(type: T, listener: EventListener<T>): void;
|
|
166
|
+
removeEventListener<T extends EventType>(type: T, listener?: EventListener<T>): void;
|
|
167
|
+
dispatch<T extends EventType>(event: EventByType<T>): void;
|
|
168
|
+
removeAllEventListeners(): void;
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/types.d.ts
|
|
171
172
|
/**
|
|
172
173
|
* 3x3 transformation matrix for the entire animation on the canvas.
|
|
173
174
|
* Represented as a flattened 9-element tuple in row-major order: [m00, m01, m02, m10, m11, m12, m20, m21, m22].
|
|
@@ -179,26 +180,26 @@ type Transform = [number, number, number, number, number, number, number, number
|
|
|
179
180
|
* Controls how the animation is rendered and when rendering is optimized.
|
|
180
181
|
*/
|
|
181
182
|
interface RenderConfig {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Automatically resize canvas when container size changes.
|
|
185
|
+
* Set to true to maintain responsiveness without manual resize calls.
|
|
186
|
+
*/
|
|
187
|
+
autoResize?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Pixel density multiplier for high-DPI displays.
|
|
190
|
+
* Higher values increase quality but use more memory. Defaults to window.devicePixelRatio.
|
|
191
|
+
*/
|
|
192
|
+
devicePixelRatio?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Pause rendering when canvas is outside the viewport.
|
|
195
|
+
* Set to true (default) to improve performance when animation isn't visible.
|
|
196
|
+
*/
|
|
197
|
+
freezeOnOffscreen?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Rendering quality level (0-100).
|
|
200
|
+
* Lower values reduce quality but improve performance on resource-constrained devices.
|
|
201
|
+
*/
|
|
202
|
+
quality?: number;
|
|
202
203
|
}
|
|
203
204
|
/**
|
|
204
205
|
* Animation playback direction mode.
|
|
@@ -220,213 +221,209 @@ type Fit = 'contain' | 'cover' | 'fill' | 'none' | 'fit-width' | 'fit-height';
|
|
|
220
221
|
* Determines how the animation fits and aligns within the available space.
|
|
221
222
|
*/
|
|
222
223
|
interface Layout {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Alignment position as [x, y] coordinates in 0-1 range.
|
|
226
|
+
* [0.5, 0.5] centers the animation, [0, 0] is top-left, [1, 1] is bottom-right.
|
|
227
|
+
*/
|
|
228
|
+
align?: [number, number];
|
|
229
|
+
/**
|
|
230
|
+
* Fit mode controlling how animation scales to canvas dimensions.
|
|
231
|
+
* Defaults to 'contain' to show the full animation without cropping.
|
|
232
|
+
*/
|
|
233
|
+
fit?: Fit;
|
|
233
234
|
}
|
|
234
235
|
/**
|
|
235
236
|
* Dimensions of a rendering surface for custom canvas implementations.
|
|
236
237
|
* Used when providing a custom render surface instead of HTMLCanvasElement.
|
|
237
238
|
*/
|
|
238
239
|
interface RenderSurface {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
/** Height of the render surface in pixels */
|
|
241
|
+
height: number;
|
|
242
|
+
/** Width of the render surface in pixels */
|
|
243
|
+
width: number;
|
|
243
244
|
}
|
|
244
245
|
/**
|
|
245
246
|
* Main configuration object for initializing a DotLottie player.
|
|
246
247
|
* Specifies the animation source, playback behavior, rendering options, and canvas target.
|
|
247
248
|
*/
|
|
248
249
|
interface Config {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
250
|
+
/**
|
|
251
|
+
* ID of the specific animation to play from a multi-animation dotLottie file.
|
|
252
|
+
* Leave undefined for single-animation files or to play the default animation.
|
|
253
|
+
*/
|
|
254
|
+
animationId?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Automatically start playback once the animation is loaded.
|
|
257
|
+
* Set to true for animations that should play immediately without user interaction.
|
|
258
|
+
*/
|
|
259
|
+
autoplay?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Background color as a CSS color string (e.g., '#FFFFFF' or 'transparent').
|
|
262
|
+
* Applied to the canvas element or as a fill behind the animation.
|
|
263
|
+
*/
|
|
264
|
+
backgroundColor?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Target canvas element for rendering.
|
|
267
|
+
* Can be HTMLCanvasElement, OffscreenCanvas, or custom RenderSurface with dimensions.
|
|
268
|
+
*/
|
|
269
|
+
canvas?: HTMLCanvasElement | OffscreenCanvas | RenderSurface;
|
|
270
|
+
/**
|
|
271
|
+
* Animation data to load directly.
|
|
272
|
+
* Use this to load from a string, ArrayBuffer, or parsed JSON instead of fetching from src.
|
|
273
|
+
*/
|
|
274
|
+
data?: Data;
|
|
275
|
+
/**
|
|
276
|
+
* Layout configuration for positioning and scaling the animation.
|
|
277
|
+
* Controls fit mode and alignment within the canvas.
|
|
278
|
+
*/
|
|
279
|
+
layout?: Layout;
|
|
280
|
+
/**
|
|
281
|
+
* Enable continuous looping of the animation.
|
|
282
|
+
* Set to true to repeat indefinitely, or use loopCount for a specific number of loops.
|
|
283
|
+
*/
|
|
284
|
+
loop?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Number of additional times to replay the animation after the first play.
|
|
287
|
+
* Requires `loop` to be true. A value of 0 means infinite replays; a positive value `n` means
|
|
288
|
+
* the animation plays a total of `n + 1` times (initial play + `n` replays).
|
|
289
|
+
*/
|
|
290
|
+
loopCount?: number;
|
|
291
|
+
/**
|
|
292
|
+
* Named marker to use as the playback segment.
|
|
293
|
+
* Plays only the portion of the animation defined by this marker instead of the full animation.
|
|
294
|
+
*/
|
|
295
|
+
marker?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Playback direction mode.
|
|
298
|
+
* Controls whether animation plays forward, reverse, or alternates (bounce).
|
|
299
|
+
*/
|
|
300
|
+
mode?: Mode;
|
|
301
|
+
/**
|
|
302
|
+
* Rendering configuration controlling canvas behavior.
|
|
303
|
+
* Includes autoResize, devicePixelRatio, freezeOnOffscreen, and quality settings.
|
|
304
|
+
*/
|
|
305
|
+
renderConfig?: RenderConfig;
|
|
306
|
+
/**
|
|
307
|
+
* Frame range to play as [startFrame, endFrame].
|
|
308
|
+
* Restricts playback to a specific portion of the animation instead of the full sequence.
|
|
309
|
+
*/
|
|
310
|
+
segment?: [number, number];
|
|
311
|
+
/**
|
|
312
|
+
* Playback speed multiplier.
|
|
313
|
+
* 1 is normal speed, 2 is double speed, 0.5 is half speed.
|
|
314
|
+
*/
|
|
315
|
+
speed?: number;
|
|
316
|
+
/**
|
|
317
|
+
* URL to fetch the animation from.
|
|
318
|
+
* Use this to load .lottie or .json files from a remote or local path.
|
|
319
|
+
*/
|
|
320
|
+
src?: string;
|
|
321
|
+
/**
|
|
322
|
+
* State machine security configuration.
|
|
323
|
+
* Controls URL opening policies for state machine-driven animations.
|
|
324
|
+
*/
|
|
325
|
+
stateMachineConfig?: StateMachineConfig;
|
|
326
|
+
/**
|
|
327
|
+
* ID of the state machine to load and activate.
|
|
328
|
+
* State machines enable interactive, event-driven animation behaviors.
|
|
329
|
+
*/
|
|
330
|
+
stateMachineId?: string;
|
|
331
|
+
/**
|
|
332
|
+
* ID of the theme to apply to the animation.
|
|
333
|
+
* Themes modify colors and visual properties defined in the dotLottie manifest.
|
|
334
|
+
*/
|
|
335
|
+
themeId?: string;
|
|
336
|
+
/**
|
|
337
|
+
* Enable frame interpolation for smoother playback.
|
|
338
|
+
* Set to true (default) for smoother animation, false for exact frame-by-frame playback.
|
|
339
|
+
*/
|
|
340
|
+
useFrameInterpolation?: boolean;
|
|
340
341
|
}
|
|
341
342
|
interface StateMachineConfig {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
343
|
+
/**
|
|
344
|
+
* Controls whether and which URLs can be opened by a state machine.
|
|
345
|
+
*
|
|
346
|
+
* - requireUserInteraction: When true, URLs open only after an explicit user action
|
|
347
|
+
* (e.g., click/pointer down) on the animation.
|
|
348
|
+
* - whitelist: List of allowed URL patterns. An empty list blocks all URLs. Use
|
|
349
|
+
* "*" to allow all URLs. Wildcards are supported in host and path (e.g.,
|
|
350
|
+
* "*.example.com/*").
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```typescript
|
|
354
|
+
* // Require user interaction before opening any URL
|
|
355
|
+
* openUrlPolicy: { requireUserInteraction: true, whitelist: ["*"] }
|
|
356
|
+
*
|
|
357
|
+
* // Block all URLs
|
|
358
|
+
* openUrlPolicy: { whitelist: [] }
|
|
359
|
+
*
|
|
360
|
+
* // Allow all URLs
|
|
361
|
+
* openUrlPolicy: { whitelist: ["*"] }
|
|
362
|
+
*
|
|
363
|
+
* // Allow a specific domain only
|
|
364
|
+
* openUrlPolicy: { whitelist: ["https://example.com"] }
|
|
365
|
+
*
|
|
366
|
+
* // Allow subdomains and any path under lottiefiles.com
|
|
367
|
+
* openUrlPolicy: { whitelist: ["*.lottiefiles.com/*"] }
|
|
368
|
+
* ```
|
|
369
|
+
*
|
|
370
|
+
* By default, URLs are denied and require user interaction.
|
|
371
|
+
*/
|
|
372
|
+
openUrlPolicy?: {
|
|
373
|
+
requireUserInteraction?: boolean;
|
|
374
|
+
whitelist?: string[];
|
|
375
|
+
};
|
|
375
376
|
}
|
|
376
377
|
/**
|
|
377
378
|
* dotLottie manifest containing metadata about available animations, themes, and state machines.
|
|
378
379
|
* Included in .lottie files to describe the contents and relationships between components.
|
|
379
380
|
*/
|
|
380
381
|
interface Manifest {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
id: string;
|
|
404
|
-
}>;
|
|
405
|
-
/** dotLottie specification version */
|
|
406
|
-
version?: string;
|
|
382
|
+
/**
|
|
383
|
+
* List of animations available in this dotLottie file.
|
|
384
|
+
* Each animation can have its own ID, themes, and background color.
|
|
385
|
+
*/
|
|
386
|
+
animations: Array<{
|
|
387
|
+
/** Background color for this animation */background?: string; /** Unique identifier for this animation */
|
|
388
|
+
id: string; /** Default theme to apply when this animation loads */
|
|
389
|
+
initialTheme?: string; /** List of theme IDs compatible with this animation */
|
|
390
|
+
themes?: string[];
|
|
391
|
+
}>;
|
|
392
|
+
/** Tool or application that created this dotLottie file */
|
|
393
|
+
generator?: string;
|
|
394
|
+
/** List of available state machines for interactive behavior */
|
|
395
|
+
stateMachines?: Array<{
|
|
396
|
+
id: string;
|
|
397
|
+
}>;
|
|
398
|
+
/** List of available themes that can modify animation appearance */
|
|
399
|
+
themes?: Array<{
|
|
400
|
+
id: string;
|
|
401
|
+
}>;
|
|
402
|
+
/** dotLottie specification version */
|
|
403
|
+
version?: string;
|
|
407
404
|
}
|
|
408
405
|
/**
|
|
409
406
|
* Bezier easing handle for keyframe interpolation
|
|
410
407
|
*/
|
|
411
408
|
interface BezierHandle {
|
|
412
|
-
|
|
413
|
-
|
|
409
|
+
x: number | number[];
|
|
410
|
+
y: number | number[];
|
|
414
411
|
}
|
|
415
412
|
/**
|
|
416
413
|
* Keyframe in Lottie native format
|
|
417
414
|
* The value type (Color, Vector, number, etc.)
|
|
418
415
|
*/
|
|
419
416
|
interface Keyframe<T> {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
417
|
+
/** Hold keyframe - no interpolation to next keyframe */
|
|
418
|
+
h?: 0 | 1;
|
|
419
|
+
/** Incoming bezier handle (optional, for easing) */
|
|
420
|
+
i?: BezierHandle;
|
|
421
|
+
/** Outgoing bezier handle (optional, for easing) */
|
|
422
|
+
o?: BezierHandle;
|
|
423
|
+
/** Start value at this keyframe */
|
|
424
|
+
s: T;
|
|
425
|
+
/** Time (frame number) */
|
|
426
|
+
t: number;
|
|
430
427
|
}
|
|
431
428
|
/**
|
|
432
429
|
* Color as RGB or RGBA array with values normalized to [0, 1]
|
|
@@ -478,24 +475,24 @@ type GradientSlotValue = Gradient | Array<Keyframe<Gradient>>;
|
|
|
478
475
|
* @see https://lottiefiles.github.io/lottie-docs/text/#text-document
|
|
479
476
|
*/
|
|
480
477
|
interface TextDocument {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
478
|
+
/** Font family */
|
|
479
|
+
f?: string;
|
|
480
|
+
/** Fill color [r, g, b] or [r, g, b, a] in [0, 1] range */
|
|
481
|
+
fc?: Color;
|
|
482
|
+
/** Justify: 0=left, 1=right, 2=center */
|
|
483
|
+
j?: 0 | 1 | 2;
|
|
484
|
+
/** Line height */
|
|
485
|
+
lh?: number;
|
|
486
|
+
/** Font size */
|
|
487
|
+
s?: number;
|
|
488
|
+
/** Stroke color [r, g, b] or [r, g, b, a] in [0, 1] range */
|
|
489
|
+
sc?: Color;
|
|
490
|
+
/** Stroke width */
|
|
491
|
+
sw?: number;
|
|
492
|
+
/** Text content (newlines encoded with carriage return) */
|
|
493
|
+
t?: string;
|
|
494
|
+
/** Tracking (letter spacing) */
|
|
495
|
+
tr?: number;
|
|
499
496
|
}
|
|
500
497
|
/**
|
|
501
498
|
* Text slot value - always static (text documents don't support animation)
|
|
@@ -510,62 +507,62 @@ type SlotType = 'color' | 'gradient' | 'image' | 'text' | 'scalar' | 'vector';
|
|
|
510
507
|
* Base properties shared by all theme keyframes.
|
|
511
508
|
*/
|
|
512
509
|
interface ThemeBaseKeyframe {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
510
|
+
/** Timeline position in animation frames */
|
|
511
|
+
frame: number;
|
|
512
|
+
/** When true, holds value without interpolation until next keyframe */
|
|
513
|
+
hold?: boolean;
|
|
514
|
+
/** Incoming Bézier handle for easing into this keyframe */
|
|
515
|
+
inTangent?: BezierHandle;
|
|
516
|
+
/** Outgoing Bézier handle for easing out of this keyframe */
|
|
517
|
+
outTangent?: BezierHandle;
|
|
521
518
|
}
|
|
522
519
|
/**
|
|
523
520
|
* Color keyframe for animated color transitions.
|
|
524
521
|
*/
|
|
525
522
|
interface ThemeColorKeyframe extends ThemeBaseKeyframe {
|
|
526
|
-
|
|
527
|
-
|
|
523
|
+
/** Color value as normalized RGB or RGBA (0-1 range) */
|
|
524
|
+
value: Color;
|
|
528
525
|
}
|
|
529
526
|
/**
|
|
530
527
|
* Scalar keyframe for animated numeric properties.
|
|
531
528
|
*/
|
|
532
529
|
interface ThemeScalarKeyframe extends ThemeBaseKeyframe {
|
|
533
|
-
|
|
534
|
-
|
|
530
|
+
/** Numeric value at this keyframe */
|
|
531
|
+
value: number;
|
|
535
532
|
}
|
|
536
533
|
/**
|
|
537
534
|
* Position keyframe for animated position properties.
|
|
538
535
|
*/
|
|
539
536
|
interface ThemePositionKeyframe extends ThemeBaseKeyframe {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
537
|
+
/** Position as 2D or 3D coordinates */
|
|
538
|
+
value: Vector;
|
|
539
|
+
/** Incoming tangent for spatial interpolation (curved paths) */
|
|
540
|
+
valueInTangent?: number[];
|
|
541
|
+
/** Outgoing tangent for spatial interpolation (curved paths) */
|
|
542
|
+
valueOutTangent?: number[];
|
|
546
543
|
}
|
|
547
544
|
/**
|
|
548
545
|
* Vector keyframe for animated vector properties (scale, size, etc.).
|
|
549
546
|
*/
|
|
550
547
|
interface ThemeVectorKeyframe extends ThemeBaseKeyframe {
|
|
551
|
-
|
|
552
|
-
|
|
548
|
+
/** Vector value as [x, y] or [x, y, z] */
|
|
549
|
+
value: Vector;
|
|
553
550
|
}
|
|
554
551
|
/**
|
|
555
552
|
* Gradient color stop definition.
|
|
556
553
|
*/
|
|
557
554
|
interface ThemeGradientStop {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
555
|
+
/** Color as RGB or RGBA (0-1 range) */
|
|
556
|
+
color: Color;
|
|
557
|
+
/** Position along gradient line (0-1) */
|
|
558
|
+
offset: number;
|
|
562
559
|
}
|
|
563
560
|
/**
|
|
564
561
|
* Gradient keyframe for animated gradient transitions.
|
|
565
562
|
*/
|
|
566
563
|
interface ThemeGradientKeyframe extends ThemeBaseKeyframe {
|
|
567
|
-
|
|
568
|
-
|
|
564
|
+
/** Array of gradient stops at this keyframe */
|
|
565
|
+
value: ThemeGradientStop[];
|
|
569
566
|
}
|
|
570
567
|
/**
|
|
571
568
|
* Text justification options.
|
|
@@ -581,135 +578,135 @@ type ThemeTextCaps = 'Regular' | 'AllCaps' | 'SmallCaps';
|
|
|
581
578
|
* @see https://dotlottie.io/spec/2.0/#text-document
|
|
582
579
|
*/
|
|
583
580
|
interface ThemeTextDocument {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
581
|
+
/** Vertical baseline offset in pixels */
|
|
582
|
+
baselineShift?: number;
|
|
583
|
+
/** Fill color as RGB or RGBA (0-1 range) */
|
|
584
|
+
fillColor?: Color;
|
|
585
|
+
/** Font family name */
|
|
586
|
+
fontName?: string;
|
|
587
|
+
/** Font size in points */
|
|
588
|
+
fontSize?: number;
|
|
589
|
+
/** Text alignment and justification */
|
|
590
|
+
justify?: ThemeTextJustify;
|
|
591
|
+
/** Line height spacing multiplier */
|
|
592
|
+
lineHeight?: number;
|
|
593
|
+
/** Stroke color as RGB or RGBA (0-1 range) */
|
|
594
|
+
strokeColor?: Color;
|
|
595
|
+
/** When true, stroke renders over fill */
|
|
596
|
+
strokeOverFill?: boolean;
|
|
597
|
+
/** Stroke width in pixels */
|
|
598
|
+
strokeWidth?: number;
|
|
599
|
+
/** Text content to display */
|
|
600
|
+
text?: string;
|
|
601
|
+
/** Text capitalization style */
|
|
602
|
+
textCaps?: ThemeTextCaps;
|
|
603
|
+
/** Letter spacing in 1/1000 em units */
|
|
604
|
+
tracking?: number;
|
|
605
|
+
/** Text wrap box position [x, y] */
|
|
606
|
+
wrapPosition?: [number, number];
|
|
607
|
+
/** Text wrap bounding box [width, height] */
|
|
608
|
+
wrapSize?: [number, number];
|
|
612
609
|
}
|
|
613
610
|
/**
|
|
614
611
|
* Text keyframe for animated text document properties.
|
|
615
612
|
*/
|
|
616
613
|
interface ThemeTextKeyframe {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
614
|
+
/** Timeline position in animation frames */
|
|
615
|
+
frame: number;
|
|
616
|
+
/** Text document configuration at this keyframe */
|
|
617
|
+
value: ThemeTextDocument;
|
|
621
618
|
}
|
|
622
619
|
/**
|
|
623
620
|
* Image value for theme image rules.
|
|
624
621
|
*/
|
|
625
622
|
interface ThemeImageValue {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
623
|
+
/** Display height in pixels */
|
|
624
|
+
height?: number;
|
|
625
|
+
/** Reference to image in dotLottie package (i/ folder) */
|
|
626
|
+
id?: string;
|
|
627
|
+
/** External URL or data URI (fallback if id not found) */
|
|
628
|
+
url?: string;
|
|
629
|
+
/** Display width in pixels */
|
|
630
|
+
width?: number;
|
|
634
631
|
}
|
|
635
632
|
/**
|
|
636
633
|
* Base properties shared by all theme rules.
|
|
637
634
|
*/
|
|
638
635
|
interface ThemeBaseRule {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
636
|
+
/** Limit rule to specific animations (omit to apply to all) */
|
|
637
|
+
animations?: string[];
|
|
638
|
+
/** Lottie expression for dynamic values */
|
|
639
|
+
expression?: string;
|
|
640
|
+
/** Slot ID in the Lottie animation (case-sensitive) */
|
|
641
|
+
id: string;
|
|
645
642
|
}
|
|
646
643
|
/**
|
|
647
644
|
* Color rule for overriding color properties (fill, stroke, text color).
|
|
648
645
|
*/
|
|
649
646
|
interface ThemeColorRule extends ThemeBaseRule {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
647
|
+
/** Animated color keyframes */
|
|
648
|
+
keyframes?: ThemeColorKeyframe[];
|
|
649
|
+
type: 'Color';
|
|
650
|
+
/** Static color value (RGB or RGBA, 0-1 range) */
|
|
651
|
+
value?: Color;
|
|
655
652
|
}
|
|
656
653
|
/**
|
|
657
654
|
* Scalar rule for overriding numeric properties (opacity, stroke width, rotation).
|
|
658
655
|
*/
|
|
659
656
|
interface ThemeScalarRule extends ThemeBaseRule {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
657
|
+
/** Animated scalar keyframes */
|
|
658
|
+
keyframes?: ThemeScalarKeyframe[];
|
|
659
|
+
type: 'Scalar';
|
|
660
|
+
/** Static numeric value */
|
|
661
|
+
value?: number;
|
|
665
662
|
}
|
|
666
663
|
/**
|
|
667
664
|
* Position rule for overriding position properties.
|
|
668
665
|
*/
|
|
669
666
|
interface ThemePositionRule extends ThemeBaseRule {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
667
|
+
/** Animated position keyframes */
|
|
668
|
+
keyframes?: ThemePositionKeyframe[];
|
|
669
|
+
type: 'Position';
|
|
670
|
+
/** Static position (2D or 3D coordinates) */
|
|
671
|
+
value?: Vector;
|
|
675
672
|
}
|
|
676
673
|
/**
|
|
677
674
|
* Vector rule for overriding vector properties (scale, size).
|
|
678
675
|
*/
|
|
679
676
|
interface ThemeVectorRule extends ThemeBaseRule {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
677
|
+
/** Animated vector keyframes */
|
|
678
|
+
keyframes?: ThemeVectorKeyframe[];
|
|
679
|
+
type: 'Vector';
|
|
680
|
+
/** Static vector value */
|
|
681
|
+
value?: Vector;
|
|
685
682
|
}
|
|
686
683
|
/**
|
|
687
684
|
* Gradient rule for overriding gradient properties.
|
|
688
685
|
*/
|
|
689
686
|
interface ThemeGradientRule extends ThemeBaseRule {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
687
|
+
/** Animated gradient keyframes */
|
|
688
|
+
keyframes?: ThemeGradientKeyframe[];
|
|
689
|
+
type: 'Gradient';
|
|
690
|
+
/** Static gradient (array of color stops) */
|
|
691
|
+
value?: ThemeGradientStop[];
|
|
695
692
|
}
|
|
696
693
|
/**
|
|
697
694
|
* Image rule for overriding image assets.
|
|
698
695
|
*/
|
|
699
696
|
interface ThemeImageRule extends ThemeBaseRule {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
697
|
+
type: 'Image';
|
|
698
|
+
/** Image replacement configuration (required for Image rules) */
|
|
699
|
+
value: ThemeImageValue;
|
|
703
700
|
}
|
|
704
701
|
/**
|
|
705
702
|
* Text rule for overriding text document properties.
|
|
706
703
|
*/
|
|
707
704
|
interface ThemeTextRule extends ThemeBaseRule {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
705
|
+
/** Animated text keyframes */
|
|
706
|
+
keyframes?: ThemeTextKeyframe[];
|
|
707
|
+
type: 'Text';
|
|
708
|
+
/** Static text document configuration */
|
|
709
|
+
value?: ThemeTextDocument;
|
|
713
710
|
}
|
|
714
711
|
/**
|
|
715
712
|
* Union of all theme rule types.
|
|
@@ -745,783 +742,785 @@ type ThemeRule = ThemeColorRule | ThemeScalarRule | ThemePositionRule | ThemeVec
|
|
|
745
742
|
* ```
|
|
746
743
|
*/
|
|
747
744
|
interface Theme {
|
|
748
|
-
|
|
749
|
-
|
|
745
|
+
/** Array of rules defining property overrides */
|
|
746
|
+
rules: ThemeRule[];
|
|
750
747
|
}
|
|
751
|
-
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/dotlottie.d.ts
|
|
752
750
|
declare class DotLottie {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
751
|
+
private _canvas;
|
|
752
|
+
private _pendingLoad;
|
|
753
|
+
private _context;
|
|
754
|
+
private readonly _eventManager;
|
|
755
|
+
private _animationFrameId;
|
|
756
|
+
private readonly _frameManager;
|
|
757
|
+
private _dotLottieCore;
|
|
758
|
+
private _stateMachineId;
|
|
759
|
+
private _stateMachineConfig;
|
|
760
|
+
private _isStateMachineRunning;
|
|
761
|
+
private _stateMachineObserverHandle;
|
|
762
|
+
private _stateMachineInternalMessageObserver;
|
|
763
|
+
private _dotLottieObserverHandle;
|
|
764
|
+
private static _wasmModule;
|
|
765
|
+
private _renderConfig;
|
|
766
|
+
private _isFrozen;
|
|
767
|
+
private _backgroundColor;
|
|
768
|
+
private _boundOnClick;
|
|
769
|
+
private _boundOnPointerUp;
|
|
770
|
+
private _boundOnPointerDown;
|
|
771
|
+
private _boundOnPointerMove;
|
|
772
|
+
private _boundOnPointerEnter;
|
|
773
|
+
private _boundOnPointerLeave;
|
|
774
|
+
private _bufferMismatchCount;
|
|
775
|
+
private _lastExpectedBufferSize;
|
|
776
|
+
/**
|
|
777
|
+
* Creates a new DotLottie player instance for rendering Lottie animations.
|
|
778
|
+
* Initializes the WASM module, event system, and loads animation if src or data is provided in config.
|
|
779
|
+
* @param config - Configuration object specifying animation source, playback settings, and rendering options
|
|
780
|
+
*/
|
|
781
|
+
constructor(config: Config);
|
|
782
|
+
private _dispatchError;
|
|
783
|
+
private _fetchData;
|
|
784
|
+
private _loadFromData;
|
|
785
|
+
private _loadFromSrc;
|
|
786
|
+
/**
|
|
787
|
+
* Gets the raw pixel buffer containing the rendered animation frame.
|
|
788
|
+
* Returns RGBA pixel data as a Uint8Array for advanced image processing or custom rendering.
|
|
789
|
+
*/
|
|
790
|
+
get buffer(): Uint8Array | null;
|
|
791
|
+
/**
|
|
792
|
+
* Gets the ID of the currently active animation from a multi-animation dotLottie file.
|
|
793
|
+
* Returns undefined if no specific animation is active or for single-animation files.
|
|
794
|
+
*/
|
|
795
|
+
get activeAnimationId(): string | undefined;
|
|
796
|
+
/**
|
|
797
|
+
* Gets the ID of the currently active theme applied to the animation.
|
|
798
|
+
* Returns undefined if no theme is active. Themes modify colors and visual properties.
|
|
799
|
+
*/
|
|
800
|
+
get activeThemeId(): string | undefined;
|
|
801
|
+
/**
|
|
802
|
+
* Gets the current layout configuration for positioning and scaling the animation.
|
|
803
|
+
* Includes fit mode (contain, cover, fill, etc.) and alignment [x, y] values (0-1 range).
|
|
804
|
+
*/
|
|
805
|
+
get layout(): Layout | undefined;
|
|
806
|
+
/**
|
|
807
|
+
* Gets the currently active marker name if a marker-based segment is set.
|
|
808
|
+
* Returns undefined if no marker is active. Use setMarker() to activate a named segment.
|
|
809
|
+
*/
|
|
810
|
+
get marker(): string | undefined;
|
|
811
|
+
/**
|
|
812
|
+
* Gets the animation manifest containing metadata about animations, themes, and states.
|
|
813
|
+
* Returns null if no manifest is available or if the loaded animation doesn't include one.
|
|
814
|
+
*/
|
|
815
|
+
get manifest(): Manifest | null;
|
|
816
|
+
/**
|
|
817
|
+
* Gets the current rendering configuration.
|
|
818
|
+
* Includes settings like devicePixelRatio, autoResize, and freezeOnOffscreen.
|
|
819
|
+
*/
|
|
820
|
+
get renderConfig(): RenderConfig;
|
|
821
|
+
/**
|
|
822
|
+
* Gets the currently active playback segment as [startFrame, endFrame].
|
|
823
|
+
* If no segment is set, returns undefined and the full animation plays.
|
|
824
|
+
*/
|
|
825
|
+
get segment(): [number, number] | undefined;
|
|
826
|
+
/**
|
|
827
|
+
* Gets the current loop configuration.
|
|
828
|
+
* Returns true if the animation is set to loop continuously.
|
|
829
|
+
*/
|
|
830
|
+
get loop(): boolean;
|
|
831
|
+
/**
|
|
832
|
+
* Gets the current playback mode.
|
|
833
|
+
* Determines playback direction: 'forward', 'reverse', 'bounce' (forward then reverse), or 'reverse-bounce'.
|
|
834
|
+
*/
|
|
835
|
+
get mode(): Mode;
|
|
836
|
+
/**
|
|
837
|
+
* Indicates whether rendering is currently frozen.
|
|
838
|
+
* True when freeze() has been called and the rendering loop is paused to save resources.
|
|
839
|
+
*/
|
|
840
|
+
get isFrozen(): boolean;
|
|
841
|
+
/**
|
|
842
|
+
* Indicates whether a state machine is currently active and running.
|
|
843
|
+
* True after stateMachineStart() is called and until stateMachineStop() is called.
|
|
844
|
+
*/
|
|
845
|
+
get isStateMachineRunning(): boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Gets the current background color.
|
|
848
|
+
* Returns the background color as a string (e.g., '#FFFFFF' or 'transparent').
|
|
849
|
+
*/
|
|
850
|
+
get backgroundColor(): string;
|
|
851
|
+
/**
|
|
852
|
+
* Gets the autoplay configuration.
|
|
853
|
+
* Returns true if the animation is configured to start playing automatically when loaded.
|
|
854
|
+
*/
|
|
855
|
+
get autoplay(): boolean;
|
|
856
|
+
/**
|
|
857
|
+
* Gets the frame interpolation setting.
|
|
858
|
+
* Returns true if frame interpolation is enabled for smoother animation playback.
|
|
859
|
+
*/
|
|
860
|
+
get useFrameInterpolation(): boolean;
|
|
861
|
+
/**
|
|
862
|
+
* Gets the current playback speed.
|
|
863
|
+
* Returns the speed multiplier (1 = normal speed, 2 = double speed, 0.5 = half speed).
|
|
864
|
+
*/
|
|
865
|
+
get speed(): number;
|
|
866
|
+
/**
|
|
867
|
+
* Indicates whether the WASM module and core player have been initialized.
|
|
868
|
+
* Check this before performing operations that require the player to be ready.
|
|
869
|
+
*/
|
|
870
|
+
get isReady(): boolean;
|
|
871
|
+
/**
|
|
872
|
+
* Indicates whether an animation has been successfully loaded and is ready for playback.
|
|
873
|
+
* Check this before calling play() or other playback methods to ensure the animation is ready.
|
|
874
|
+
*/
|
|
875
|
+
get isLoaded(): boolean;
|
|
876
|
+
/**
|
|
877
|
+
* Indicates whether the animation is currently playing.
|
|
878
|
+
* True when animation is actively playing, false when paused, stopped, or not started.
|
|
879
|
+
*/
|
|
880
|
+
get isPlaying(): boolean;
|
|
881
|
+
/**
|
|
882
|
+
* Indicates whether the animation is currently paused.
|
|
883
|
+
* True when pause() has been called and animation is not playing or stopped.
|
|
884
|
+
*/
|
|
885
|
+
get isPaused(): boolean;
|
|
886
|
+
/**
|
|
887
|
+
* Indicates whether the animation is currently stopped.
|
|
888
|
+
* True when stop() has been called or animation hasn't started yet.
|
|
889
|
+
*/
|
|
890
|
+
get isStopped(): boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Gets the current frame number of the animation.
|
|
893
|
+
* Useful for tracking playback position or implementing custom frame displays. Rounded to 2 decimal places.
|
|
894
|
+
*/
|
|
895
|
+
get currentFrame(): number;
|
|
896
|
+
/**
|
|
897
|
+
* Gets the number of times the animation has completed a loop during the current playback.
|
|
898
|
+
* Increments each time the animation completes one full cycle.
|
|
899
|
+
*/
|
|
900
|
+
get loopCount(): number;
|
|
901
|
+
/**
|
|
902
|
+
* Gets the total number of frames in the animation.
|
|
903
|
+
* Use with currentFrame to calculate playback progress as a percentage.
|
|
904
|
+
*/
|
|
905
|
+
get totalFrames(): number;
|
|
906
|
+
/**
|
|
907
|
+
* Gets the total duration of the animation in seconds.
|
|
908
|
+
* Represents the time to play from the first frame to the last at normal speed (speed = 1).
|
|
909
|
+
*/
|
|
910
|
+
get duration(): number;
|
|
911
|
+
/**
|
|
912
|
+
* Gets the duration of the currently active segment in seconds.
|
|
913
|
+
* If no segment is set, returns the full animation duration.
|
|
914
|
+
*/
|
|
915
|
+
get segmentDuration(): number;
|
|
916
|
+
/**
|
|
917
|
+
* Gets the canvas element used for rendering the animation.
|
|
918
|
+
* Returns the HTMLCanvasElement, OffscreenCanvas, or RenderSurface set during initialization.
|
|
919
|
+
*/
|
|
920
|
+
get canvas(): HTMLCanvasElement | OffscreenCanvas | RenderSurface | null;
|
|
921
|
+
/**
|
|
922
|
+
* Dynamically loads a new animation, replacing the current one if any.
|
|
923
|
+
* Stops current playback, cleans up resources, and loads from the provided src or data.
|
|
924
|
+
* @param config - Configuration for the new animation (all Config properties except canvas)
|
|
925
|
+
*/
|
|
926
|
+
load(config: Omit<Config, 'canvas'>): void;
|
|
927
|
+
private _draw;
|
|
928
|
+
private _cleanupCanvas;
|
|
929
|
+
private _initializeCanvas;
|
|
930
|
+
private _stopAnimationLoop;
|
|
931
|
+
private _startAnimationLoop;
|
|
932
|
+
private _animationLoop;
|
|
933
|
+
/**
|
|
934
|
+
* Starts or resumes animation playback from the current frame.
|
|
935
|
+
* Unfreezes rendering if frozen and starts the animation loop. Updates isPlaying state to true.
|
|
936
|
+
*/
|
|
937
|
+
play(): void;
|
|
938
|
+
/**
|
|
939
|
+
* Pauses animation playback at the current frame.
|
|
940
|
+
* Stops the animation loop while preserving the current frame position. Updates isPaused state to true.
|
|
941
|
+
*/
|
|
942
|
+
pause(): void;
|
|
943
|
+
/**
|
|
944
|
+
* Stops animation playback and resets to the start frame.
|
|
945
|
+
* Halts the animation loop and returns to the beginning. Updates isStopped state to true.
|
|
946
|
+
*/
|
|
947
|
+
stop(): void;
|
|
948
|
+
/**
|
|
949
|
+
* Seeks to a specific frame in the animation and renders it.
|
|
950
|
+
* Useful for implementing custom scrubbing controls or precise frame positioning.
|
|
951
|
+
* @param frame - The target frame number to seek to
|
|
952
|
+
*/
|
|
953
|
+
setFrame(frame: number): void;
|
|
954
|
+
/**
|
|
955
|
+
* Changes the animation playback speed.
|
|
956
|
+
* Values above 1 speed up playback, below 1 slow it down.
|
|
957
|
+
* @param speed - Playback speed multiplier (e.g., 2 for 2x speed, 0.5 for half speed)
|
|
958
|
+
*/
|
|
959
|
+
setSpeed(speed: number): void;
|
|
960
|
+
/**
|
|
961
|
+
* Changes the background color of the canvas or animation.
|
|
962
|
+
* For HTMLCanvasElement, sets the CSS background. For other surfaces, renders behind the animation.
|
|
963
|
+
* @param color - CSS color string (e.g., '#FFFFFF', 'rgba(0,0,0,0.5)', 'transparent')
|
|
964
|
+
*/
|
|
965
|
+
setBackgroundColor(color: string): void;
|
|
966
|
+
/**
|
|
967
|
+
* Enables or disables continuous looping of the animation.
|
|
968
|
+
* When enabled with loopCount set to 0, animation repeats indefinitely.
|
|
969
|
+
* @param loop - True to enable looping, false to play once
|
|
970
|
+
*/
|
|
971
|
+
setLoop(loop: boolean): void;
|
|
972
|
+
/**
|
|
973
|
+
* Sets the number of additional times to replay the animation after the first play.
|
|
974
|
+
* Requires loop to be true. A value of 0 means infinite replays; a positive value n means
|
|
975
|
+
* the animation plays a total of n + 1 times (initial play + n replays).
|
|
976
|
+
* @param loopCount - Number of additional replays (0 = infinite, 1 = plays twice, 2 = plays three times, etc.)
|
|
977
|
+
*/
|
|
978
|
+
setLoopCount(loopCount: number): void;
|
|
979
|
+
/**
|
|
980
|
+
* Enables or disables frame interpolation for smoother playback.
|
|
981
|
+
* When enabled, interpolates between frames. When disabled, shows exact frame-by-frame animation.
|
|
982
|
+
* @param useFrameInterpolation - True for smooth interpolation, false for exact frames
|
|
983
|
+
*/
|
|
984
|
+
setUseFrameInterpolation(useFrameInterpolation: boolean): void;
|
|
985
|
+
/**
|
|
986
|
+
* Subscribes to animation events like play, pause, frame, complete, etc.
|
|
987
|
+
* Use this to react to animation state changes and playback progress.
|
|
988
|
+
* @param type - Event type to listen for (e.g., 'play', 'frame', 'complete')
|
|
989
|
+
* @param listener - Callback function invoked when the event occurs
|
|
990
|
+
*/
|
|
991
|
+
addEventListener<T extends EventType>(type: T, listener: EventListener<T>): void;
|
|
992
|
+
/**
|
|
993
|
+
* Unsubscribes from animation events.
|
|
994
|
+
* If no listener is provided, removes all listeners for the given event type.
|
|
995
|
+
* @param type - Event type to stop listening for
|
|
996
|
+
* @param listener - Specific callback to remove, or undefined to remove all
|
|
997
|
+
*/
|
|
998
|
+
removeEventListener<T extends EventType>(type: T, listener?: EventListener<T>): void;
|
|
999
|
+
/**
|
|
1000
|
+
* Cleans up and destroys the player instance, releasing all resources.
|
|
1001
|
+
* Stops playback, removes event listeners, and frees WASM memory. Call when the player is no longer needed.
|
|
1002
|
+
*/
|
|
1003
|
+
destroy(): void;
|
|
1004
|
+
/**
|
|
1005
|
+
* Pauses the rendering loop without changing playback state.
|
|
1006
|
+
* Useful for reducing CPU/GPU usage when the animation is offscreen or hidden. Dispatches 'freeze' event.
|
|
1007
|
+
*/
|
|
1008
|
+
freeze(): void;
|
|
1009
|
+
/**
|
|
1010
|
+
* Resumes the rendering loop after being frozen.
|
|
1011
|
+
* Restarts frame rendering while maintaining the current playback state. Dispatches 'unfreeze' event.
|
|
1012
|
+
*/
|
|
1013
|
+
unfreeze(): void;
|
|
1014
|
+
/**
|
|
1015
|
+
* Recalculates and updates canvas dimensions based on current size.
|
|
1016
|
+
* Call this when the canvas container size changes to maintain proper rendering. Usually handled by autoResize.
|
|
1017
|
+
*/
|
|
1018
|
+
resize(): void;
|
|
1019
|
+
/**
|
|
1020
|
+
* Changes the canvas element used for rendering.
|
|
1021
|
+
* Useful for moving the animation to a different canvas without recreating the player instance.
|
|
1022
|
+
* @param canvas - New HTMLCanvasElement, OffscreenCanvas, or RenderSurface to render to
|
|
1023
|
+
*/
|
|
1024
|
+
setCanvas(canvas: HTMLCanvasElement | OffscreenCanvas | RenderSurface): void;
|
|
1025
|
+
/**
|
|
1026
|
+
* Applies a 3x3 transformation matrix to the entire animation on the canvas.
|
|
1027
|
+
* Use this to translate, rotate, scale, or skew the animation rendering.
|
|
1028
|
+
* @param transform - 9-element array representing the transformation matrix in row-major order
|
|
1029
|
+
* @returns True if transformation was applied successfully, false otherwise
|
|
1030
|
+
*/
|
|
1031
|
+
setTransform(transform: Transform): boolean;
|
|
1032
|
+
/**
|
|
1033
|
+
* Gets the 3x3 transformation matrix applied to the animation.
|
|
1034
|
+
* Returns a 9-element array representing affine transformations (translation, rotation, scale, skew).
|
|
1035
|
+
* @returns Transform array of 9 numbers, or undefined if not available
|
|
1036
|
+
*/
|
|
1037
|
+
getTransform(): Transform | undefined;
|
|
1038
|
+
/**
|
|
1039
|
+
* Sets a frame range to play instead of the full animation.
|
|
1040
|
+
* Useful for playing specific sections or creating animation sequences from subsections.
|
|
1041
|
+
* @param startFrame - Starting frame number (inclusive)
|
|
1042
|
+
* @param endFrame - Ending frame number (inclusive)
|
|
1043
|
+
*/
|
|
1044
|
+
setSegment(startFrame: number, endFrame: number): void;
|
|
1045
|
+
/**
|
|
1046
|
+
* Changes the playback direction mode.
|
|
1047
|
+
* Controls whether animation plays forward, in reverse, or alternates (bounce).
|
|
1048
|
+
* @param mode - Playback mode: 'forward', 'reverse', 'bounce', or 'reverse-bounce'
|
|
1049
|
+
*/
|
|
1050
|
+
setMode(mode: Mode): void;
|
|
1051
|
+
/**
|
|
1052
|
+
* Updates rendering configuration like autoResize, devicePixelRatio, and freezeOnOffscreen.
|
|
1053
|
+
* Dynamically changes how the canvas behaves without reloading the animation.
|
|
1054
|
+
* @param config - Partial RenderConfig with properties to update
|
|
1055
|
+
*/
|
|
1056
|
+
setRenderConfig(config: RenderConfig): void;
|
|
1057
|
+
/**
|
|
1058
|
+
* Switches to a different animation within a multi-animation dotLottie file.
|
|
1059
|
+
* Use this to load a different animation by its ID without creating a new player instance.
|
|
1060
|
+
* @param animationId - ID of the animation to load (must exist in the manifest)
|
|
1061
|
+
*/
|
|
1062
|
+
loadAnimation(animationId: string): void;
|
|
1063
|
+
/**
|
|
1064
|
+
* Activates a named marker to play only that marked segment.
|
|
1065
|
+
* Markers define named sections within an animation. Use markers() to list available markers.
|
|
1066
|
+
* @param marker - Name of the marker to activate
|
|
1067
|
+
*/
|
|
1068
|
+
setMarker(marker: string): void;
|
|
1069
|
+
/**
|
|
1070
|
+
* Gets all markers defined in the animation with their time and duration.
|
|
1071
|
+
* Markers represent named sections that can be played using setMarker().
|
|
1072
|
+
* @returns Array of marker objects with name, time, and duration properties
|
|
1073
|
+
*/
|
|
1074
|
+
markers(): Marker[];
|
|
1075
|
+
/**
|
|
1076
|
+
* Applies a theme to the animation, modifying colors and visual properties.
|
|
1077
|
+
* Themes are predefined in the dotLottie manifest. Returns true if theme was successfully loaded.
|
|
1078
|
+
* @param themeId - ID of the theme to apply (must exist in manifest)
|
|
1079
|
+
* @returns True if theme loaded successfully, false otherwise
|
|
1080
|
+
*/
|
|
1081
|
+
setTheme(themeId: string): boolean;
|
|
1082
|
+
/**
|
|
1083
|
+
* Removes the currently applied theme and restores original animation colors.
|
|
1084
|
+
* Use this to revert to the default appearance after applying a theme.
|
|
1085
|
+
* @returns True if theme was reset successfully, false otherwise
|
|
1086
|
+
*/
|
|
1087
|
+
resetTheme(): boolean;
|
|
1088
|
+
/**
|
|
1089
|
+
* Applies a custom theme from theme data instead of manifest theme ID.
|
|
1090
|
+
* Useful for dynamically generated or user-created themes not in the manifest.
|
|
1091
|
+
*
|
|
1092
|
+
* @param themeData - Theme data as a JSON string or a structured Theme object
|
|
1093
|
+
* @returns True if theme loaded successfully, false otherwise
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* ```typescript
|
|
1097
|
+
* // Using a string (existing behavior)
|
|
1098
|
+
* dotLottie.setThemeData('{"rules":[{"id":"bg","type":"Color","value":[1,0,0]}]}');
|
|
1099
|
+
*
|
|
1100
|
+
* // Using a Theme object (new behavior)
|
|
1101
|
+
* dotLottie.setThemeData({
|
|
1102
|
+
* rules: [
|
|
1103
|
+
* {
|
|
1104
|
+
* id: 'background_color',
|
|
1105
|
+
* type: 'Color',
|
|
1106
|
+
* value: [0.2, 0.4, 0.8]
|
|
1107
|
+
* },
|
|
1108
|
+
* {
|
|
1109
|
+
* id: 'title',
|
|
1110
|
+
* type: 'Text',
|
|
1111
|
+
* value: {
|
|
1112
|
+
* text: 'Hello World',
|
|
1113
|
+
* fontSize: 48,
|
|
1114
|
+
* fillColor: [1, 1, 1]
|
|
1115
|
+
* }
|
|
1116
|
+
* }
|
|
1117
|
+
* ]
|
|
1118
|
+
* });
|
|
1119
|
+
* ```
|
|
1120
|
+
*/
|
|
1121
|
+
setThemeData(themeData: Theme | string): boolean;
|
|
1122
|
+
/**
|
|
1123
|
+
* Sets multiple slot values at once for parameterized animations.
|
|
1124
|
+
* Slots allow runtime customization of colors, text, images, or other properties.
|
|
1125
|
+
* @param slots - Object mapping slot IDs to their values
|
|
1126
|
+
*/
|
|
1127
|
+
setSlots(slots: Record<string, unknown>): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Check if value is an array of keyframes (has objects with 't' and 's' properties)
|
|
1130
|
+
*/
|
|
1131
|
+
private _isKeyframeArray;
|
|
1132
|
+
/**
|
|
1133
|
+
* Get all slot IDs in the animation
|
|
1134
|
+
* @returns Array of slot ID strings
|
|
1135
|
+
*/
|
|
1136
|
+
getSlotIds(): string[];
|
|
1137
|
+
/**
|
|
1138
|
+
* Get the type of a slot
|
|
1139
|
+
* @param slotId - The slot ID to query
|
|
1140
|
+
* @returns The slot type ('color', 'gradient', 'text', 'scalar', 'vector', 'position', 'image') or undefined
|
|
1141
|
+
*/
|
|
1142
|
+
getSlotType(slotId: string): SlotType | undefined;
|
|
1143
|
+
/**
|
|
1144
|
+
* Get the current value of a slot
|
|
1145
|
+
* @param slotId - The slot ID to query
|
|
1146
|
+
* @returns The parsed slot value or undefined if not found
|
|
1147
|
+
*/
|
|
1148
|
+
getSlot(slotId: string): unknown;
|
|
1149
|
+
/**
|
|
1150
|
+
* Get all slots as an object with slot IDs as keys
|
|
1151
|
+
* @returns Object containing all slots, or empty object if not loaded
|
|
1152
|
+
* @example
|
|
1153
|
+
* const slots = dotLottie.getSlots();
|
|
1154
|
+
*/
|
|
1155
|
+
getSlots(): Record<string, unknown>;
|
|
1156
|
+
/**
|
|
1157
|
+
* Set a color slot value
|
|
1158
|
+
* @param slotId - The slot ID to set
|
|
1159
|
+
* @param value - Static color [r, g, b, a] or array of keyframes
|
|
1160
|
+
* @returns true if successful
|
|
1161
|
+
* @example
|
|
1162
|
+
* // Static red color
|
|
1163
|
+
* dotLottie.setColorSlot('myColor', [1, 0, 0, 1]);
|
|
1164
|
+
* // Animated color (red to blue)
|
|
1165
|
+
* dotLottie.setColorSlot('myColor', [\{ t: 0, s: [1, 0, 0, 1] \}, \{ t: 60, s: [0, 0, 1, 1] \}]);
|
|
1166
|
+
*/
|
|
1167
|
+
setColorSlot(slotId: string, value: ColorSlotValue): boolean;
|
|
1168
|
+
/**
|
|
1169
|
+
* Set a scalar slot value (single number like rotation, opacity)
|
|
1170
|
+
* @param slotId - The slot ID to set
|
|
1171
|
+
* @param value - Static number or array of keyframes
|
|
1172
|
+
* @returns true if successful
|
|
1173
|
+
* @example
|
|
1174
|
+
* // Static rotation
|
|
1175
|
+
* dotLottie.setScalarSlot('rotation', 45);
|
|
1176
|
+
* // Animated rotation
|
|
1177
|
+
* dotLottie.setScalarSlot('rotation', [\{ t: 0, s: 0 \}, \{ t: 60, s: 360 \}]);
|
|
1178
|
+
*/
|
|
1179
|
+
setScalarSlot(slotId: string, value: ScalarSlotValue): boolean;
|
|
1180
|
+
/**
|
|
1181
|
+
* Set a vector slot value (2D or 3D point for position, scale, etc.)
|
|
1182
|
+
* Handles both "vector" and "position" slot types
|
|
1183
|
+
* @param slotId - The slot ID to set
|
|
1184
|
+
* @param value - Static vector [x, y] or array of keyframes
|
|
1185
|
+
* @returns true if successful
|
|
1186
|
+
* @example
|
|
1187
|
+
* // Static scale
|
|
1188
|
+
* dotLottie.setVectorSlot('scale', [150, 150]);
|
|
1189
|
+
* // Animated position
|
|
1190
|
+
* dotLottie.setVectorSlot('position', [\{ t: 0, s: [0, 0] \}, \{ t: 60, s: [100, 200] \}]);
|
|
1191
|
+
*/
|
|
1192
|
+
setVectorSlot(slotId: string, value: VectorSlotValue): boolean;
|
|
1193
|
+
/**
|
|
1194
|
+
* Set a gradient slot value
|
|
1195
|
+
* @param slotId - The slot ID to set
|
|
1196
|
+
* @param value - Static gradient [offset, r, g, b, ...] or array of keyframes
|
|
1197
|
+
* @returns true if successful
|
|
1198
|
+
* @example
|
|
1199
|
+
* // Static red to blue gradient
|
|
1200
|
+
* dotLottie.setGradientSlot('myGradient', [0, 1, 0, 0, 1, 0, 0, 1]);
|
|
1201
|
+
* // Animated gradient
|
|
1202
|
+
* dotLottie.setGradientSlot('myGradient', [\{ t: 0, s: [0, 1, 0, 0, 1, 0, 0, 1] \}]);
|
|
1203
|
+
*/
|
|
1204
|
+
setGradientSlot(slotId: string, value: GradientSlotValue): boolean;
|
|
1205
|
+
/**
|
|
1206
|
+
* Set a text slot value (always static - text documents don't support animation)
|
|
1207
|
+
* Supports partial updates - only provided properties will be changed, others inherit from existing value
|
|
1208
|
+
* @param slotId - The slot ID to set
|
|
1209
|
+
* @param value - Text document properties (partial allowed)
|
|
1210
|
+
* @returns true if successful
|
|
1211
|
+
* @example
|
|
1212
|
+
* // Set all properties
|
|
1213
|
+
* dotLottie.setTextSlot('title', \{ t: 'Hello World', s: 24, fc: [0, 0, 0, 1] \});
|
|
1214
|
+
* // Partial update - only change text, keep existing font size, color, etc.
|
|
1215
|
+
* dotLottie.setTextSlot('title', \{ t: 'New Text' \});
|
|
1216
|
+
*/
|
|
1217
|
+
setTextSlot(slotId: string, value: TextSlotValue): boolean;
|
|
1218
|
+
/**
|
|
1219
|
+
* Reset a slot to its original value
|
|
1220
|
+
* @param slotId - The slot ID to reset
|
|
1221
|
+
* @returns true if successful
|
|
1222
|
+
*/
|
|
1223
|
+
resetSlot(slotId: string): boolean;
|
|
1224
|
+
/**
|
|
1225
|
+
* Clear a slot's custom value
|
|
1226
|
+
* @param slotId - The slot ID to clear
|
|
1227
|
+
* @returns true if successful
|
|
1228
|
+
*/
|
|
1229
|
+
clearSlot(slotId: string): boolean;
|
|
1230
|
+
/**
|
|
1231
|
+
* Reset all slots to their original values
|
|
1232
|
+
* @returns true if successful
|
|
1233
|
+
*/
|
|
1234
|
+
resetSlots(): boolean;
|
|
1235
|
+
/**
|
|
1236
|
+
* Clear all slot custom values
|
|
1237
|
+
* @returns true if successful
|
|
1238
|
+
*/
|
|
1239
|
+
clearSlots(): boolean;
|
|
1240
|
+
/**
|
|
1241
|
+
* Updates the layout configuration for positioning and scaling the animation.
|
|
1242
|
+
* Changes how the animation fits and aligns within the canvas without requiring a reload.
|
|
1243
|
+
* @param layout - New layout configuration with fit mode and alignment values
|
|
1244
|
+
*/
|
|
1245
|
+
setLayout(layout: Layout): void;
|
|
1246
|
+
/**
|
|
1247
|
+
* Sets a custom viewport region for rendering a portion of the animation.
|
|
1248
|
+
* Defines a rectangular area to render, useful for implementing animation clipping or panning effects.
|
|
1249
|
+
* @param x - X coordinate of the viewport's top-left corner
|
|
1250
|
+
* @param y - Y coordinate of the viewport's top-left corner
|
|
1251
|
+
* @param width - Width of the viewport in pixels
|
|
1252
|
+
* @param height - Height of the viewport in pixels
|
|
1253
|
+
* @returns True if viewport was set successfully, false otherwise
|
|
1254
|
+
*/
|
|
1255
|
+
setViewport(x: number, y: number, width: number, height: number): boolean;
|
|
1256
|
+
/**
|
|
1257
|
+
* Configures the URL for loading the WASM module.
|
|
1258
|
+
* Call this before creating any player instances to load the WASM from a custom CDN or local path.
|
|
1259
|
+
* @param url - URL pointing to the dotlottie WASM file
|
|
1260
|
+
*/
|
|
1261
|
+
static setWasmUrl(url: string): void;
|
|
1262
|
+
/**
|
|
1263
|
+
* @experimental
|
|
1264
|
+
* Register a custom font for use in animations
|
|
1265
|
+
* @param fontName - The name of the font to register
|
|
1266
|
+
* @param fontSource - Either a URL string to fetch the font, or ArrayBuffer/Uint8Array of font data
|
|
1267
|
+
* @returns Promise<boolean> - true if registration succeeded, false otherwise
|
|
1268
|
+
*/
|
|
1269
|
+
static registerFont(fontName: string, fontSource: string | ArrayBuffer | Uint8Array): Promise<boolean>;
|
|
1270
|
+
/**
|
|
1271
|
+
* @experimental
|
|
1272
|
+
* Animates smoothly to a specific frame over a duration using linear easing.
|
|
1273
|
+
* Creates a tween animation transitioning from the current frame to the target frame.
|
|
1274
|
+
* @param frame - Target frame number to tween to
|
|
1275
|
+
* @param duration - Duration of the tween animation in seconds
|
|
1276
|
+
* @returns True if tween started successfully, false otherwise
|
|
1277
|
+
*/
|
|
1278
|
+
tween(frame: number, duration: number): boolean;
|
|
1279
|
+
/**
|
|
1280
|
+
* @experimental
|
|
1281
|
+
* Start a tween animation to a specific marker
|
|
1282
|
+
* @param marker - The marker name to tween to
|
|
1283
|
+
* @param duration - Duration of the tween animation in seconds
|
|
1284
|
+
* @returns true if tween was started successfully
|
|
1285
|
+
*/
|
|
1286
|
+
tweenToMarker(marker: string, duration: number): boolean;
|
|
1287
|
+
/**
|
|
1288
|
+
* Gets the original dimensions of the animation as defined in the source file.
|
|
1289
|
+
* Returns width and height in pixels representing the animation's intrinsic size.
|
|
1290
|
+
* @returns Object with width and height properties in pixels
|
|
1291
|
+
*/
|
|
1292
|
+
animationSize(): {
|
|
1293
|
+
height: number;
|
|
1294
|
+
width: number;
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* Gets the Oriented Bounding Box (OBB) points of a layer by its name.
|
|
1298
|
+
* Returns 8 numbers representing 4 corner points (x,y) in clockwise order from top-left: [x0, y0, x1, y1, x2, y2, x3, y3].
|
|
1299
|
+
* @param layerName - Name of the layer to get bounds for
|
|
1300
|
+
* @returns Array of 8 numbers representing the bounding box corners, or undefined if layer not found
|
|
1301
|
+
*/
|
|
1302
|
+
getLayerBoundingBox(layerName: string): number[] | undefined;
|
|
1303
|
+
/**
|
|
1304
|
+
* Converts theme data into Lottie slot format for dynamic content replacement.
|
|
1305
|
+
* Utility function for transforming theme definitions into slot-compatible data structures.
|
|
1306
|
+
* @param theme - Theme data as a JSON string
|
|
1307
|
+
* @param slots - Slot definitions as a JSON string
|
|
1308
|
+
* @returns Transformed slots data as a JSON string
|
|
1309
|
+
*/
|
|
1310
|
+
static transformThemeToLottieSlots(theme: string, slots: string): string;
|
|
1311
|
+
private _setupStateMachineObservers;
|
|
1312
|
+
private _cleanupStateMachineObservers;
|
|
1313
|
+
/**
|
|
1314
|
+
* @experimental
|
|
1315
|
+
* Loads a state machine by its ID from the dotLottie manifest.
|
|
1316
|
+
* State machines enable interactive, event-driven animation behaviors.
|
|
1317
|
+
* @param stateMachineId - The ID of the state machine to load (must exist in manifest)
|
|
1318
|
+
* @returns True if the state machine was loaded successfully, false otherwise
|
|
1319
|
+
*/
|
|
1320
|
+
stateMachineLoad(stateMachineId: string): boolean;
|
|
1321
|
+
/**
|
|
1322
|
+
* @experimental
|
|
1323
|
+
* Load a state machine from data string
|
|
1324
|
+
* @param stateMachineData - The state machine data as a string
|
|
1325
|
+
* @returns true if the state machine was loaded successfully
|
|
1326
|
+
*/
|
|
1327
|
+
stateMachineLoadData(stateMachineData: string): boolean;
|
|
1328
|
+
/**
|
|
1329
|
+
* @experimental
|
|
1330
|
+
* Set the state machine config
|
|
1331
|
+
* @param config - The state machine config
|
|
1332
|
+
*/
|
|
1333
|
+
stateMachineSetConfig(config: StateMachineConfig | null): void;
|
|
1334
|
+
/**
|
|
1335
|
+
* @experimental
|
|
1336
|
+
* Start the state machine
|
|
1337
|
+
* @returns true if the state machine was started successfully
|
|
1338
|
+
*/
|
|
1339
|
+
stateMachineStart(): boolean;
|
|
1340
|
+
/**
|
|
1341
|
+
* @experimental
|
|
1342
|
+
* Stop the state machine
|
|
1343
|
+
* @returns true if the state machine was stopped successfully
|
|
1344
|
+
*/
|
|
1345
|
+
stateMachineStop(): boolean;
|
|
1346
|
+
/**
|
|
1347
|
+
* @experimental
|
|
1348
|
+
* Get the current status of the state machine
|
|
1349
|
+
* @returns The current status of the state machine as a string
|
|
1350
|
+
*/
|
|
1351
|
+
stateMachineGetStatus(): string;
|
|
1352
|
+
/**
|
|
1353
|
+
* @experimental
|
|
1354
|
+
* Get the current state of the state machine
|
|
1355
|
+
* @returns The current state of the state machine as a string
|
|
1356
|
+
*/
|
|
1357
|
+
stateMachineGetCurrentState(): string;
|
|
1358
|
+
/**
|
|
1359
|
+
* @experimental
|
|
1360
|
+
* Get the active state machine ID
|
|
1361
|
+
* @returns The active state machine ID as a string
|
|
1362
|
+
*/
|
|
1363
|
+
stateMachineGetActiveId(): string;
|
|
1364
|
+
/**
|
|
1365
|
+
* @experimental
|
|
1366
|
+
* Override the current state of the state machine
|
|
1367
|
+
* @param state - The state to override to
|
|
1368
|
+
* @param immediate - Whether to immediately transition to the state
|
|
1369
|
+
* @returns true if the state override was successful
|
|
1370
|
+
*/
|
|
1371
|
+
stateMachineOverrideState(state: string, immediate?: boolean): boolean;
|
|
1372
|
+
/**
|
|
1373
|
+
* @experimental
|
|
1374
|
+
* Get a specific state machine by ID
|
|
1375
|
+
* @param stateMachineId - The ID of the state machine to get
|
|
1376
|
+
* @returns The state machine data as a string
|
|
1377
|
+
*/
|
|
1378
|
+
stateMachineGet(stateMachineId: string): string;
|
|
1379
|
+
/**
|
|
1380
|
+
* @experimental
|
|
1381
|
+
* Get the list of state machine listeners
|
|
1382
|
+
* @returns Array of listener names
|
|
1383
|
+
*/
|
|
1384
|
+
stateMachineGetListeners(): string[];
|
|
1385
|
+
/**
|
|
1386
|
+
* @experimental
|
|
1387
|
+
* Set a boolean input value for the state machine
|
|
1388
|
+
* @param name - The name of the boolean input
|
|
1389
|
+
* @param value - The boolean value to set
|
|
1390
|
+
*/
|
|
1391
|
+
stateMachineSetBooleanInput(name: string, value: boolean): boolean;
|
|
1392
|
+
/**
|
|
1393
|
+
* @experimental
|
|
1394
|
+
* Set a numeric input value for the state machine
|
|
1395
|
+
* @param name - The name of the numeric input
|
|
1396
|
+
* @param value - The numeric value to set
|
|
1397
|
+
*/
|
|
1398
|
+
stateMachineSetNumericInput(name: string, value: number): boolean;
|
|
1399
|
+
/**
|
|
1400
|
+
* @experimental
|
|
1401
|
+
* Set a string input value for the state machine
|
|
1402
|
+
* @param name - The name of the string input
|
|
1403
|
+
* @param value - The string value to set
|
|
1404
|
+
*/
|
|
1405
|
+
stateMachineSetStringInput(name: string, value: string): boolean;
|
|
1406
|
+
/**
|
|
1407
|
+
* @experimental
|
|
1408
|
+
* Get a boolean input value from the state machine
|
|
1409
|
+
* @param name - The name of the boolean input
|
|
1410
|
+
* @returns The boolean value or undefined if not found
|
|
1411
|
+
*/
|
|
1412
|
+
stateMachineGetBooleanInput(name: string): boolean | undefined;
|
|
1413
|
+
/**
|
|
1414
|
+
* @experimental
|
|
1415
|
+
* Get a numeric input value from the state machine
|
|
1416
|
+
* @param name - The name of the numeric input
|
|
1417
|
+
* @returns The numeric value or undefined if not found
|
|
1418
|
+
*/
|
|
1419
|
+
stateMachineGetNumericInput(name: string): number | undefined;
|
|
1420
|
+
/**
|
|
1421
|
+
* @experimental
|
|
1422
|
+
* Get a string input value from the state machine
|
|
1423
|
+
* @param name - The name of the string input
|
|
1424
|
+
* @returns The string value or undefined if not found
|
|
1425
|
+
*/
|
|
1426
|
+
stateMachineGetStringInput(name: string): string | undefined;
|
|
1427
|
+
/**
|
|
1428
|
+
* @experimental
|
|
1429
|
+
* Get all the inputs of the current state machine. Returns the key name, followed by it's type as a string.
|
|
1430
|
+
* @returns An array of input keys followed by it's type at n+1.
|
|
1431
|
+
*/
|
|
1432
|
+
stateMachineGetInputs(): string[];
|
|
1433
|
+
/**
|
|
1434
|
+
* @experimental
|
|
1435
|
+
* Fire an event in the state machine
|
|
1436
|
+
* @param name - The name of the event to fire
|
|
1437
|
+
*/
|
|
1438
|
+
stateMachineFireEvent(name: string): void;
|
|
1439
|
+
/**
|
|
1440
|
+
* @experimental
|
|
1441
|
+
* Post a click event to the state machine
|
|
1442
|
+
* @param x - The x coordinate of the click
|
|
1443
|
+
* @param y - The y coordinate of the click
|
|
1444
|
+
* @returns The event result or undefined
|
|
1445
|
+
*/
|
|
1446
|
+
stateMachinePostClickEvent(x: number, y: number): void;
|
|
1447
|
+
/**
|
|
1448
|
+
* @experimental
|
|
1449
|
+
* Post a pointer up event to the state machine
|
|
1450
|
+
* @param x - The x coordinate of the pointer
|
|
1451
|
+
* @param y - The y coordinate of the pointer
|
|
1452
|
+
* @returns The event result or undefined
|
|
1453
|
+
*/
|
|
1454
|
+
stateMachinePostPointerUpEvent(x: number, y: number): void;
|
|
1455
|
+
/**
|
|
1456
|
+
* @experimental
|
|
1457
|
+
* Post a pointer down event to the state machine
|
|
1458
|
+
* @param x - The x coordinate of the pointer
|
|
1459
|
+
* @param y - The y coordinate of the pointer
|
|
1460
|
+
* @returns The event result or undefined
|
|
1461
|
+
*/
|
|
1462
|
+
stateMachinePostPointerDownEvent(x: number, y: number): void;
|
|
1463
|
+
/**
|
|
1464
|
+
* @experimental
|
|
1465
|
+
* Post a pointer move event to the state machine
|
|
1466
|
+
* @param x - The x coordinate of the pointer
|
|
1467
|
+
* @param y - The y coordinate of the pointer
|
|
1468
|
+
* @returns The event result or undefined
|
|
1469
|
+
*/
|
|
1470
|
+
stateMachinePostPointerMoveEvent(x: number, y: number): void;
|
|
1471
|
+
/**
|
|
1472
|
+
* @experimental
|
|
1473
|
+
* Post a pointer enter event to the state machine
|
|
1474
|
+
* @param x - The x coordinate of the pointer
|
|
1475
|
+
* @param y - The y coordinate of the pointer
|
|
1476
|
+
* @returns The event result or undefined
|
|
1477
|
+
*/
|
|
1478
|
+
stateMachinePostPointerEnterEvent(x: number, y: number): void;
|
|
1479
|
+
/**
|
|
1480
|
+
* @experimental
|
|
1481
|
+
* Post a pointer exit event to the state machine
|
|
1482
|
+
* @param x - The x coordinate of the pointer
|
|
1483
|
+
* @param y - The y coordinate of the pointer
|
|
1484
|
+
* @returns The event result or undefined
|
|
1485
|
+
*/
|
|
1486
|
+
stateMachinePostPointerExitEvent(x: number, y: number): void;
|
|
1487
|
+
private _onClick;
|
|
1488
|
+
private _onPointerUp;
|
|
1489
|
+
private _onPointerDown;
|
|
1490
|
+
private _onPointerMove;
|
|
1491
|
+
private _onPointerEnter;
|
|
1492
|
+
private _onPointerLeave;
|
|
1493
|
+
private _setupStateMachineListeners;
|
|
1494
|
+
private _cleanupStateMachineListeners;
|
|
1497
1495
|
}
|
|
1498
|
-
|
|
1496
|
+
//#endregion
|
|
1497
|
+
//#region src/worker/dotlottie.d.ts
|
|
1499
1498
|
interface DotLottieInstanceState {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1499
|
+
activeAnimationId: string | undefined;
|
|
1500
|
+
activeThemeId: string | undefined;
|
|
1501
|
+
autoplay: boolean;
|
|
1502
|
+
backgroundColor: string;
|
|
1503
|
+
currentFrame: number;
|
|
1504
|
+
duration: number;
|
|
1505
|
+
isFrozen: boolean;
|
|
1506
|
+
isLoaded: boolean;
|
|
1507
|
+
isPaused: boolean;
|
|
1508
|
+
isPlaying: boolean;
|
|
1509
|
+
isReady: boolean;
|
|
1510
|
+
isStopped: boolean;
|
|
1511
|
+
layout: Layout | undefined;
|
|
1512
|
+
loop: boolean;
|
|
1513
|
+
loopCount: number;
|
|
1514
|
+
manifest: Manifest | null;
|
|
1515
|
+
marker: string | undefined;
|
|
1516
|
+
markers: Marker[];
|
|
1517
|
+
mode: Mode;
|
|
1518
|
+
renderConfig: RenderConfig;
|
|
1519
|
+
segment: [number, number] | undefined;
|
|
1520
|
+
segmentDuration: number;
|
|
1521
|
+
speed: number;
|
|
1522
|
+
totalFrames: number;
|
|
1523
|
+
useFrameInterpolation: boolean;
|
|
1525
1524
|
}
|
|
1526
1525
|
/**
|
|
1527
1526
|
* Worker-based DotLottie player that offloads animation processing to a Web Worker thread.
|
|
@@ -1529,354 +1528,355 @@ interface DotLottieInstanceState {
|
|
|
1529
1528
|
* All methods are async (return Promises) due to worker communication. Requires HTMLCanvasElement or OffscreenCanvas.
|
|
1530
1529
|
*/
|
|
1531
1530
|
declare class DotLottieWorker {
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1531
|
+
private static readonly _workerManager;
|
|
1532
|
+
private readonly _eventManager;
|
|
1533
|
+
private readonly _id;
|
|
1534
|
+
private readonly _worker;
|
|
1535
|
+
private _canvas;
|
|
1536
|
+
private _dotLottieInstanceState;
|
|
1537
|
+
private static _wasmUrl;
|
|
1538
|
+
private _created;
|
|
1539
|
+
private _boundOnClick;
|
|
1540
|
+
private _boundOnPointerUp;
|
|
1541
|
+
private _boundOnPointerDown;
|
|
1542
|
+
private _boundOnPointerMove;
|
|
1543
|
+
private _boundOnPointerEnter;
|
|
1544
|
+
private _boundOnPointerLeave;
|
|
1545
|
+
private _pendingConfig;
|
|
1546
|
+
/**
|
|
1547
|
+
* Creates a worker-based DotLottie player instance that runs in a separate thread.
|
|
1548
|
+
* Use workerId to share a worker across multiple animations for better resource management.
|
|
1549
|
+
* @param config - Configuration with optional workerId to share worker threads
|
|
1550
|
+
* @throws Error if canvas is not HTMLCanvasElement or OffscreenCanvas
|
|
1551
|
+
*/
|
|
1552
|
+
constructor(config: Config & {
|
|
1553
|
+
workerId?: string;
|
|
1554
|
+
});
|
|
1555
|
+
private _handleWorkerEvent;
|
|
1556
|
+
private _create;
|
|
1557
|
+
get loopCount(): number;
|
|
1558
|
+
get isLoaded(): boolean;
|
|
1559
|
+
get isPlaying(): boolean;
|
|
1560
|
+
get isPaused(): boolean;
|
|
1561
|
+
get isStopped(): boolean;
|
|
1562
|
+
get currentFrame(): number;
|
|
1563
|
+
get isFrozen(): boolean;
|
|
1564
|
+
get segmentDuration(): number;
|
|
1565
|
+
get totalFrames(): number;
|
|
1566
|
+
get segment(): [number, number] | undefined;
|
|
1567
|
+
get speed(): number;
|
|
1568
|
+
get duration(): number;
|
|
1569
|
+
get isReady(): boolean;
|
|
1570
|
+
get mode(): Mode;
|
|
1571
|
+
get canvas(): HTMLCanvasElement | OffscreenCanvas | null;
|
|
1572
|
+
/**
|
|
1573
|
+
* Sets the canvas element for rendering in the worker thread.
|
|
1574
|
+
* Cannot change canvas after worker instance is created with a different canvas.
|
|
1575
|
+
* @param canvas - HTMLCanvasElement or OffscreenCanvas to render to
|
|
1576
|
+
* @returns Promise that resolves when canvas has been set
|
|
1577
|
+
* @throws Error if canvas is not HTMLCanvasElement or OffscreenCanvas
|
|
1578
|
+
* @throws Error if trying to change canvas after instance is already created
|
|
1579
|
+
*/
|
|
1580
|
+
setCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): Promise<void>;
|
|
1581
|
+
get autoplay(): boolean;
|
|
1582
|
+
get backgroundColor(): string;
|
|
1583
|
+
get loop(): boolean;
|
|
1584
|
+
get useFrameInterpolation(): boolean;
|
|
1585
|
+
get renderConfig(): RenderConfig;
|
|
1586
|
+
get manifest(): Manifest | null;
|
|
1587
|
+
get activeAnimationId(): string | undefined;
|
|
1588
|
+
get marker(): string | undefined;
|
|
1589
|
+
get activeThemeId(): string | undefined;
|
|
1590
|
+
get layout(): Layout | undefined;
|
|
1591
|
+
/**
|
|
1592
|
+
* Starts or resumes animation playback in the worker thread.
|
|
1593
|
+
* Updates the internal playback state (e.g., isPlaying) to reflect that playback has started.
|
|
1594
|
+
* @returns Promise that resolves when playback has started and state has been updated
|
|
1595
|
+
*/
|
|
1596
|
+
play(): Promise<void>;
|
|
1597
|
+
/**
|
|
1598
|
+
* Pauses animation playback in the worker thread.
|
|
1599
|
+
* Awaits worker response before resolving. Updates isPaused state to true.
|
|
1600
|
+
* @returns Promise that resolves when playback has paused
|
|
1601
|
+
*/
|
|
1602
|
+
pause(): Promise<void>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Stops animation playback and resets to start frame in the worker thread.
|
|
1605
|
+
* Awaits worker response before resolving. Updates isStopped state to true.
|
|
1606
|
+
* @returns Promise that resolves when playback has stopped
|
|
1607
|
+
*/
|
|
1608
|
+
stop(): Promise<void>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Changes the animation playback speed in the worker thread.
|
|
1611
|
+
* Awaits worker response before resolving.
|
|
1612
|
+
* @param speed - Playback speed multiplier (e.g., 2 for 2x speed, 0.5 for half speed)
|
|
1613
|
+
* @returns Promise that resolves when speed has been updated
|
|
1614
|
+
*/
|
|
1615
|
+
setSpeed(speed: number): Promise<void>;
|
|
1616
|
+
setMode(mode: Mode): Promise<void>;
|
|
1617
|
+
setFrame(frame: number): Promise<void>;
|
|
1618
|
+
setSegment(start: number, end: number): Promise<void>;
|
|
1619
|
+
setRenderConfig(renderConfig: RenderConfig): Promise<void>;
|
|
1620
|
+
setUseFrameInterpolation(useFrameInterpolation: boolean): Promise<void>;
|
|
1621
|
+
setTheme(themeId: string): Promise<boolean>;
|
|
1622
|
+
/**
|
|
1623
|
+
* Dynamically loads a new animation in the worker thread, replacing the current one.
|
|
1624
|
+
* Awaits worker response before resolving. Stops current playback and cleans up resources.
|
|
1625
|
+
* @param config - Configuration for the new animation (all Config properties except canvas)
|
|
1626
|
+
* @returns Promise that resolves when animation has been loaded
|
|
1627
|
+
*/
|
|
1628
|
+
load(config: Omit<Config, 'canvas'>): Promise<void>;
|
|
1629
|
+
setLoop(loop: boolean): Promise<void>;
|
|
1630
|
+
/**
|
|
1631
|
+
* Sets the number of additional times to replay the animation after the first play in the worker thread.
|
|
1632
|
+
* Requires loop to be true. A value of 0 means infinite replays; a positive value n means
|
|
1633
|
+
* the animation plays a total of n + 1 times (initial play + n replays).
|
|
1634
|
+
* @param loopCount - Number of additional replays (0 = infinite, 1 = plays twice, 2 = plays three times, etc.)
|
|
1635
|
+
* @returns Promise that resolves when loopCount has been updated
|
|
1636
|
+
*/
|
|
1637
|
+
setLoopCount(loopCount: number): Promise<void>;
|
|
1638
|
+
/**
|
|
1639
|
+
* Recalculates and updates canvas dimensions in the worker thread.
|
|
1640
|
+
* Awaits worker response before resolving. Call when canvas container size changes.
|
|
1641
|
+
* @returns Promise that resolves when resize has completed
|
|
1642
|
+
*/
|
|
1643
|
+
resize(): Promise<void>;
|
|
1644
|
+
/**
|
|
1645
|
+
* Cleans up and destroys the player instance in the worker thread, releasing resources.
|
|
1646
|
+
* Awaits worker response before resolving. Stops playback and removes event listeners.
|
|
1647
|
+
* @returns Promise that resolves when cleanup has completed
|
|
1648
|
+
*/
|
|
1649
|
+
destroy(): Promise<void>;
|
|
1650
|
+
freeze(): Promise<void>;
|
|
1651
|
+
unfreeze(): Promise<void>;
|
|
1652
|
+
setBackgroundColor(backgroundColor: string): Promise<void>;
|
|
1653
|
+
loadAnimation(animationId: string): Promise<void>;
|
|
1654
|
+
setLayout(layout: Layout): Promise<void>;
|
|
1655
|
+
private _updateDotLottieInstanceState;
|
|
1656
|
+
markers(): Marker[];
|
|
1657
|
+
setMarker(marker: string): Promise<void>;
|
|
1658
|
+
setThemeData(themeData: string): Promise<boolean>;
|
|
1659
|
+
setViewport(x: number, y: number, width: number, height: number): Promise<boolean>;
|
|
1660
|
+
animationSize(): Promise<{
|
|
1661
|
+
height: number;
|
|
1662
|
+
width: number;
|
|
1663
|
+
}>;
|
|
1664
|
+
/**
|
|
1665
|
+
* @experimental
|
|
1666
|
+
* Start a tween animation between two frame values with custom easing
|
|
1667
|
+
* @param frame - Starting frame value
|
|
1668
|
+
* @param duration - Duration of the tween in seconds
|
|
1669
|
+
* @returns true if tween was started successfully
|
|
1670
|
+
*/
|
|
1671
|
+
tween(frame: number, duration: number): Promise<boolean>;
|
|
1672
|
+
/**
|
|
1673
|
+
* @experimental
|
|
1674
|
+
* Start a tween animation to a specific marker
|
|
1675
|
+
* @param marker - The marker name to tween to
|
|
1676
|
+
* @param duration - Duration of the tween in seconds
|
|
1677
|
+
* @returns true if tween was started successfully
|
|
1678
|
+
*/
|
|
1679
|
+
tweenToMarker(marker: string, duration: number): Promise<boolean>;
|
|
1680
|
+
setTransform(transform: Transform): Promise<boolean>;
|
|
1681
|
+
getTransform(): Promise<Transform | undefined>;
|
|
1682
|
+
private _sendMessage;
|
|
1683
|
+
addEventListener<T extends EventType>(type: T, listener: EventListener<T>): void;
|
|
1684
|
+
removeEventListener<T extends EventType>(type: T, listener?: EventListener<T>): void;
|
|
1685
|
+
static setWasmUrl(url: string): void;
|
|
1686
|
+
/**
|
|
1687
|
+
* @experimental
|
|
1688
|
+
*
|
|
1689
|
+
* Register a custom font for use in animations in worker contexts
|
|
1690
|
+
* @param fontName - The name of the font to register
|
|
1691
|
+
* @param fontSource - Either a URL string to fetch the font, or ArrayBuffer/Uint8Array of font data
|
|
1692
|
+
* @returns Promise<boolean> - true if registration message was sent successfully
|
|
1693
|
+
*/
|
|
1694
|
+
static registerFont(fontName: string, fontSource: string | ArrayBuffer | Uint8Array): Promise<boolean>;
|
|
1695
|
+
/**
|
|
1696
|
+
* @experimental
|
|
1697
|
+
* Load a state machine by ID
|
|
1698
|
+
* @param stateMachineId - The ID of the state machine to load
|
|
1699
|
+
* @returns true if the state machine was loaded successfully
|
|
1700
|
+
*/
|
|
1701
|
+
stateMachineLoad(stateMachineId: string): Promise<boolean>;
|
|
1702
|
+
/**
|
|
1703
|
+
* @experimental
|
|
1704
|
+
* Load a state machine from data string
|
|
1705
|
+
* @param stateMachineData - The state machine data as a string
|
|
1706
|
+
* @returns true if the state machine was loaded successfully
|
|
1707
|
+
*/
|
|
1708
|
+
stateMachineLoadData(stateMachineData: string): Promise<boolean>;
|
|
1709
|
+
/**
|
|
1710
|
+
* @experimental
|
|
1711
|
+
* Start the state machine
|
|
1712
|
+
* @returns true if the state machine was started successfully
|
|
1713
|
+
*/
|
|
1714
|
+
stateMachineStart(): Promise<boolean>;
|
|
1715
|
+
/**
|
|
1716
|
+
* @experimental
|
|
1717
|
+
* Stop the state machine
|
|
1718
|
+
* @returns true if the state machine was stopped successfully
|
|
1719
|
+
*/
|
|
1720
|
+
stateMachineStop(): Promise<boolean>;
|
|
1721
|
+
/**
|
|
1722
|
+
* @experimental
|
|
1723
|
+
* Set a numeric input value for the state machine
|
|
1724
|
+
* @param name - The name of the numeric input
|
|
1725
|
+
* @param value - The numeric value to set
|
|
1726
|
+
* @returns true if the input was set successfully
|
|
1727
|
+
*/
|
|
1728
|
+
stateMachineSetNumericInput(name: string, value: number): Promise<boolean>;
|
|
1729
|
+
/**
|
|
1730
|
+
* @experimental
|
|
1731
|
+
* Set a boolean input value for the state machine
|
|
1732
|
+
* @param name - The name of the boolean input
|
|
1733
|
+
* @param value - The boolean value to set
|
|
1734
|
+
* @returns true if the input was set successfully
|
|
1735
|
+
*/
|
|
1736
|
+
stateMachineSetBooleanInput(name: string, value: boolean): Promise<boolean>;
|
|
1737
|
+
/**
|
|
1738
|
+
* @experimental
|
|
1739
|
+
* Set the state machine config
|
|
1740
|
+
* @param config - The state machine config
|
|
1741
|
+
*/
|
|
1742
|
+
stateMachineSetConfig(config: StateMachineConfig | null): Promise<void>;
|
|
1743
|
+
/**
|
|
1744
|
+
* @experimental
|
|
1745
|
+
* Set a string input value for the state machine
|
|
1746
|
+
* @param name - The name of the string input
|
|
1747
|
+
* @param value - The string value to set
|
|
1748
|
+
* @returns true if the input was set successfully
|
|
1749
|
+
*/
|
|
1750
|
+
stateMachineSetStringInput(name: string, value: string): Promise<boolean>;
|
|
1751
|
+
/**
|
|
1752
|
+
* @experimental
|
|
1753
|
+
* Get a numeric input value from the state machine
|
|
1754
|
+
* @param name - The name of the numeric input
|
|
1755
|
+
* @returns The numeric value or undefined if not found
|
|
1756
|
+
*/
|
|
1757
|
+
stateMachineGetNumericInput(name: string): Promise<number | undefined>;
|
|
1758
|
+
/**
|
|
1759
|
+
* @experimental
|
|
1760
|
+
* Get a boolean input value from the state machine
|
|
1761
|
+
* @param name - The name of the boolean input
|
|
1762
|
+
* @returns The boolean value or undefined if not found
|
|
1763
|
+
*/
|
|
1764
|
+
stateMachineGetBooleanInput(name: string): Promise<boolean | undefined>;
|
|
1765
|
+
/**
|
|
1766
|
+
* @experimental
|
|
1767
|
+
* Get a string input value from the state machine
|
|
1768
|
+
* @param name - The name of the string input
|
|
1769
|
+
* @returns The string value or undefined if not found
|
|
1770
|
+
*/
|
|
1771
|
+
stateMachineGetStringInput(name: string): Promise<string | undefined>;
|
|
1772
|
+
/**
|
|
1773
|
+
* @experimental
|
|
1774
|
+
* Get all inputs
|
|
1775
|
+
* @returns All input keys, followed by their type
|
|
1776
|
+
*/
|
|
1777
|
+
stateMachineGetInputs(): Promise<string[] | undefined>;
|
|
1778
|
+
/**
|
|
1779
|
+
* @experimental
|
|
1780
|
+
* Fire an event in the state machine
|
|
1781
|
+
* @param name - The name of the event to fire
|
|
1782
|
+
*/
|
|
1783
|
+
stateMachineFireEvent(name: string): Promise<void>;
|
|
1784
|
+
/**
|
|
1785
|
+
* @experimental
|
|
1786
|
+
* Get the current status of the state machine
|
|
1787
|
+
* @returns The current status of the state machine as a string
|
|
1788
|
+
*/
|
|
1789
|
+
stateMachineGetStatus(): Promise<string>;
|
|
1790
|
+
/**
|
|
1791
|
+
* @experimental
|
|
1792
|
+
* Get the current state of the state machine
|
|
1793
|
+
* @returns The current state of the state machine as a string
|
|
1794
|
+
*/
|
|
1795
|
+
stateMachineGetCurrentState(): Promise<string>;
|
|
1796
|
+
/**
|
|
1797
|
+
* @experimental
|
|
1798
|
+
* Get the active state machine ID
|
|
1799
|
+
* @returns The active state machine ID as a string
|
|
1800
|
+
*/
|
|
1801
|
+
stateMachineGetActiveId(): Promise<string>;
|
|
1802
|
+
/**
|
|
1803
|
+
* @experimental
|
|
1804
|
+
* Override the current state of the state machine
|
|
1805
|
+
* @param state - The state to override to
|
|
1806
|
+
* @param immediate - Whether to immediately transition to the state
|
|
1807
|
+
* @returns true if the state override was successful
|
|
1808
|
+
*/
|
|
1809
|
+
stateMachineOverrideState(state: string, immediate?: boolean): Promise<boolean>;
|
|
1810
|
+
/**
|
|
1811
|
+
* @experimental
|
|
1812
|
+
* Get a specific state machine by ID
|
|
1813
|
+
* @param stateMachineId - The ID of the state machine to get
|
|
1814
|
+
* @returns The state machine data as a string
|
|
1815
|
+
*/
|
|
1816
|
+
stateMachineGet(stateMachineId: string): Promise<string>;
|
|
1817
|
+
/**
|
|
1818
|
+
* @experimental
|
|
1819
|
+
* Get the list of state machine listeners
|
|
1820
|
+
* @returns Array of listener names
|
|
1821
|
+
*/
|
|
1822
|
+
stateMachineGetListeners(): Promise<string[]>;
|
|
1823
|
+
/**
|
|
1824
|
+
* @experimental
|
|
1825
|
+
* Post a click event to the state machine
|
|
1826
|
+
* @param x - The x coordinate of the click
|
|
1827
|
+
* @param y - The y coordinate of the click
|
|
1828
|
+
* @returns The event result or undefined
|
|
1829
|
+
*/
|
|
1830
|
+
stateMachinePostClickEvent(x: number, y: number): Promise<void>;
|
|
1831
|
+
/**
|
|
1832
|
+
* @experimental
|
|
1833
|
+
* Post a pointer up event to the state machine
|
|
1834
|
+
* @param x - The x coordinate of the pointer
|
|
1835
|
+
* @param y - The y coordinate of the pointer
|
|
1836
|
+
* @returns The event result or undefined
|
|
1837
|
+
*/
|
|
1838
|
+
stateMachinePostPointerUpEvent(x: number, y: number): Promise<void>;
|
|
1839
|
+
/**
|
|
1840
|
+
* @experimental
|
|
1841
|
+
* Post a pointer down event to the state machine
|
|
1842
|
+
* @param x - The x coordinate of the pointer
|
|
1843
|
+
* @param y - The y coordinate of the pointer
|
|
1844
|
+
* @returns The event result or undefined
|
|
1845
|
+
*/
|
|
1846
|
+
stateMachinePostPointerDownEvent(x: number, y: number): Promise<void>;
|
|
1847
|
+
/**
|
|
1848
|
+
* @experimental
|
|
1849
|
+
* Post a pointer move event to the state machine
|
|
1850
|
+
* @param x - The x coordinate of the pointer
|
|
1851
|
+
* @param y - The y coordinate of the pointer
|
|
1852
|
+
* @returns The event result or undefined
|
|
1853
|
+
*/
|
|
1854
|
+
stateMachinePostPointerMoveEvent(x: number, y: number): Promise<void>;
|
|
1855
|
+
/**
|
|
1856
|
+
* @experimental
|
|
1857
|
+
* Post a pointer enter event to the state machine
|
|
1858
|
+
* @param x - The x coordinate of the pointer
|
|
1859
|
+
* @param y - The y coordinate of the pointer
|
|
1860
|
+
* @returns The event result or undefined
|
|
1861
|
+
*/
|
|
1862
|
+
stateMachinePostPointerEnterEvent(x: number, y: number): Promise<void>;
|
|
1863
|
+
/**
|
|
1864
|
+
* @experimental
|
|
1865
|
+
* Post a pointer exit event to the state machine
|
|
1866
|
+
* @param x - The x coordinate of the pointer
|
|
1867
|
+
* @param y - The y coordinate of the pointer
|
|
1868
|
+
* @returns The event result or undefined
|
|
1869
|
+
*/
|
|
1870
|
+
stateMachinePostPointerExitEvent(x: number, y: number): Promise<void>;
|
|
1871
|
+
private _onClick;
|
|
1872
|
+
private _onPointerUp;
|
|
1873
|
+
private _onPointerDown;
|
|
1874
|
+
private _onPointerMove;
|
|
1875
|
+
private _onPointerEnter;
|
|
1876
|
+
private _onPointerLeave;
|
|
1877
|
+
private _setupStateMachineListeners;
|
|
1878
|
+
private _cleanupStateMachineListeners;
|
|
1880
1879
|
}
|
|
1881
|
-
|
|
1882
|
-
export {
|
|
1880
|
+
//#endregion
|
|
1881
|
+
export { BaseEvent, BezierHandle, Color, ColorSlotValue, CompleteEvent, Config, Data, DestroyEvent, DotLottie, DotLottieInstanceState, DotLottieWorker, Event, EventListener, EventManager, EventType, Fit, FrameEvent, FreezeEvent, Gradient, GradientSlotValue, Keyframe, Layout, LoadErrorEvent, LoadEvent, LoopEvent, Manifest, Mode, PauseEvent, PlayEvent, ReadyEvent, RenderConfig, RenderErrorEvent, RenderEvent, RenderSurface, ScalarSlotValue, SlotType, StateMachineBooleanInputValueChangeEvent, StateMachineConfig, StateMachineCustomEvent, StateMachineErrorEvent, StateMachineInputFiredEvent, StateMachineInternalMessage, StateMachineNumericInputValueChangeEvent, StateMachineStartEvent, StateMachineStateEnteredEvent, StateMachineStateExitEvent, StateMachineStopEvent, StateMachineStringInputValueChangeEvent, StateMachineTransitionEvent, StopEvent, TextDocument, TextSlotValue, Theme, ThemeBaseKeyframe, ThemeBaseRule, ThemeColorKeyframe, ThemeColorRule, ThemeGradientKeyframe, ThemeGradientRule, ThemeGradientStop, ThemeImageRule, ThemeImageValue, ThemePositionKeyframe, ThemePositionRule, ThemeRule, ThemeScalarKeyframe, ThemeScalarRule, ThemeTextCaps, ThemeTextDocument, ThemeTextJustify, ThemeTextKeyframe, ThemeTextRule, ThemeVectorKeyframe, ThemeVectorRule, Transform, UnfreezeEvent, Vector, VectorSlotValue };
|
|
1882
|
+
//# sourceMappingURL=index.d.ts.map
|