@lottiefiles/dotlottie-web 0.5.0 → 0.7.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/README.md +44 -19
- package/dist/chunk-4GVX2PO3.js +10 -0
- package/dist/chunk-4GVX2PO3.js.map +1 -0
- package/dist/{chunk-6PRCY2FC.js → chunk-SMXCTWPA.js} +3 -3
- package/dist/chunk-SMXCTWPA.js.map +1 -0
- package/dist/dotlottie.d.ts +44 -3
- package/dist/dotlottie.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/renderer.wasm +0 -0
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -5
- package/dist/chunk-6PRCY2FC.js.map +0 -1
- package/dist/chunk-LVR6J6SH.js +0 -11
- package/dist/chunk-LVR6J6SH.js.map +0 -1
package/dist/dotlottie.d.ts
CHANGED
|
@@ -4,11 +4,16 @@ import { EventType, EventListener } from './event-manager.js';
|
|
|
4
4
|
* Copyright 2023 Design Barn Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type Mode = 'normal' | 'reverse' | 'bounce' | 'bounce-reverse';
|
|
8
|
+
interface Config {
|
|
8
9
|
/**
|
|
9
10
|
* Boolean indicating if the animation should start playing automatically.
|
|
10
11
|
*/
|
|
11
12
|
autoplay?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Animation canvas background color.
|
|
15
|
+
*/
|
|
16
|
+
backgroundColor?: string;
|
|
12
17
|
/**
|
|
13
18
|
* The canvas element to render the animation on.
|
|
14
19
|
*/
|
|
@@ -23,6 +28,11 @@ interface Options {
|
|
|
23
28
|
* Boolean indicating if the animation should loop.
|
|
24
29
|
*/
|
|
25
30
|
loop?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The playback mode of the animation.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
mode?: Mode;
|
|
26
36
|
/**
|
|
27
37
|
* The speed of the animation.
|
|
28
38
|
*/
|
|
@@ -39,6 +49,7 @@ declare class DotLottie {
|
|
|
39
49
|
private _renderer;
|
|
40
50
|
private _playing;
|
|
41
51
|
private _beginTime;
|
|
52
|
+
private _elapsedTime;
|
|
42
53
|
private _totalFrames;
|
|
43
54
|
private _loop;
|
|
44
55
|
private _speed;
|
|
@@ -46,7 +57,19 @@ declare class DotLottie {
|
|
|
46
57
|
private _duration;
|
|
47
58
|
private _loopCount;
|
|
48
59
|
private _autoplay;
|
|
49
|
-
|
|
60
|
+
private _mode;
|
|
61
|
+
private _direction;
|
|
62
|
+
private _bounceCount;
|
|
63
|
+
private _animationFrameId?;
|
|
64
|
+
private _shouldAutoResizeCanvas;
|
|
65
|
+
private readonly _canvasResizeObserver?;
|
|
66
|
+
constructor(config: Config);
|
|
67
|
+
/**
|
|
68
|
+
* Gets the current direction of the animation.
|
|
69
|
+
*
|
|
70
|
+
* @returns The current direction of the animation.
|
|
71
|
+
*/
|
|
72
|
+
get direction(): number;
|
|
50
73
|
/**
|
|
51
74
|
* Gets the current frame number.
|
|
52
75
|
*
|
|
@@ -120,6 +143,23 @@ declare class DotLottie {
|
|
|
120
143
|
* Loop that handles the animation playback.
|
|
121
144
|
*/
|
|
122
145
|
private _animationLoop;
|
|
146
|
+
/**
|
|
147
|
+
* Adjusts the canvas size based on the device pixel ratio and the size of the canvas element.
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
_resizeAnimationToCanvas(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Stops the animation loop.
|
|
153
|
+
*
|
|
154
|
+
* This is used to ensure that the animation loop is only stopped once.
|
|
155
|
+
*/
|
|
156
|
+
_stopAnimationLoop(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Starts the animation loop.
|
|
159
|
+
*
|
|
160
|
+
* This is used to ensure that the animation loop is only started once.
|
|
161
|
+
*/
|
|
162
|
+
_startAnimationLoop(): void;
|
|
123
163
|
/**
|
|
124
164
|
* Starts the animation playback.
|
|
125
165
|
*/
|
|
@@ -147,6 +187,7 @@ declare class DotLottie {
|
|
|
147
187
|
* @param frame - Frame number to set.
|
|
148
188
|
*/
|
|
149
189
|
setFrame(frame: number): void;
|
|
190
|
+
load(config: Omit<Config, 'canvas'>): void;
|
|
150
191
|
/**
|
|
151
192
|
* Registers an event listener for a specific event type.
|
|
152
193
|
*
|
|
@@ -173,4 +214,4 @@ declare class DotLottie {
|
|
|
173
214
|
destroy(): void;
|
|
174
215
|
}
|
|
175
216
|
|
|
176
|
-
export { DotLottie,
|
|
217
|
+
export { Config, DotLottie, Mode };
|
package/dist/dotlottie.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as DotLottie } from './chunk-
|
|
1
|
+
export { b as DotLottie } from './chunk-4GVX2PO3.js';
|
|
2
2
|
import './chunk-2ELNS7EO.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-SMXCTWPA.js';
|
|
4
4
|
import './chunk-7Q3PPTBP.js';
|
|
5
5
|
//# sourceMappingURL=out.js.map
|
|
6
6
|
//# sourceMappingURL=dotlottie.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { DotLottie,
|
|
1
|
+
export { Config, DotLottie, Mode } from './dotlottie.js';
|
|
2
2
|
export { BaseEvent, CompleteEvent, Event, EventListener, EventManager, EventType, FrameEvent, LoadErrorEvent, LoadEvent, LoopEvent, PauseEvent, PlayEvent, StopEvent } from './event-manager.js';
|
|
3
|
-
export { getAnimationJSONFromDotLottie, loadAnimationJSONFromURL } from './utils.js';
|
|
3
|
+
export { debounce, getAnimationJSONFromDotLottie, loadAnimationJSONFromURL } from './utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Copyright 2023 Design Barn Inc.
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as DotLottie, a as WasmLoader } from './chunk-
|
|
1
|
+
export { b as DotLottie, a as WasmLoader } from './chunk-4GVX2PO3.js';
|
|
2
2
|
export { a as EventManager } from './chunk-2ELNS7EO.js';
|
|
3
|
-
export { a as getAnimationJSONFromDotLottie, b as loadAnimationJSONFromURL } from './chunk-
|
|
3
|
+
export { c as debounce, a as getAnimationJSONFromDotLottie, b as loadAnimationJSONFromURL } from './chunk-SMXCTWPA.js';
|
|
4
4
|
import './chunk-7Q3PPTBP.js';
|
|
5
5
|
//# sourceMappingURL=out.js.map
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/renderer.wasm
CHANGED
|
Binary file
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
declare function getAnimationJSONFromDotLottie(dotLottieBuffer: ArrayBuffer): Promise<string>;
|
|
5
5
|
declare function loadAnimationJSONFromURL(animationURL: string): Promise<string>;
|
|
6
|
+
declare function debounce<T extends (...args: any[]) => void>(func: T, wait: number): (...funcArgs: Parameters<T>) => void;
|
|
6
7
|
|
|
7
|
-
export { getAnimationJSONFromDotLottie, loadAnimationJSONFromURL };
|
|
8
|
+
export { debounce, getAnimationJSONFromDotLottie, loadAnimationJSONFromURL };
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as getAnimationJSONFromDotLottie, b as loadAnimationJSONFromURL } from './chunk-
|
|
1
|
+
export { c as debounce, a as getAnimationJSONFromDotLottie, b as loadAnimationJSONFromURL } from './chunk-SMXCTWPA.js';
|
|
2
2
|
import './chunk-7Q3PPTBP.js';
|
|
3
3
|
//# sourceMappingURL=out.js.map
|
|
4
4
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lottiefiles/dotlottie-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Lottie and DotLottie player for the web",
|
|
6
6
|
"repository": {
|
|
@@ -37,10 +37,7 @@
|
|
|
37
37
|
"@dotlottie/dotlottie-js": "^0.6.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@size-limit/esbuild-why": "^10.0.2",
|
|
41
|
-
"@size-limit/preset-small-lib": "^10.0.2",
|
|
42
40
|
"cross-env": "7.0.3",
|
|
43
|
-
"size-limit": "^10.0.2",
|
|
44
41
|
"tsup": "7.2.0",
|
|
45
42
|
"typescript": "5.0.4"
|
|
46
43
|
},
|
|
@@ -53,7 +50,6 @@
|
|
|
53
50
|
"build:wasm:docker": "./docker_build_wasm.sh",
|
|
54
51
|
"dev": "tsup --watch",
|
|
55
52
|
"lint": "eslint --fix .",
|
|
56
|
-
"size": "size-limit",
|
|
57
53
|
"size:why": "size-limit --why --clean-dir --save-bundle ./tmp",
|
|
58
54
|
"stats:eslint": "cross-env TIMING=1 eslint .",
|
|
59
55
|
"stats:ts": "tsc -p tsconfig.build.json --extendedDiagnostics",
|