@babylonjs/lottie-player 8.24.1
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/animationConfiguration.d.ts +80 -0
- package/animationConfiguration.d.ts.map +1 -0
- package/animationConfiguration.js +16 -0
- package/animationConfiguration.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/license.md +21 -0
- package/localPlayer.d.ts +38 -0
- package/localPlayer.d.ts.map +1 -0
- package/localPlayer.js +100 -0
- package/localPlayer.js.map +1 -0
- package/maths/bezier.d.ts +45 -0
- package/maths/bezier.d.ts.map +1 -0
- package/maths/bezier.js +53 -0
- package/maths/bezier.js.map +1 -0
- package/maths/boundingBox.d.ts +39 -0
- package/maths/boundingBox.d.ts.map +1 -0
- package/maths/boundingBox.js +204 -0
- package/maths/boundingBox.js.map +1 -0
- package/maths/matrix.d.ts +92 -0
- package/maths/matrix.d.ts.map +1 -0
- package/maths/matrix.js +174 -0
- package/maths/matrix.js.map +1 -0
- package/messageTypes.d.ts +88 -0
- package/messageTypes.d.ts.map +1 -0
- package/messageTypes.js +2 -0
- package/messageTypes.js.map +1 -0
- package/nodes/controlNode.d.ts +32 -0
- package/nodes/controlNode.d.ts.map +1 -0
- package/nodes/controlNode.js +38 -0
- package/nodes/controlNode.js.map +1 -0
- package/nodes/node.d.ts +121 -0
- package/nodes/node.d.ts.map +1 -0
- package/nodes/node.js +357 -0
- package/nodes/node.js.map +1 -0
- package/nodes/spriteNode.d.ts +32 -0
- package/nodes/spriteNode.d.ts.map +1 -0
- package/nodes/spriteNode.js +51 -0
- package/nodes/spriteNode.js.map +1 -0
- package/package.json +48 -0
- package/parsing/parsedTypes.d.ts +141 -0
- package/parsing/parsedTypes.d.ts.map +1 -0
- package/parsing/parsedTypes.js +2 -0
- package/parsing/parsedTypes.js.map +1 -0
- package/parsing/parser.d.ts +59 -0
- package/parsing/parser.d.ts.map +1 -0
- package/parsing/parser.js +500 -0
- package/parsing/parser.js.map +1 -0
- package/parsing/rawTypes.d.ts +238 -0
- package/parsing/rawTypes.d.ts.map +1 -0
- package/parsing/rawTypes.js +4 -0
- package/parsing/rawTypes.js.map +1 -0
- package/parsing/spritePacker.d.ts +122 -0
- package/parsing/spritePacker.d.ts.map +1 -0
- package/parsing/spritePacker.js +409 -0
- package/parsing/spritePacker.js.map +1 -0
- package/player.d.ts +42 -0
- package/player.d.ts.map +1 -0
- package/player.js +146 -0
- package/player.js.map +1 -0
- package/readme.md +44 -0
- package/rendering/animationController.d.ts +93 -0
- package/rendering/animationController.d.ts.map +1 -0
- package/rendering/animationController.js +246 -0
- package/rendering/animationController.js.map +1 -0
- package/rendering/renderingManager.d.ts +46 -0
- package/rendering/renderingManager.d.ts.map +1 -0
- package/rendering/renderingManager.js +61 -0
- package/rendering/renderingManager.js.map +1 -0
- package/worker.d.ts +2 -0
- package/worker.d.ts.map +1 -0
- package/worker.js +62 -0
- package/worker.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundingBox.js","sourceRoot":"","sources":["../../../../dev/lottiePlayer/src/maths/boundingBox.ts"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAyB;IAC1D,MAAM,UAAU,GAAY;QACxB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,CAAC,QAAQ;QACf,IAAI,EAAE,CAAC,QAAQ;KAClB,CAAC;IAEF,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;YAC7B,oBAAoB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAsB,CAAC,C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|
+
import type { Tuple } from "@babylonjs/core/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Babylon.js thin version of a Matrix
|
|
5
|
+
* We are only exposing what we truly need in the scope of
|
|
6
|
+
* the Lottie Renderer project preventing the dependency on the full
|
|
7
|
+
* Babylon.js math system.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ThinMatrix implements IMatrixLike {
|
|
10
|
+
/**
|
|
11
|
+
* Prevents global conflicts on update as shader programs are shared.
|
|
12
|
+
*/
|
|
13
|
+
private static _UPDATE_FLAG_SEED;
|
|
14
|
+
/**
|
|
15
|
+
* Current update flag used to know whether a Matrix has changed since previous render or not.
|
|
16
|
+
* This helps identifying if a Matrix needs to be
|
|
17
|
+
* uploaded to a shader program.
|
|
18
|
+
*/
|
|
19
|
+
updateFlag: number;
|
|
20
|
+
private readonly _data;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new ThinMatrix instance.
|
|
23
|
+
*/
|
|
24
|
+
constructor();
|
|
25
|
+
/**
|
|
26
|
+
* Set the matrix values.
|
|
27
|
+
* @param m11 Value for row 1, column 1
|
|
28
|
+
* @param m12 Value for row 1, column 2
|
|
29
|
+
* @param m13 Value for row 1, column 3
|
|
30
|
+
* @param m14 Value for row 1, column 4
|
|
31
|
+
* @param m21 Value for row 2, column 1
|
|
32
|
+
* @param m22 Value for row 2, column 2
|
|
33
|
+
* @param m23 Value for row 2, column 3
|
|
34
|
+
* @param m24 Value for row 2, column 4
|
|
35
|
+
* @param m31 Value for row 3, column 1
|
|
36
|
+
* @param m32 Value for row 3, column 2
|
|
37
|
+
* @param m33 Value for row 3, column 3
|
|
38
|
+
* @param m34 Value for row 3, column 4
|
|
39
|
+
* @param m41 Value for row 4, column 1
|
|
40
|
+
* @param m42 Value for row 4, column 2
|
|
41
|
+
* @param m43 Value for row 4, column 3
|
|
42
|
+
* @param m44 Value for row 4, column 4
|
|
43
|
+
* @returns The updated ThinMatrix instance
|
|
44
|
+
*/
|
|
45
|
+
setValues(m11: number, m12: number, m13: number, m14: number, m21: number, m22: number, m23: number, m24: number, m31: number, m32: number, m33: number, m34: number, m41: number, m42: number, m43: number, m44: number): ThinMatrix;
|
|
46
|
+
/**
|
|
47
|
+
* Set the matrix to an identity matrix.
|
|
48
|
+
* @returns The updated ThinMatrix instance
|
|
49
|
+
*/
|
|
50
|
+
identity(): ThinMatrix;
|
|
51
|
+
/**
|
|
52
|
+
* Stores a left-handed orthographic projection into a given matrix
|
|
53
|
+
* @param left defines the viewport left coordinate
|
|
54
|
+
* @param right defines the viewport right coordinate
|
|
55
|
+
* @param bottom defines the viewport bottom coordinate
|
|
56
|
+
* @param top defines the viewport top coordinate
|
|
57
|
+
* @param znear defines the near clip plane
|
|
58
|
+
* @param zfar defines the far clip plane
|
|
59
|
+
* @returns The updated ThinMatrix instance
|
|
60
|
+
*/
|
|
61
|
+
orthoOffCenterLeftHanded(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): ThinMatrix;
|
|
62
|
+
/**
|
|
63
|
+
* Sets a matrix to a value composed by merging scale (vector2), rotation (roll around z) and translation (vector2)
|
|
64
|
+
* This only updates the parts of the matrix that are used for 2D transformations.
|
|
65
|
+
* @param scale defines the scale vector
|
|
66
|
+
* @param roll defines the rotation around z
|
|
67
|
+
* @param translation defines the translation vector
|
|
68
|
+
* @returns the updated ThinMatrix instance
|
|
69
|
+
*/
|
|
70
|
+
compose(scale: IVector2Like, roll: number, translation: IVector2Like): ThinMatrix;
|
|
71
|
+
/**
|
|
72
|
+
* Sets the current matrix with the multiplication result of the current Matrix and the given one
|
|
73
|
+
* This only updates the parts of the matrix that are used for 2D transformations.
|
|
74
|
+
* @param other defines the second operand
|
|
75
|
+
* @param output the matrix to store the result in
|
|
76
|
+
* @returns the current matrix
|
|
77
|
+
*/
|
|
78
|
+
multiplyToRef(other: ThinMatrix, output: ThinMatrix): ThinMatrix;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the matrix data array.
|
|
81
|
+
* @returns The matrix data
|
|
82
|
+
*/
|
|
83
|
+
asArray(): Tuple<number, 16>;
|
|
84
|
+
/**
|
|
85
|
+
* Decomposes the matrix into scale, rotation, and translation.
|
|
86
|
+
* @param scale Scale vector to store the scale values
|
|
87
|
+
* @param translation Translation vector to store the translation values
|
|
88
|
+
* @returns The rotation in radians
|
|
89
|
+
*/
|
|
90
|
+
decompose(scale: IVector2Like, translation: IVector2Like): number;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../../dev/lottiePlayer/src/maths/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,2CAA6B;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,iCAAmB;AAExC;;;;;GAKG;AACH,qBAAa,UAAW,YAAW,WAAW;IAC1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAK;IAErC;;;;OAIG;IACI,UAAU,SAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IAErC;;OAEG;;IAKH;;;;;;;;;;;;;;;;;;;OAmBG;IACI,SAAS,CACZ,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACZ,UAAU;IAwBb;;;OAGG;IACI,QAAQ,IAAI,UAAU;IAM7B;;;;;;;;;OASG;IACI,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU;IAgBlI;;;;;;;OAOG;IACI,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,GAAG,UAAU;IA0BxF;;;;;;OAMG;IACI,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU;IA8BvE;;;OAGG;IACI,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;IAInC;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,GAAG,MAAM;CAmB3E"}
|
package/maths/matrix.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a Babylon.js thin version of a Matrix
|
|
3
|
+
* We are only exposing what we truly need in the scope of
|
|
4
|
+
* the Lottie Renderer project preventing the dependency on the full
|
|
5
|
+
* Babylon.js math system.
|
|
6
|
+
*/
|
|
7
|
+
export class ThinMatrix {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new ThinMatrix instance.
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
/**
|
|
13
|
+
* Current update flag used to know whether a Matrix has changed since previous render or not.
|
|
14
|
+
* This helps identifying if a Matrix needs to be
|
|
15
|
+
* uploaded to a shader program.
|
|
16
|
+
*/
|
|
17
|
+
this.updateFlag = -1;
|
|
18
|
+
this._data = new Float32Array(16);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set the matrix values.
|
|
22
|
+
* @param m11 Value for row 1, column 1
|
|
23
|
+
* @param m12 Value for row 1, column 2
|
|
24
|
+
* @param m13 Value for row 1, column 3
|
|
25
|
+
* @param m14 Value for row 1, column 4
|
|
26
|
+
* @param m21 Value for row 2, column 1
|
|
27
|
+
* @param m22 Value for row 2, column 2
|
|
28
|
+
* @param m23 Value for row 2, column 3
|
|
29
|
+
* @param m24 Value for row 2, column 4
|
|
30
|
+
* @param m31 Value for row 3, column 1
|
|
31
|
+
* @param m32 Value for row 3, column 2
|
|
32
|
+
* @param m33 Value for row 3, column 3
|
|
33
|
+
* @param m34 Value for row 3, column 4
|
|
34
|
+
* @param m41 Value for row 4, column 1
|
|
35
|
+
* @param m42 Value for row 4, column 2
|
|
36
|
+
* @param m43 Value for row 4, column 3
|
|
37
|
+
* @param m44 Value for row 4, column 4
|
|
38
|
+
* @returns The updated ThinMatrix instance
|
|
39
|
+
*/
|
|
40
|
+
setValues(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) {
|
|
41
|
+
const m = this._data;
|
|
42
|
+
m[0] = m11;
|
|
43
|
+
m[1] = m12;
|
|
44
|
+
m[2] = m13;
|
|
45
|
+
m[3] = m14;
|
|
46
|
+
m[4] = m21;
|
|
47
|
+
m[5] = m22;
|
|
48
|
+
m[6] = m23;
|
|
49
|
+
m[7] = m24;
|
|
50
|
+
m[8] = m31;
|
|
51
|
+
m[9] = m32;
|
|
52
|
+
m[10] = m33;
|
|
53
|
+
m[11] = m34;
|
|
54
|
+
m[12] = m41;
|
|
55
|
+
m[13] = m42;
|
|
56
|
+
m[14] = m43;
|
|
57
|
+
m[15] = m44;
|
|
58
|
+
this.updateFlag = ThinMatrix._UPDATE_FLAG_SEED++;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Set the matrix to an identity matrix.
|
|
63
|
+
* @returns The updated ThinMatrix instance
|
|
64
|
+
*/
|
|
65
|
+
identity() {
|
|
66
|
+
this.setValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Stores a left-handed orthographic projection into a given matrix
|
|
71
|
+
* @param left defines the viewport left coordinate
|
|
72
|
+
* @param right defines the viewport right coordinate
|
|
73
|
+
* @param bottom defines the viewport bottom coordinate
|
|
74
|
+
* @param top defines the viewport top coordinate
|
|
75
|
+
* @param znear defines the near clip plane
|
|
76
|
+
* @param zfar defines the far clip plane
|
|
77
|
+
* @returns The updated ThinMatrix instance
|
|
78
|
+
*/
|
|
79
|
+
orthoOffCenterLeftHanded(left, right, bottom, top, znear, zfar) {
|
|
80
|
+
const n = znear;
|
|
81
|
+
const f = zfar;
|
|
82
|
+
const a = 2.0 / (right - left);
|
|
83
|
+
const b = 2.0 / (top - bottom);
|
|
84
|
+
const c = 2.0 / (f - n);
|
|
85
|
+
const d = -(f + n) / (f - n);
|
|
86
|
+
const i0 = (left + right) / (left - right);
|
|
87
|
+
const i1 = (top + bottom) / (bottom - top);
|
|
88
|
+
this.setValues(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, i0, i1, d, 1.0);
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Sets a matrix to a value composed by merging scale (vector2), rotation (roll around z) and translation (vector2)
|
|
93
|
+
* This only updates the parts of the matrix that are used for 2D transformations.
|
|
94
|
+
* @param scale defines the scale vector
|
|
95
|
+
* @param roll defines the rotation around z
|
|
96
|
+
* @param translation defines the translation vector
|
|
97
|
+
* @returns the updated ThinMatrix instance
|
|
98
|
+
*/
|
|
99
|
+
compose(scale, roll, translation) {
|
|
100
|
+
// Produces a quaternion from Euler angles in the z-y-x orientation (Tait-Bryan angles)
|
|
101
|
+
const halfRoll = roll * 0.5;
|
|
102
|
+
const z = Math.sin(halfRoll), w = Math.cos(halfRoll);
|
|
103
|
+
const z2 = z + z;
|
|
104
|
+
const zz = z * z2;
|
|
105
|
+
const wz = w * z2;
|
|
106
|
+
const sx = scale.x, sy = scale.y;
|
|
107
|
+
const m = this._data;
|
|
108
|
+
m[0] = (1 - zz) * sx;
|
|
109
|
+
m[1] = wz * sx;
|
|
110
|
+
m[4] = -wz * sy;
|
|
111
|
+
m[5] = (1 - zz) * sy;
|
|
112
|
+
m[12] = translation.x;
|
|
113
|
+
m[13] = translation.y;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Sets the current matrix with the multiplication result of the current Matrix and the given one
|
|
118
|
+
* This only updates the parts of the matrix that are used for 2D transformations.
|
|
119
|
+
* @param other defines the second operand
|
|
120
|
+
* @param output the matrix to store the result in
|
|
121
|
+
* @returns the current matrix
|
|
122
|
+
*/
|
|
123
|
+
multiplyToRef(other, output) {
|
|
124
|
+
const m = this._data;
|
|
125
|
+
const otherM = other._data;
|
|
126
|
+
// Only calculate the values we actually use (2D transform)
|
|
127
|
+
const tm0 = m[0], tm1 = m[1], tm4 = m[4], tm5 = m[5];
|
|
128
|
+
const tm12 = m[12], tm13 = m[13];
|
|
129
|
+
const om0 = otherM[0], om1 = otherM[1];
|
|
130
|
+
const om4 = otherM[4], om5 = otherM[5];
|
|
131
|
+
const om12 = otherM[12], om13 = otherM[13];
|
|
132
|
+
// Only update the 2D transformation parts
|
|
133
|
+
output._data[0] = tm0 * om0 + tm1 * om4;
|
|
134
|
+
output._data[1] = tm0 * om1 + tm1 * om5;
|
|
135
|
+
output._data[4] = tm4 * om0 + tm5 * om4;
|
|
136
|
+
output._data[5] = tm4 * om1 + tm5 * om5;
|
|
137
|
+
output._data[12] = tm12 * om0 + tm13 * om4 + om12;
|
|
138
|
+
output._data[13] = tm12 * om1 + tm13 * om5 + om13;
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns the matrix data array.
|
|
143
|
+
* @returns The matrix data
|
|
144
|
+
*/
|
|
145
|
+
asArray() {
|
|
146
|
+
return this._data;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Decomposes the matrix into scale, rotation, and translation.
|
|
150
|
+
* @param scale Scale vector to store the scale values
|
|
151
|
+
* @param translation Translation vector to store the translation values
|
|
152
|
+
* @returns The rotation in radians
|
|
153
|
+
*/
|
|
154
|
+
decompose(scale, translation) {
|
|
155
|
+
const m00 = this._data[0]; // scaleX * cos(θ)
|
|
156
|
+
const m01 = this._data[1]; // -scaleY * sin(θ)
|
|
157
|
+
const m10 = this._data[4]; // scaleX * sin(θ)
|
|
158
|
+
const m11 = this._data[5]; // scaleY * cos(θ)
|
|
159
|
+
// Extract scale
|
|
160
|
+
scale.x = Math.hypot(m00, m10); // sqrt(m00² + m10²)
|
|
161
|
+
scale.y = Math.hypot(m01, m11); // sqrt(m01² + m11²)
|
|
162
|
+
// Extract rotation (assumes uniform scaling or affine 2D)
|
|
163
|
+
const rotation = Math.atan2(m10, m00); // θ from the first column
|
|
164
|
+
// Extract the translation
|
|
165
|
+
translation.x = this._data[12];
|
|
166
|
+
translation.y = this._data[13];
|
|
167
|
+
return rotation;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Prevents global conflicts on update as shader programs are shared.
|
|
172
|
+
*/
|
|
173
|
+
ThinMatrix._UPDATE_FLAG_SEED = 0;
|
|
174
|
+
//# sourceMappingURL=matrix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrix.js","sourceRoot":"","sources":["../../../../dev/lottiePlayer/src/maths/matrix.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IAenB;;OAEG;IACH;QAZA;;;;WAIG;QACI,eAAU,GAAG,CAAC,CAAC,CAAC;QAQnB,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACI,SAAS,CACZ,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EAC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AAC,CAAC,kBAAkB;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB;QAE7C,gBAAgB;QAChB,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,oBAAoB;QACpD,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,oBAAoB;QAEpD,0DAA0D;QAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,0BAA0B;QAEjE,0BAA0B;QAC1B,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/B,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAE/B,OAAO,QAAQ,CAAC;IACpB,CAAC;;AA7ND;;GAEG;AACY,4BAAiB,GAAG,CAAC,AAAJ,CAAK"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
2
|
+
import type { AnimationConfiguration } from "./animationConfiguration.js";
|
|
3
|
+
/**
|
|
4
|
+
* Generic type representing a message sent between the main thread and the worker.
|
|
5
|
+
*/
|
|
6
|
+
export type Message = {
|
|
7
|
+
/** The type of the message. */
|
|
8
|
+
type: MessageType;
|
|
9
|
+
/** The payload of the message. */
|
|
10
|
+
payload: MessagePayload;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Message that indicates the URL of the animation to be loaded.
|
|
14
|
+
* Main thread sends to Worker
|
|
15
|
+
*/
|
|
16
|
+
export type AnimationUrlMessage = {
|
|
17
|
+
/** The type of the message. */
|
|
18
|
+
type: "animationUrl";
|
|
19
|
+
/** The payload of the message. */
|
|
20
|
+
payload: AnimationUrlMessagePayload;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Message that indicates the size of the animation.
|
|
24
|
+
* Worker sends to Main thread
|
|
25
|
+
*/
|
|
26
|
+
export type AnimationSizeMessage = {
|
|
27
|
+
/** The type of the message. */
|
|
28
|
+
type: "animationSize";
|
|
29
|
+
/** The payload of the message. */
|
|
30
|
+
payload: AnimationSizeMessagePayload;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Message that indicates to start rendering an animation.
|
|
34
|
+
* Main thread sends to Worker
|
|
35
|
+
*/
|
|
36
|
+
export type StartAnimationMessage = {
|
|
37
|
+
/** The type of the message. */
|
|
38
|
+
type: "startAnimation";
|
|
39
|
+
/** The payload of the message. */
|
|
40
|
+
payload: StartAnimationMessagePayload;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Message that indicates the container has been resized.
|
|
44
|
+
* Main thread sends to Worker
|
|
45
|
+
*/
|
|
46
|
+
export type ContainerResizeMessage = {
|
|
47
|
+
/** The type of the message. */
|
|
48
|
+
type: "containerResize";
|
|
49
|
+
/** The payload of the message. */
|
|
50
|
+
payload: ContainerResizeMessagePayload;
|
|
51
|
+
};
|
|
52
|
+
/** Payload for the "animationUrl" message type. */
|
|
53
|
+
export type AnimationUrlMessagePayload = {
|
|
54
|
+
/** The URL of the animation to be loaded. */
|
|
55
|
+
url: string;
|
|
56
|
+
};
|
|
57
|
+
/** Payload for the "animationSize" message type. */
|
|
58
|
+
export type AnimationSizeMessagePayload = {
|
|
59
|
+
/** The width of the animation. */
|
|
60
|
+
width: number;
|
|
61
|
+
/** The height of the animation. */
|
|
62
|
+
height: number;
|
|
63
|
+
};
|
|
64
|
+
/** Payload for the "startAnimation" message type. */
|
|
65
|
+
export type StartAnimationMessagePayload = {
|
|
66
|
+
/** The canvas element to render the animation on. */
|
|
67
|
+
canvas: OffscreenCanvas;
|
|
68
|
+
/** The scale in which to play the animation. */
|
|
69
|
+
scaleFactor: number;
|
|
70
|
+
/** Optional variables to replace in the animation file. */
|
|
71
|
+
variables: Nullable<Map<string, string>>;
|
|
72
|
+
/** Optional configuration object to customize the animation playback. */
|
|
73
|
+
configuration: Nullable<Partial<AnimationConfiguration>>;
|
|
74
|
+
};
|
|
75
|
+
/** Payload for the "containerResize" message type */
|
|
76
|
+
export type ContainerResizeMessagePayload = {
|
|
77
|
+
/** The new scale after the resize. */
|
|
78
|
+
scaleFactor: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Valid message types that can be sent between the main thread and the worker.
|
|
82
|
+
*/
|
|
83
|
+
export type MessageType = "animationUrl" | "animationSize" | "startAnimation" | "containerResize";
|
|
84
|
+
/**
|
|
85
|
+
* Valid payload types that can be sent between the main thread and the worker.
|
|
86
|
+
*/
|
|
87
|
+
export type MessagePayload = AnimationUrlMessagePayload | AnimationSizeMessagePayload | StartAnimationMessagePayload | ContainerResizeMessagePayload;
|
|
88
|
+
//# sourceMappingURL=messageTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../../../dev/lottiePlayer/src/messageTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,iCAAmB;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IAClB,+BAA+B;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,kCAAkC;IAClC,OAAO,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,+BAA+B;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,kCAAkC;IAClC,OAAO,EAAE,0BAA0B,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,+BAA+B;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,kCAAkC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|
package/messageTypes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageTypes.js","sourceRoot":"","sources":["../../../dev/lottiePlayer/src/messageTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ScalarProperty, Vector2Property } from "../parsing/parsedTypes.js";
|
|
2
|
+
import { Node } from "./node.js";
|
|
3
|
+
/**
|
|
4
|
+
* This represents a top node of the scenegraph in a Lottie animation.
|
|
5
|
+
* Each top level layer in Lottie is represented by a control node node.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ControlNode extends Node {
|
|
8
|
+
private _inFrame;
|
|
9
|
+
private _outFrame;
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a new control node.
|
|
12
|
+
* @param id Unique identifier for the node.
|
|
13
|
+
* @param inFrame Frame at which the node becomes active.
|
|
14
|
+
* @param outFrame Frame at which the node becomes inactive.
|
|
15
|
+
* @param position Position of the node in the scene.
|
|
16
|
+
* @param rotation Rotation of the node in degrees.
|
|
17
|
+
* @param scale Scale of the node in the scene.
|
|
18
|
+
* @param opacity Opacity of the node, from 0 to 1.
|
|
19
|
+
* @param parent Parent node in the scenegraph.
|
|
20
|
+
*/
|
|
21
|
+
constructor(id: string, inFrame: number, outFrame: number, position?: Vector2Property, rotation?: ScalarProperty, scale?: Vector2Property, opacity?: ScalarProperty, parent?: Node);
|
|
22
|
+
/**
|
|
23
|
+
* Updates the node's properties based on the current frame of the animation.
|
|
24
|
+
* This node will only be updated if the current frame is within the in and out range.
|
|
25
|
+
* @param frame Frame number we are playing in the animation.
|
|
26
|
+
* @param isParentUpdated Whether the parent node has been updated.
|
|
27
|
+
* @param isReset Whether the node is being reset.
|
|
28
|
+
* @returns True if the node was updated, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
update(frame: number, isParentUpdated?: boolean, isReset?: boolean): boolean;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=controlNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlNode.d.ts","sourceRoot":"","sources":["../../../../dev/lottiePlayer/src/nodes/controlNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;;GAGG;AACH,qBAAa,WAAY,SAAQ,IAAI;IACjC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAE1B;;;;;;;;;;OAUG;gBAEC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,eAAe,EAC1B,QAAQ,CAAC,EAAE,cAAc,EACzB,KAAK,CAAC,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,cAAc,EACxB,MAAM,CAAC,EAAE,IAAI;IASjB;;;;;;;OAOG;IACa,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,UAAQ,EAAE,OAAO,UAAQ,GAAG,OAAO;CAK3F"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Node } from "./node.js";
|
|
2
|
+
/**
|
|
3
|
+
* This represents a top node of the scenegraph in a Lottie animation.
|
|
4
|
+
* Each top level layer in Lottie is represented by a control node node.
|
|
5
|
+
*/
|
|
6
|
+
export class ControlNode extends Node {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new control node.
|
|
9
|
+
* @param id Unique identifier for the node.
|
|
10
|
+
* @param inFrame Frame at which the node becomes active.
|
|
11
|
+
* @param outFrame Frame at which the node becomes inactive.
|
|
12
|
+
* @param position Position of the node in the scene.
|
|
13
|
+
* @param rotation Rotation of the node in degrees.
|
|
14
|
+
* @param scale Scale of the node in the scene.
|
|
15
|
+
* @param opacity Opacity of the node, from 0 to 1.
|
|
16
|
+
* @param parent Parent node in the scenegraph.
|
|
17
|
+
*/
|
|
18
|
+
constructor(id, inFrame, outFrame, position, rotation, scale, opacity, parent) {
|
|
19
|
+
super(id, position, rotation, scale, opacity, parent);
|
|
20
|
+
this._inFrame = inFrame;
|
|
21
|
+
this._outFrame = outFrame;
|
|
22
|
+
this._isControl = true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Updates the node's properties based on the current frame of the animation.
|
|
26
|
+
* This node will only be updated if the current frame is within the in and out range.
|
|
27
|
+
* @param frame Frame number we are playing in the animation.
|
|
28
|
+
* @param isParentUpdated Whether the parent node has been updated.
|
|
29
|
+
* @param isReset Whether the node is being reset.
|
|
30
|
+
* @returns True if the node was updated, false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
update(frame, isParentUpdated = false, isReset = false) {
|
|
33
|
+
// Only update if the frame is within the in and out range
|
|
34
|
+
this.isVisible = frame >= this._inFrame && frame <= this._outFrame;
|
|
35
|
+
return super.update(frame, isParentUpdated, isReset);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=controlNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlNode.js","sourceRoot":"","sources":["../../../../dev/lottiePlayer/src/nodes/controlNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAI;IAIjC;;;;;;;;;;OAUG;IACH,YACI,EAAU,EACV,OAAe,EACf,QAAgB,EAChB,QAA0B,EAC1B,QAAyB,EACzB,KAAuB,EACvB,OAAwB,EACxB,MAAa;QAEb,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACa,MAAM,CAAC,KAAa,EAAE,eAAe,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK;QAC1E,0DAA0D;QAC1D,IAAI,CAAC,SAAS,GAAG,KAAK,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC;QACnE,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACJ"}
|
package/nodes/node.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { IVector2Like } from "@babylonjs/core/Maths/math.like.js";
|
|
2
|
+
import type { ScalarProperty, Vector2Property } from "../parsing/parsedTypes.js";
|
|
3
|
+
import { ThinMatrix } from "../maths/matrix.js";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a node in the scenegraph that contains the animation information from a lottie animation layer or group.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Node {
|
|
8
|
+
private readonly _id;
|
|
9
|
+
private readonly _position;
|
|
10
|
+
private readonly _rotation;
|
|
11
|
+
private readonly _scale;
|
|
12
|
+
private _worldMatrix;
|
|
13
|
+
private _localMatrix;
|
|
14
|
+
private _globalMatrix;
|
|
15
|
+
private readonly _opacity;
|
|
16
|
+
private _parent;
|
|
17
|
+
private readonly _children;
|
|
18
|
+
private _isVisible;
|
|
19
|
+
private _isAnimated;
|
|
20
|
+
private _animationsFunctions;
|
|
21
|
+
protected _isControl: boolean;
|
|
22
|
+
protected _isShape: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the id of this node.
|
|
25
|
+
* @returns The unique identifier of this node.
|
|
26
|
+
*/
|
|
27
|
+
get id(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the childer of this node.
|
|
30
|
+
* @returns An array of child nodes.
|
|
31
|
+
*/
|
|
32
|
+
get children(): Node[];
|
|
33
|
+
/**
|
|
34
|
+
* Gets whether this node is a shape.
|
|
35
|
+
* @returns True if this node is a shape, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
get isShape(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the world matrix of this node.
|
|
40
|
+
* @returns The world matrix.
|
|
41
|
+
*/
|
|
42
|
+
get worldMatrix(): ThinMatrix;
|
|
43
|
+
/**
|
|
44
|
+
* Gets whether this node is animated.
|
|
45
|
+
* @returns True if this node has animations, false otherwise.
|
|
46
|
+
*/
|
|
47
|
+
get isAnimated(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the opacity of this node.
|
|
50
|
+
* If the node is not visible, the opacity will be 0.
|
|
51
|
+
* The opacity is multiplied by the parent opacity, except if the parent is a layer, in that case it is ignored
|
|
52
|
+
* @returns The opacity of the node, from 0 to 1.
|
|
53
|
+
*/
|
|
54
|
+
get opacity(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the initial scale of this node.
|
|
57
|
+
* @returns The initial scale.
|
|
58
|
+
*/
|
|
59
|
+
get startScale(): IVector2Like;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the local position start value.
|
|
62
|
+
*/
|
|
63
|
+
get positionStart(): IVector2Like;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the local position current value.
|
|
66
|
+
*/
|
|
67
|
+
get positionCurrent(): IVector2Like;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the local rotation start value (in degrees).
|
|
70
|
+
*/
|
|
71
|
+
get rotationStart(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the local rotation current value (in degrees).
|
|
74
|
+
*/
|
|
75
|
+
get rotationCurrent(): number;
|
|
76
|
+
/**
|
|
77
|
+
* Gets the local scale start value.
|
|
78
|
+
*/
|
|
79
|
+
get scaleStart(): IVector2Like;
|
|
80
|
+
/**
|
|
81
|
+
* Gets the local scale current value.
|
|
82
|
+
*/
|
|
83
|
+
get scaleCurrent(): IVector2Like;
|
|
84
|
+
/**
|
|
85
|
+
* Gets the parent node of this node.
|
|
86
|
+
* @returns The parent node, or undefined if this is a root node.
|
|
87
|
+
*/
|
|
88
|
+
get parent(): Node | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the node visibility.
|
|
91
|
+
* @param value The new visibility value.
|
|
92
|
+
*/
|
|
93
|
+
set isVisible(value: boolean);
|
|
94
|
+
/**
|
|
95
|
+
* Constructs a new node.
|
|
96
|
+
* @param id Unique identifier for the node.
|
|
97
|
+
* @param position Position of the node in the scene.
|
|
98
|
+
* @param rotation Rotation of the node in degrees.
|
|
99
|
+
* @param scale Scale of the node in the scene.
|
|
100
|
+
* @param opacity Opacity of the node, from 0 to 1.
|
|
101
|
+
* @param parent Parent node in the scenegraph.
|
|
102
|
+
*/
|
|
103
|
+
constructor(id: string, position?: Vector2Property, rotation?: ScalarProperty, scale?: Vector2Property, opacity?: ScalarProperty, parent?: Node);
|
|
104
|
+
/**
|
|
105
|
+
* Resets the node's properties to their initial values.
|
|
106
|
+
*/
|
|
107
|
+
reset(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Updates the node's properties based on the current frame of the animation.
|
|
110
|
+
* @param frame Frame number we are playing in the animation.
|
|
111
|
+
* @param isParentUpdated Whether the parent node has been updated.
|
|
112
|
+
* @param isReset Whether the node is being reset.
|
|
113
|
+
* @returns True if the node was updated, false otherwise.
|
|
114
|
+
*/
|
|
115
|
+
update(frame: number, isParentUpdated?: boolean, isReset?: boolean): boolean;
|
|
116
|
+
private _updatePosition;
|
|
117
|
+
private _updateRotation;
|
|
118
|
+
private _updateScale;
|
|
119
|
+
private _updateOpacity;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../dev/lottiePlayer/src/nodes/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,2CAA6B;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,w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