@pixodesk/svg-animator-web 1.0.39 → 1.0.41
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 +14 -7
- package/dist/PxAnimator-yjuSFhQw.d.cts +73 -0
- package/dist/PxAnimator-yjuSFhQw.d.ts +73 -0
- package/dist/chunk-BYDBNKO7.js +42 -0
- package/dist/chunk-BYDBNKO7.js.map +1 -0
- package/dist/chunk-RK3CEIRB.min.js +1 -0
- package/dist/index.cjs +3749 -4558
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -116
- package/dist/index.d.ts +16 -116
- package/dist/index.js +3766 -4480
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.prerendered-waapi.umd.js +670 -637
- package/dist/index.prerendered-waapi.umd.js.map +1 -1
- package/dist/index.prerendered-waapi.umd.min.js +1 -1
- package/dist/index.prerendered.umd.js +762 -730
- package/dist/index.prerendered.umd.js.map +1 -1
- package/dist/index.prerendered.umd.min.js +1 -1
- package/dist/internal.cjs +33 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +25 -0
- package/dist/internal.d.ts +25 -0
- package/dist/internal.js +7 -0
- package/dist/internal.js.map +1 -0
- package/dist/internal.min.cjs +1 -0
- package/dist/internal.min.js +1 -0
- package/dist/pixodesk-svg-animator.umd.js +1172 -1173
- package/dist/pixodesk-svg-animator.umd.js.map +1 -1
- package/dist/pixodesk-svg-animator.umd.min.js +1 -1
- package/mangle-reserved.json +4 -3
- package/package.json +7 -2
|
@@ -55,579 +55,93 @@ var PixodeskAnimator = (() => {
|
|
|
55
55
|
setupAnimationTriggers: () => setupAnimationTriggers
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
// ../svg-animator-core/src/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const d = [];
|
|
67
|
-
const len = v.length;
|
|
68
|
-
d.push("M" + v[0][0] + "," + v[0][1]);
|
|
69
|
-
for (let idx = 1; idx < len; idx++) {
|
|
70
|
-
const prevV = v[idx - 1];
|
|
71
|
-
const prevO = (_a = o == null ? void 0 : o[idx - 1]) != null ? _a : prevV;
|
|
72
|
-
const currI = (_b = i == null ? void 0 : i[idx]) != null ? _b : v[idx];
|
|
73
|
-
const currV = v[idx];
|
|
74
|
-
const isLine = !forceCurves && (prevO[0] === prevV[0] && prevO[1] === prevV[1]) && (currI[0] === currV[0] && currI[1] === currV[1]);
|
|
75
|
-
if (isLine) {
|
|
76
|
-
d.push("L" + currV[0] + "," + currV[1]);
|
|
77
|
-
} else {
|
|
78
|
-
d.push("C" + prevO[0] + "," + prevO[1] + "," + currI[0] + "," + currI[1] + "," + currV[0] + "," + currV[1]);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (c && len > 0) {
|
|
82
|
-
const lastV = v[len - 1];
|
|
83
|
-
const lastO = (_c = o == null ? void 0 : o[len - 1]) != null ? _c : lastV;
|
|
84
|
-
const firstI = (_d = i == null ? void 0 : i[0]) != null ? _d : v[0];
|
|
85
|
-
const firstV = v[0];
|
|
86
|
-
const isLine = !forceCurves && (lastO[0] === lastV[0] && lastO[1] === lastV[1]) && (firstI[0] === firstV[0] && firstI[1] === firstV[1]);
|
|
87
|
-
if (!isLine) {
|
|
88
|
-
d.push("C" + lastO[0] + "," + lastO[1] + "," + firstI[0] + "," + firstI[1] + "," + firstV[0] + "," + firstV[1]);
|
|
89
|
-
}
|
|
90
|
-
d.push("z");
|
|
58
|
+
// ../svg-animator-core/src/schema/PxSchema.ts
|
|
59
|
+
var PX_UNKNOWN_KEY_ERROR = "unexpected extra key";
|
|
60
|
+
function pathStr(path) {
|
|
61
|
+
if (!path.length) return ".";
|
|
62
|
+
let result = "";
|
|
63
|
+
for (const seg of path) {
|
|
64
|
+
if (seg.startsWith("[")) result += seg;
|
|
65
|
+
else result += (result ? "." : "") + seg;
|
|
91
66
|
}
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
function interpolateNum(a, b, t) {
|
|
95
|
-
return a + (b - a) * t;
|
|
67
|
+
return result;
|
|
96
68
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
for (let i = 0; i < count; i++) {
|
|
101
|
-
res[i] = interpolateNum(a[i] || 0, b[i] || 0, t);
|
|
69
|
+
var Base = class {
|
|
70
|
+
_canSanitize(raw) {
|
|
71
|
+
return this.isValid(raw);
|
|
102
72
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
function interpolateColor(a, b, t) {
|
|
106
|
-
return [
|
|
107
|
-
interpolateNum(a[0] || 0, b[0] || 0, t),
|
|
108
|
-
interpolateNum(a[1] || 0, b[1] || 0, t),
|
|
109
|
-
interpolateNum(a[2] || 0, b[2] || 0, t),
|
|
110
|
-
interpolateNum(a[3] === void 0 ? 1 : a[3], b[3] === void 0 ? 1 : b[3], t)
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
|
-
function interpolateBeziers(paths1, paths2, progress) {
|
|
114
|
-
const count = Math.max(paths1.length, paths2.length);
|
|
115
|
-
const res = [];
|
|
116
|
-
for (let i = 0; i < count; i++) {
|
|
117
|
-
res.push(interpolateBezier(paths1[i], paths2[i], progress));
|
|
73
|
+
optional() {
|
|
74
|
+
return new Optional(this);
|
|
118
75
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const len = Math.min(path1.v.length, path2.v.length);
|
|
126
|
-
const v = [];
|
|
127
|
-
const i = [];
|
|
128
|
-
const o = [];
|
|
129
|
-
for (let idx = 0; idx < len; idx++) {
|
|
130
|
-
const v1 = path1.v[idx];
|
|
131
|
-
const v2 = path2.v[idx];
|
|
132
|
-
v.push(interpolateVec(v1, v2, t));
|
|
133
|
-
const i1 = (_b = (_a = path1.i) == null ? void 0 : _a[idx]) != null ? _b : v1;
|
|
134
|
-
const i2 = (_d = (_c = path2.i) == null ? void 0 : _c[idx]) != null ? _d : v2;
|
|
135
|
-
i.push(interpolateVec(i1, i2, t));
|
|
136
|
-
const o1 = (_f = (_e = path1.o) == null ? void 0 : _e[idx]) != null ? _f : v1;
|
|
137
|
-
const o2 = (_h = (_g = path2.o) == null ? void 0 : _g[idx]) != null ? _h : v2;
|
|
138
|
-
o.push(interpolateVec(o1, o2, t));
|
|
76
|
+
};
|
|
77
|
+
var Optional = class extends Base {
|
|
78
|
+
constructor(inner) {
|
|
79
|
+
super();
|
|
80
|
+
this.inner = inner;
|
|
81
|
+
this._default = void 0;
|
|
139
82
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (inMax === inMin) return outMin;
|
|
144
|
-
const t = (value - inMin) / (inMax - inMin);
|
|
145
|
-
return outMin + t * (outMax - outMin);
|
|
146
|
-
}
|
|
147
|
-
function solveCubicBezierX(p1x, p2x, x) {
|
|
148
|
-
if (x <= 0) return 0;
|
|
149
|
-
if (x >= 1) return 1;
|
|
150
|
-
const cx = 3 * p1x;
|
|
151
|
-
const bx = 3 * (p2x - p1x) - cx;
|
|
152
|
-
const ax = 1 - cx - bx;
|
|
153
|
-
function sampleX(t) {
|
|
154
|
-
return ((ax * t + bx) * t + cx) * t;
|
|
83
|
+
sanitize(raw) {
|
|
84
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
85
|
+
return this.inner._canSanitize(raw) ? this.inner.sanitize(raw) : void 0;
|
|
155
86
|
}
|
|
156
|
-
|
|
157
|
-
|
|
87
|
+
isValid(raw, ctx, path) {
|
|
88
|
+
if (raw === void 0 || raw === null) return true;
|
|
89
|
+
return this.inner.isValid(raw, ctx, path);
|
|
158
90
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
let t1 = 1;
|
|
162
|
-
for (let i = 0; i < 8; i++) {
|
|
163
|
-
const x2 = sampleX(t2) - x;
|
|
164
|
-
if (Math.abs(x2) < 1e-6) return t2;
|
|
165
|
-
const d2 = sampleDX(t2);
|
|
166
|
-
if (Math.abs(d2) < 1e-6) break;
|
|
167
|
-
t2 -= x2 / d2;
|
|
91
|
+
_canSanitize(raw) {
|
|
92
|
+
return raw === void 0 || raw === null || this.inner._canSanitize(raw);
|
|
168
93
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
else t1 = t2;
|
|
175
|
-
t2 = (t1 + t0) / 2;
|
|
94
|
+
};
|
|
95
|
+
var Str = class extends Base {
|
|
96
|
+
constructor(_default = "") {
|
|
97
|
+
super();
|
|
98
|
+
this._default = _default;
|
|
176
99
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
function cubicBezier(easing) {
|
|
180
|
-
const [p1x, p1y, p2x, p2y] = easing;
|
|
181
|
-
const cy = 3 * p1y;
|
|
182
|
-
const by = 3 * (p2y - p1y) - cy;
|
|
183
|
-
const ay = 1 - cy - by;
|
|
184
|
-
function sampleCurveY(t) {
|
|
185
|
-
return ((ay * t + by) * t + cy) * t;
|
|
100
|
+
sanitize(raw) {
|
|
101
|
+
return typeof raw === "string" ? raw : this._default;
|
|
186
102
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
function lerp2(a, b, t) {
|
|
192
|
-
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
193
|
-
}
|
|
194
|
-
function subdivideCubicBezier(p0, p1, p2, p3, t) {
|
|
195
|
-
const q0 = lerp2(p0, p1, t);
|
|
196
|
-
const q1 = lerp2(p1, p2, t);
|
|
197
|
-
const q2 = lerp2(p2, p3, t);
|
|
198
|
-
const r0 = lerp2(q0, q1, t);
|
|
199
|
-
const r1 = lerp2(q1, q2, t);
|
|
200
|
-
const s = lerp2(r0, r1, t);
|
|
201
|
-
return {
|
|
202
|
-
left: [p0, q0, r0, s],
|
|
203
|
-
right: [s, r1, q2, p3]
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
function splitEasing(easing, xFraction) {
|
|
207
|
-
if (!easing) return { left: void 0, right: void 0 };
|
|
208
|
-
if (xFraction <= 0) return { left: void 0, right: easing };
|
|
209
|
-
if (xFraction >= 1) return { left: easing, right: void 0 };
|
|
210
|
-
const [x1, y1, x2, y2] = easing;
|
|
211
|
-
const t = solveCubicBezierX(x1, x2, xFraction);
|
|
212
|
-
const p0 = [0, 0];
|
|
213
|
-
const p1 = [x1, y1];
|
|
214
|
-
const p2 = [x2, y2];
|
|
215
|
-
const p3 = [1, 1];
|
|
216
|
-
const { left, right } = subdivideCubicBezier(p0, p1, p2, p3, t);
|
|
217
|
-
const sx = left[3][0];
|
|
218
|
-
const sy = left[3][1];
|
|
219
|
-
let leftEasing;
|
|
220
|
-
if (sx > 1e-9 && Math.abs(sy) > 1e-9) {
|
|
221
|
-
leftEasing = [
|
|
222
|
-
left[1][0] / sx,
|
|
223
|
-
left[1][1] / sy,
|
|
224
|
-
left[2][0] / sx,
|
|
225
|
-
left[2][1] / sy
|
|
226
|
-
];
|
|
103
|
+
isValid(raw, ctx, path) {
|
|
104
|
+
if (typeof raw === "string") return true;
|
|
105
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected string, got " + typeof raw);
|
|
106
|
+
return false;
|
|
227
107
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
(right[1][0] - sx) / rx,
|
|
234
|
-
(right[1][1] - sy) / ry,
|
|
235
|
-
(right[2][0] - sx) / rx,
|
|
236
|
-
(right[2][1] - sy) / ry
|
|
237
|
-
];
|
|
108
|
+
};
|
|
109
|
+
var Num = class extends Base {
|
|
110
|
+
constructor(_default = 0) {
|
|
111
|
+
super();
|
|
112
|
+
this._default = _default;
|
|
238
113
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
function reverseEasing(easing) {
|
|
242
|
-
if (!easing) return void 0;
|
|
243
|
-
return [1 - easing[2], 1 - easing[3], 1 - easing[0], 1 - easing[1]];
|
|
244
|
-
}
|
|
245
|
-
function toRGBA(color) {
|
|
246
|
-
const r = Math.round(color[0] * 255);
|
|
247
|
-
const g = Math.round(color[1] * 255);
|
|
248
|
-
const b = Math.round(color[2] * 255);
|
|
249
|
-
return color.length === 4 ? "rgba(" + r + "," + g + "," + b + "," + color[3] + ")" : "rgb(" + r + "," + g + "," + b + ")";
|
|
250
|
-
}
|
|
251
|
-
function parseRgba(s) {
|
|
252
|
-
var _a;
|
|
253
|
-
const inner = (_a = s.match(/rgba?\((.*)\)/)) == null ? void 0 : _a[1];
|
|
254
|
-
if (!inner) throw new Error("Invalid rgb/rgba format");
|
|
255
|
-
const parts = inner.split(",").map((v) => +v.trim());
|
|
256
|
-
return [parts[0] / 255, parts[1] / 255, parts[2] / 255, ...parts[3] !== void 0 ? [parts[3]] : []];
|
|
257
|
-
}
|
|
258
|
-
function parseHex(s) {
|
|
259
|
-
const hex = s.slice(1);
|
|
260
|
-
const isShort = hex.length <= 4;
|
|
261
|
-
const r = isShort ? hex[0] + hex[0] : hex.slice(0, 2);
|
|
262
|
-
const g = isShort ? hex[1] + hex[1] : hex.slice(2, 4);
|
|
263
|
-
const b = isShort ? hex[2] + hex[2] : hex.slice(4, 6);
|
|
264
|
-
const a = hex.length === 4 ? hex[3] + hex[3] : hex.length === 8 ? hex.slice(6, 8) : null;
|
|
265
|
-
const result = [
|
|
266
|
-
parseInt(r, 16) / 255,
|
|
267
|
-
parseInt(g, 16) / 255,
|
|
268
|
-
parseInt(b, 16) / 255
|
|
269
|
-
];
|
|
270
|
-
if (a !== null) {
|
|
271
|
-
result.push(parseInt(a, 16) / 255);
|
|
114
|
+
sanitize(raw) {
|
|
115
|
+
return typeof raw === "number" && isFinite(raw) ? raw : this._default;
|
|
272
116
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (Array.isArray(s)) return s;
|
|
278
|
-
if (typeof s !== "string") return void 0;
|
|
279
|
-
if (s.startsWith("#")) {
|
|
280
|
-
return parseHex(s);
|
|
281
|
-
} else if (s.startsWith("rgb")) {
|
|
282
|
-
return parseRgba(s);
|
|
283
|
-
} else {
|
|
284
|
-
console.warn("Unsupported color format: " + s);
|
|
117
|
+
isValid(raw, ctx, path) {
|
|
118
|
+
if (typeof raw === "number" && isFinite(raw)) return true;
|
|
119
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected finite number, got " + JSON.stringify(raw));
|
|
120
|
+
return false;
|
|
285
121
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
function composeTransformParts(parts, opts) {
|
|
292
|
-
var _a;
|
|
293
|
-
if (!parts) return "";
|
|
294
|
-
const withUnits = (_a = opts == null ? void 0 : opts.withUnits) != null ? _a : true;
|
|
295
|
-
const segs = [];
|
|
296
|
-
const t = parts.translate;
|
|
297
|
-
const o = parts.origin;
|
|
298
|
-
const r = parts.rotate;
|
|
299
|
-
const k = parts.skew;
|
|
300
|
-
const s = parts.scale;
|
|
301
|
-
const tu = withUnits ? "px" : "";
|
|
302
|
-
const ru = withUnits ? "deg" : "";
|
|
303
|
-
if (t) segs.push("translate(" + t[0] + tu + "," + t[1] + tu + ")");
|
|
304
|
-
if (o) segs.push("translate(" + o[0] + tu + "," + o[1] + tu + ")");
|
|
305
|
-
if (r !== void 0 && r !== null) segs.push("rotate(" + r + ru + ")");
|
|
306
|
-
if (k !== void 0 && k !== null) segs.push("skewX(" + k + ru + ")");
|
|
307
|
-
if (s) segs.push("scale(" + s[0] + "," + s[1] + ")");
|
|
308
|
-
if (o) segs.push("translate(" + -o[0] + tu + "," + -o[1] + tu + ")");
|
|
309
|
-
return segs.join("");
|
|
310
|
-
}
|
|
311
|
-
function parseTransformParts(str) {
|
|
312
|
-
var _a, _b;
|
|
313
|
-
if (!str || typeof str !== "string") return void 0;
|
|
314
|
-
const out = {};
|
|
315
|
-
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
316
|
-
const order = ["translate", "rotate", "skewX", "scale"];
|
|
317
|
-
let lastIdx = -1;
|
|
318
|
-
let m;
|
|
319
|
-
while ((m = re.exec(str)) !== null) {
|
|
320
|
-
const fn = m[1];
|
|
321
|
-
const idx = order.indexOf(fn);
|
|
322
|
-
if (idx < 0 || idx <= lastIdx) return void 0;
|
|
323
|
-
lastIdx = idx;
|
|
324
|
-
const nums = m[2].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
325
|
-
if (nums.some((n) => Number.isNaN(n))) return void 0;
|
|
326
|
-
if (fn === "translate") {
|
|
327
|
-
if (nums.length < 1 || nums.length > 2) return void 0;
|
|
328
|
-
out.translate = [nums[0], (_a = nums[1]) != null ? _a : 0];
|
|
329
|
-
} else if (fn === "rotate") {
|
|
330
|
-
if (nums.length !== 1) return void 0;
|
|
331
|
-
out.rotate = nums[0];
|
|
332
|
-
} else if (fn === "skewX") {
|
|
333
|
-
if (nums.length !== 1) return void 0;
|
|
334
|
-
out.skew = nums[0];
|
|
335
|
-
} else {
|
|
336
|
-
if (nums.length < 1 || nums.length > 2) return void 0;
|
|
337
|
-
out.scale = [nums[0], (_b = nums[1]) != null ? _b : nums[0]];
|
|
338
|
-
}
|
|
122
|
+
};
|
|
123
|
+
var Bool = class extends Base {
|
|
124
|
+
constructor(_default = false) {
|
|
125
|
+
super();
|
|
126
|
+
this._default = _default;
|
|
339
127
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
var STYLE_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
344
|
-
var DEFAULT_DURATION_MS = 1e3;
|
|
345
|
-
function kebabToCamelCaseWord(kebab) {
|
|
346
|
-
return kebab.includes("-") ? kebab.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()) : kebab;
|
|
347
|
-
}
|
|
348
|
-
function isCamelCaseWord(word) {
|
|
349
|
-
return !word.includes("-") && /[a-z][A-Z]/.test(word);
|
|
350
|
-
}
|
|
351
|
-
var SVG_CAMEL_CASE_ATTRS = /* @__PURE__ */ new Set([
|
|
352
|
-
// Transform/positioning
|
|
353
|
-
"viewBox",
|
|
354
|
-
"preserveAspectRatio",
|
|
355
|
-
// Gradient
|
|
356
|
-
"gradientUnits",
|
|
357
|
-
"gradientTransform",
|
|
358
|
-
"spreadMethod",
|
|
359
|
-
// Pattern
|
|
360
|
-
"patternUnits",
|
|
361
|
-
"patternContentUnits",
|
|
362
|
-
"patternTransform",
|
|
363
|
-
// Clipping/masking
|
|
364
|
-
"clipPathUnits",
|
|
365
|
-
"maskUnits",
|
|
366
|
-
"maskContentUnits",
|
|
367
|
-
// Marker (SVG spec keeps these camelCase, like viewBox)
|
|
368
|
-
"markerUnits",
|
|
369
|
-
"markerWidth",
|
|
370
|
-
"markerHeight",
|
|
371
|
-
"refX",
|
|
372
|
-
"refY",
|
|
373
|
-
// Text
|
|
374
|
-
"textLength",
|
|
375
|
-
"lengthAdjust",
|
|
376
|
-
"startOffset",
|
|
377
|
-
// Filter
|
|
378
|
-
"filterUnits",
|
|
379
|
-
"primitiveUnits",
|
|
380
|
-
"tableValues",
|
|
381
|
-
// feFuncR/G/B/A transfer table (type="table")
|
|
382
|
-
"stdDeviation",
|
|
383
|
-
"baseFrequency",
|
|
384
|
-
"numOctaves",
|
|
385
|
-
"surfaceScale",
|
|
386
|
-
"diffuseConstant",
|
|
387
|
-
"specularConstant",
|
|
388
|
-
"specularExponent",
|
|
389
|
-
"kernelMatrix",
|
|
390
|
-
"kernelUnitLength",
|
|
391
|
-
"edgeMode",
|
|
392
|
-
"preserveAlpha",
|
|
393
|
-
"targetX",
|
|
394
|
-
"targetY"
|
|
395
|
-
// // Animation
|
|
396
|
-
// 'attributeName',
|
|
397
|
-
// 'attributeType',
|
|
398
|
-
// 'calcMode',
|
|
399
|
-
// 'keyTimes',
|
|
400
|
-
// 'keySplines',
|
|
401
|
-
// 'repeatCount',
|
|
402
|
-
// 'repeatDur'
|
|
403
|
-
]);
|
|
404
|
-
function camelCaseToKebabWordIfNeeded(camel) {
|
|
405
|
-
return SVG_CAMEL_CASE_ATTRS.has(camel) ? camel : camel.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
406
|
-
}
|
|
407
|
-
function clamp(value, min, max) {
|
|
408
|
-
return Math.max(min, Math.min(value, max));
|
|
409
|
-
}
|
|
410
|
-
function bezier2D_pointAt(P0, P1, P2, P3, t) {
|
|
411
|
-
if (t <= 0) return [P0[0], P0[1]];
|
|
412
|
-
if (t >= 1) return [P3[0], P3[1]];
|
|
413
|
-
const u = 1 - t;
|
|
414
|
-
const u2 = u * u;
|
|
415
|
-
const u3 = u2 * u;
|
|
416
|
-
const t2 = t * t;
|
|
417
|
-
const t3 = t2 * t;
|
|
418
|
-
const w0 = u3;
|
|
419
|
-
const w1 = 3 * t * u2;
|
|
420
|
-
const w2 = 3 * t2 * u;
|
|
421
|
-
const w3 = t3;
|
|
422
|
-
return [
|
|
423
|
-
w0 * P0[0] + w1 * P1[0] + w2 * P2[0] + w3 * P3[0],
|
|
424
|
-
w0 * P0[1] + w1 * P1[1] + w2 * P2[1] + w3 * P3[1]
|
|
425
|
-
];
|
|
426
|
-
}
|
|
427
|
-
var BEZIER_T_NUDGE = 1e-4;
|
|
428
|
-
function bezier2D_derivativeAt(P0, P1, P2, P3, t) {
|
|
429
|
-
const result = _bezier2D_derivativeAtRaw(P0, P1, P2, P3, t);
|
|
430
|
-
if (result[0] === 0 && result[1] === 0) {
|
|
431
|
-
const nudgedT = t < 0.5 ? t + BEZIER_T_NUDGE : t - BEZIER_T_NUDGE;
|
|
432
|
-
return _bezier2D_derivativeAtRaw(P0, P1, P2, P3, nudgedT);
|
|
128
|
+
sanitize(raw) {
|
|
129
|
+
return typeof raw === "boolean" ? raw : this._default;
|
|
433
130
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const a = 3 * u * u;
|
|
439
|
-
const b = 6 * t * u;
|
|
440
|
-
const c = 3 * t * t;
|
|
441
|
-
return [
|
|
442
|
-
a * (P1[0] - P0[0]) + b * (P2[0] - P1[0]) + c * (P3[0] - P2[0]),
|
|
443
|
-
a * (P1[1] - P0[1]) + b * (P2[1] - P1[1]) + c * (P3[1] - P2[1])
|
|
444
|
-
];
|
|
445
|
-
}
|
|
446
|
-
function bezier2D_arcLengthLUT(P0, P1, P2, P3, steps = 100) {
|
|
447
|
-
const n = steps + 1;
|
|
448
|
-
const ts = new Float64Array(n);
|
|
449
|
-
const ds = new Float64Array(n);
|
|
450
|
-
let prev = bezier2D_pointAt(P0, P1, P2, P3, 0);
|
|
451
|
-
ts[0] = 0;
|
|
452
|
-
ds[0] = 0;
|
|
453
|
-
let cum = 0;
|
|
454
|
-
for (let i = 1; i < n; i++) {
|
|
455
|
-
const t = i / steps;
|
|
456
|
-
const cur = bezier2D_pointAt(P0, P1, P2, P3, t);
|
|
457
|
-
const dx = cur[0] - prev[0];
|
|
458
|
-
const dy = cur[1] - prev[1];
|
|
459
|
-
cum += Math.sqrt(dx * dx + dy * dy);
|
|
460
|
-
ts[i] = t;
|
|
461
|
-
ds[i] = cum;
|
|
462
|
-
prev = cur;
|
|
131
|
+
isValid(raw, ctx, path) {
|
|
132
|
+
if (typeof raw === "boolean") return true;
|
|
133
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected boolean, got " + typeof raw);
|
|
134
|
+
return false;
|
|
463
135
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if (t >= ts[last]) return ds[last];
|
|
471
|
-
let lo = 1, hi = last;
|
|
472
|
-
while (lo < hi) {
|
|
473
|
-
const mid = lo + hi >>> 1;
|
|
474
|
-
if (ts[mid] < t) lo = mid + 1;
|
|
475
|
-
else hi = mid;
|
|
136
|
+
};
|
|
137
|
+
var Literal = class extends Base {
|
|
138
|
+
constructor(value) {
|
|
139
|
+
super();
|
|
140
|
+
this.value = value;
|
|
141
|
+
this._default = value;
|
|
476
142
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
const frac = span > 0 ? (t - tPrev) / span : 0;
|
|
480
|
-
return ds[hi - 1] + frac * (ds[hi] - ds[hi - 1]);
|
|
481
|
-
}
|
|
482
|
-
function invertEasing(easing) {
|
|
483
|
-
if (!easing) return (y) => y;
|
|
484
|
-
const flipped = [easing[1], easing[0], easing[3], easing[2]];
|
|
485
|
-
return cubicBezier(flipped);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
// ../svg-animator-core/src/playback/PxScrollMath.ts
|
|
489
|
-
function isScrollTimeline(config) {
|
|
490
|
-
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
491
|
-
}
|
|
492
|
-
function scrollTotalDurationMs(config) {
|
|
493
|
-
const duration = typeof (config == null ? void 0 : config.duration) === "number" && config.duration > 0 ? config.duration : DEFAULT_DURATION_MS;
|
|
494
|
-
const iterations = typeof (config == null ? void 0 : config.iterations) === "number" && config.iterations > 0 ? config.iterations : 1;
|
|
495
|
-
return duration * iterations;
|
|
496
|
-
}
|
|
497
|
-
function scrollPhaseInterval(phase, subjectSize, scrollportSize) {
|
|
498
|
-
const s = subjectSize, vp = scrollportSize;
|
|
499
|
-
switch (phase) {
|
|
500
|
-
case "cover":
|
|
501
|
-
return [0, s + vp];
|
|
502
|
-
case "entry":
|
|
503
|
-
return [0, Math.min(s, vp)];
|
|
504
|
-
case "contain":
|
|
505
|
-
return [Math.min(s, vp), Math.max(s, vp)];
|
|
506
|
-
case "exit":
|
|
507
|
-
return [Math.max(s, vp), s + vp];
|
|
508
|
-
case "entry-crossing":
|
|
509
|
-
return [0, s];
|
|
510
|
-
case "exit-crossing":
|
|
511
|
-
return [vp, s + vp];
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
var DEFAULT_PHASE = "cover";
|
|
515
|
-
function resolveRangePointU(point, defaultFraction, subjectSize, scrollportSize) {
|
|
516
|
-
var _a;
|
|
517
|
-
const [u0, u1] = scrollPhaseInterval((_a = point == null ? void 0 : point.phase) != null ? _a : DEFAULT_PHASE, subjectSize, scrollportSize);
|
|
518
|
-
const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
|
|
519
|
-
return u0 + fraction * (u1 - u0);
|
|
520
|
-
}
|
|
521
|
-
function scrollViewProgress(subjectStart, subjectSize, scrollportSize, range) {
|
|
522
|
-
const u = scrollportSize - subjectStart;
|
|
523
|
-
const uStart = resolveRangePointU(range == null ? void 0 : range.start, 0, subjectSize, scrollportSize);
|
|
524
|
-
const uEnd = resolveRangePointU(range == null ? void 0 : range.end, 1, subjectSize, scrollportSize);
|
|
525
|
-
if (uEnd <= uStart) return u >= uEnd ? 1 : 0;
|
|
526
|
-
return clamp((u - uStart) / (uEnd - uStart), 0, 1);
|
|
527
|
-
}
|
|
528
|
-
function scrollOffsetProgress(offset, maxOffset, range) {
|
|
529
|
-
var _a, _b;
|
|
530
|
-
const raw = maxOffset > 0 ? clamp(offset / maxOffset, 0, 1) : 1;
|
|
531
|
-
const start = typeof ((_a = range == null ? void 0 : range.start) == null ? void 0 : _a.fraction) === "number" ? range.start.fraction : 0;
|
|
532
|
-
const end = typeof ((_b = range == null ? void 0 : range.end) == null ? void 0 : _b.fraction) === "number" ? range.end.fraction : 1;
|
|
533
|
-
if (end <= start) return raw >= end ? 1 : 0;
|
|
534
|
-
return clamp((raw - start) / (end - start), 0, 1);
|
|
535
|
-
}
|
|
536
|
-
function scrollResolveAxis(axis, writingMode) {
|
|
537
|
-
const a = axis != null ? axis : "block";
|
|
538
|
-
if (a === "x" || a === "y") return a;
|
|
539
|
-
const vertical = !!writingMode && writingMode.startsWith("vertical");
|
|
540
|
-
if (a === "inline") return vertical ? "y" : "x";
|
|
541
|
-
return vertical ? "x" : "y";
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// ../svg-animator-core/src/schema/PxSchema.ts
|
|
545
|
-
var PX_UNKNOWN_KEY_ERROR = "unexpected extra key";
|
|
546
|
-
function pathStr(path) {
|
|
547
|
-
if (!path.length) return ".";
|
|
548
|
-
let result = "";
|
|
549
|
-
for (const seg of path) {
|
|
550
|
-
if (seg.startsWith("[")) result += seg;
|
|
551
|
-
else result += (result ? "." : "") + seg;
|
|
552
|
-
}
|
|
553
|
-
return result;
|
|
554
|
-
}
|
|
555
|
-
var Base = class {
|
|
556
|
-
_canSanitize(raw) {
|
|
557
|
-
return this.isValid(raw);
|
|
558
|
-
}
|
|
559
|
-
optional() {
|
|
560
|
-
return new Optional(this);
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
var Optional = class extends Base {
|
|
564
|
-
constructor(inner) {
|
|
565
|
-
super();
|
|
566
|
-
this.inner = inner;
|
|
567
|
-
this._default = void 0;
|
|
568
|
-
}
|
|
569
|
-
sanitize(raw) {
|
|
570
|
-
if (raw === void 0 || raw === null) return void 0;
|
|
571
|
-
return this.inner._canSanitize(raw) ? this.inner.sanitize(raw) : void 0;
|
|
572
|
-
}
|
|
573
|
-
isValid(raw, ctx, path) {
|
|
574
|
-
if (raw === void 0 || raw === null) return true;
|
|
575
|
-
return this.inner.isValid(raw, ctx, path);
|
|
576
|
-
}
|
|
577
|
-
_canSanitize(raw) {
|
|
578
|
-
return raw === void 0 || raw === null || this.inner._canSanitize(raw);
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
var Str = class extends Base {
|
|
582
|
-
constructor(_default = "") {
|
|
583
|
-
super();
|
|
584
|
-
this._default = _default;
|
|
585
|
-
}
|
|
586
|
-
sanitize(raw) {
|
|
587
|
-
return typeof raw === "string" ? raw : this._default;
|
|
588
|
-
}
|
|
589
|
-
isValid(raw, ctx, path) {
|
|
590
|
-
if (typeof raw === "string") return true;
|
|
591
|
-
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected string, got " + typeof raw);
|
|
592
|
-
return false;
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
var Num = class extends Base {
|
|
596
|
-
constructor(_default = 0) {
|
|
597
|
-
super();
|
|
598
|
-
this._default = _default;
|
|
599
|
-
}
|
|
600
|
-
sanitize(raw) {
|
|
601
|
-
return typeof raw === "number" && isFinite(raw) ? raw : this._default;
|
|
602
|
-
}
|
|
603
|
-
isValid(raw, ctx, path) {
|
|
604
|
-
if (typeof raw === "number" && isFinite(raw)) return true;
|
|
605
|
-
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected finite number, got " + JSON.stringify(raw));
|
|
606
|
-
return false;
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
var Bool = class extends Base {
|
|
610
|
-
constructor(_default = false) {
|
|
611
|
-
super();
|
|
612
|
-
this._default = _default;
|
|
613
|
-
}
|
|
614
|
-
sanitize(raw) {
|
|
615
|
-
return typeof raw === "boolean" ? raw : this._default;
|
|
616
|
-
}
|
|
617
|
-
isValid(raw, ctx, path) {
|
|
618
|
-
if (typeof raw === "boolean") return true;
|
|
619
|
-
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected boolean, got " + typeof raw);
|
|
620
|
-
return false;
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
var Literal = class extends Base {
|
|
624
|
-
constructor(value) {
|
|
625
|
-
super();
|
|
626
|
-
this.value = value;
|
|
627
|
-
this._default = value;
|
|
628
|
-
}
|
|
629
|
-
sanitize(raw) {
|
|
630
|
-
return raw === this.value ? this.value : this._default;
|
|
143
|
+
sanitize(raw) {
|
|
144
|
+
return raw === this.value ? this.value : this._default;
|
|
631
145
|
}
|
|
632
146
|
isValid(raw, ctx, path) {
|
|
633
147
|
if (raw === this.value) return true;
|
|
@@ -1031,7 +545,7 @@ var PixodeskAnimator = (() => {
|
|
|
1031
545
|
* The base can be the result of px.object() or px.openObject() — anything with a _shape property.
|
|
1032
546
|
*
|
|
1033
547
|
* @example
|
|
1034
|
-
* const PxSvgNodeSchema = px.extendedObject(
|
|
548
|
+
* const PxSvgNodeSchema = px.extendedObject(PxNodeBaseSchema, { width: px.number().optional() });
|
|
1035
549
|
*/
|
|
1036
550
|
extendedObject: (base, extra) => new Obj(__spreadValues(__spreadValues({}, base._shape), extra)),
|
|
1037
551
|
/** Array whose unrecoverable items are filtered out. Default: []. */
|
|
@@ -1123,14 +637,14 @@ var PixodeskAnimator = (() => {
|
|
|
1123
637
|
native: "native",
|
|
1124
638
|
js: "js"
|
|
1125
639
|
};
|
|
1126
|
-
var
|
|
640
|
+
var PxTimelineEngineSetting = __spreadProps(__spreadValues({}, PxTimelineEngine), {
|
|
1127
641
|
auto: "auto"
|
|
1128
642
|
});
|
|
1129
643
|
function isNativeForced(engine) {
|
|
1130
|
-
return engine ===
|
|
644
|
+
return engine === PxTimelineEngineSetting.native;
|
|
1131
645
|
}
|
|
1132
646
|
function mayUseNativeScrollTimeline(engine) {
|
|
1133
|
-
return engine !==
|
|
647
|
+
return engine !== PxTimelineEngineSetting.js;
|
|
1134
648
|
}
|
|
1135
649
|
var PX_TRIGGER_DEFAULTS = {
|
|
1136
650
|
startOn: "load",
|
|
@@ -1272,7 +786,7 @@ var PixodeskAnimator = (() => {
|
|
|
1272
786
|
flattenMemo.set(cfg, flat);
|
|
1273
787
|
return flat;
|
|
1274
788
|
}
|
|
1275
|
-
function
|
|
789
|
+
function getDefinitions(doc) {
|
|
1276
790
|
var _a;
|
|
1277
791
|
if (!doc) return void 0;
|
|
1278
792
|
return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
|
|
@@ -1280,9 +794,7 @@ var PixodeskAnimator = (() => {
|
|
|
1280
794
|
function getBindings(doc) {
|
|
1281
795
|
var _a;
|
|
1282
796
|
if (!doc) return void 0;
|
|
1283
|
-
|
|
1284
|
-
if (!animateById) return void 0;
|
|
1285
|
-
return Object.entries(animateById).map(([id, anim]) => ({ id: id.startsWith("#") ? id.slice(1) : id, animate: anim }));
|
|
797
|
+
return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.bindings;
|
|
1286
798
|
}
|
|
1287
799
|
|
|
1288
800
|
// ../svg-animator-core/src/format/PxAnimatorTypes.ts
|
|
@@ -1317,20 +829,20 @@ var PixodeskAnimator = (() => {
|
|
|
1317
829
|
// its internal COPY-PASTE payload, which never validates against this schema.)
|
|
1318
830
|
}));
|
|
1319
831
|
var anyKf = (kf) => kf;
|
|
1320
|
-
var
|
|
832
|
+
var keyframeTime = (kf) => {
|
|
1321
833
|
var _a, _b;
|
|
1322
834
|
return (_b = (_a = anyKf(kf).time) != null ? _a : anyKf(kf).t) != null ? _b : 0;
|
|
1323
835
|
};
|
|
1324
|
-
var
|
|
836
|
+
var keyframeValue = (kf) => {
|
|
1325
837
|
var _a;
|
|
1326
838
|
return (_a = anyKf(kf).value) != null ? _a : anyKf(kf).v;
|
|
1327
839
|
};
|
|
1328
|
-
var
|
|
840
|
+
var keyframeEasing = (kf) => {
|
|
1329
841
|
var _a;
|
|
1330
842
|
return (_a = anyKf(kf).easing) != null ? _a : anyKf(kf).e;
|
|
1331
843
|
};
|
|
1332
|
-
var
|
|
1333
|
-
var
|
|
844
|
+
var keyframeTangentIn = (kf) => anyKf(kf).tangentIn;
|
|
845
|
+
var keyframeTangentOut = (kf) => anyKf(kf).tangentOut;
|
|
1334
846
|
var PxLoopSchema = implementsInterface()(px.object({
|
|
1335
847
|
segmentCount: px.number().optional(),
|
|
1336
848
|
repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
|
|
@@ -1384,12 +896,9 @@ var PixodeskAnimator = (() => {
|
|
|
1384
896
|
unitsPerEm: px.number(),
|
|
1385
897
|
glyphs: px.record(PxGlyphSchema)
|
|
1386
898
|
}));
|
|
1387
|
-
var
|
|
899
|
+
var PxDefinitionsSchema = implementsInterface()(px.object({
|
|
1388
900
|
easings: px.record(px.tuple([px.number(), px.number(), px.number(), px.number()])).optional(),
|
|
1389
901
|
animations: px.record(PxAnimationDefinitionSchema).optional(),
|
|
1390
|
-
// Review §2.6: the schema now matches the declared type — a style preset is a flat
|
|
1391
|
-
// record of string|number attribute values, nothing nested.
|
|
1392
|
-
styles: px.record(px.record(px.union([px.string(), px.number()]))).optional(),
|
|
1393
902
|
fonts: px.record(PxGlyphFontSchema).optional()
|
|
1394
903
|
}));
|
|
1395
904
|
var PxScrollRangePointSchema = implementsInterface()(px.object({
|
|
@@ -1425,7 +934,7 @@ var PixodeskAnimator = (() => {
|
|
|
1425
934
|
offset: px.number().optional(),
|
|
1426
935
|
distance: px.number().optional()
|
|
1427
936
|
}));
|
|
1428
|
-
var PxTimelineEngineSchema = px.enum([
|
|
937
|
+
var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js]).optional();
|
|
1429
938
|
var PxTimeTimelineSchema = implementsInterface()(px.object({
|
|
1430
939
|
type: px.literal("time").optional(),
|
|
1431
940
|
engine: PxTimelineEngineSchema,
|
|
@@ -1470,22 +979,22 @@ var PixodeskAnimator = (() => {
|
|
|
1470
979
|
PxScrollTimelineSchema,
|
|
1471
980
|
PxViewTimelineSchema
|
|
1472
981
|
]);
|
|
982
|
+
var PxBindingSchema = implementsInterface()(px.object({
|
|
983
|
+
target: px.string(),
|
|
984
|
+
animateWith: px.array(px.string())
|
|
985
|
+
}));
|
|
1473
986
|
var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
1474
987
|
// (`mode`, `duration` and `frameRate` live INSIDE `timeline` on the wire — §2.8; they exist
|
|
1475
988
|
// at this level only on the runtime view, like the rest of the playback dynamics.)
|
|
1476
989
|
// THE spelling of "what advances progress" — clock / scroll / view (review §2.1).
|
|
1477
990
|
timeline: PxTimelineSchema.optional(),
|
|
1478
|
-
definitions:
|
|
1479
|
-
|
|
991
|
+
definitions: PxDefinitionsSchema.optional(),
|
|
992
|
+
bindings: px.array(PxBindingSchema).optional(),
|
|
1480
993
|
debugGlobalName: px.string().optional(),
|
|
1481
994
|
// Declared HERE because this is a closed object: an undeclared key would be stripped by
|
|
1482
995
|
// `sanitize` and flagged by strict validation on our own files.
|
|
1483
996
|
version: px.string().optional()
|
|
1484
997
|
}));
|
|
1485
|
-
var PxBindingSchema = implementsInterface()(px.object({
|
|
1486
|
-
id: px.string(),
|
|
1487
|
-
animate: PxElementAnimationSchema
|
|
1488
|
-
}));
|
|
1489
998
|
var PxAttrValueSchema = px.union([
|
|
1490
999
|
px.string(),
|
|
1491
1000
|
px.number(),
|
|
@@ -1567,102 +1076,532 @@ var PixodeskAnimator = (() => {
|
|
|
1567
1076
|
px.object({ value: px.array(PxGradientStopSchema) }),
|
|
1568
1077
|
PxPropertyAnimationSchema
|
|
1569
1078
|
]);
|
|
1570
|
-
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
1571
|
-
// Contextual kind — the `type` convention, see `
|
|
1572
|
-
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
1573
|
-
start: PxAnimatableVec2Schema.optional(),
|
|
1574
|
-
end: PxAnimatableVec2Schema.optional(),
|
|
1575
|
-
center: PxAnimatableVec2Schema.optional(),
|
|
1576
|
-
radius: PxAnimatableNumberSchema.optional(),
|
|
1577
|
-
focal: PxAnimatableVec2Schema.optional(),
|
|
1578
|
-
stops: PxAnimatableGradientStopsSchema.optional(),
|
|
1579
|
-
gradientUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
1580
|
-
spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat]).optional(),
|
|
1581
|
-
gradientTransform: px.string().optional()
|
|
1582
|
-
}));
|
|
1583
|
-
var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
|
|
1584
|
-
var PxTextPathEffectSchema = implementsInterface()(px.object({
|
|
1585
|
-
pathData: px.string(),
|
|
1586
|
-
pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
|
|
1587
|
-
lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
|
|
1588
|
-
method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
|
|
1589
|
-
spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact]).optional(),
|
|
1590
|
-
startOffset: PxAnimatableNumberSchema.optional(),
|
|
1591
|
-
textLength: PxAnimatableNumberSchema.optional()
|
|
1592
|
-
}));
|
|
1593
|
-
var PxTextEffectSchema = implementsInterface()(px.object({
|
|
1594
|
-
useGlyphs: px.boolean().optional()
|
|
1595
|
-
}));
|
|
1596
|
-
var PxEffectsSchema = implementsInterface()(px.object({
|
|
1597
|
-
transformBy: PxTransformByEffectSchema.optional(),
|
|
1598
|
-
repeater: PxRepeaterEffectSchema.optional(),
|
|
1599
|
-
maskedBy: PxMaskedByEffectSchema.optional(),
|
|
1600
|
-
clipPath: PxClipPathEffectSchema.optional(),
|
|
1601
|
-
strokeTrim: PxStrokeTrimEffectSchema.optional(),
|
|
1602
|
-
clone: PxCloneEffectSchema.optional(),
|
|
1603
|
-
fillGradient: PxFillGradientEffectSchema.optional(),
|
|
1604
|
-
strokeGradient: PxStrokeGradientEffectSchema.optional(),
|
|
1605
|
-
textPath: PxTextPathEffectSchema.optional(),
|
|
1606
|
-
text: PxTextEffectSchema.optional()
|
|
1607
|
-
}));
|
|
1608
|
-
var
|
|
1609
|
-
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
1610
|
-
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
1611
|
-
// (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
|
|
1612
|
-
// `fillGradient.type`, editor `preset.type`). Each sits in its own object, so
|
|
1613
|
-
// the carrier disambiguates completely; synonyms (`cloneKind`, `presetShape`)
|
|
1614
|
-
// would add words that all mean "type" and still need the carrier to read.
|
|
1615
|
-
// Guarding a `type` SLOT against a wrong VALUE is the job of strict enums
|
|
1616
|
-
// (issues V3), never of distinct key names.
|
|
1617
|
-
type: px.string(),
|
|
1618
|
-
// The escape hatch for elements that carry a REAL `type` attribute — `<feTurbulence
|
|
1619
|
-
// type="fractalNoise">`, `<feFuncR type="table">`, `<feColorMatrix type="saturate">`.
|
|
1620
|
-
// `type` is taken by the tag name, so the attribute travels here and the renderer puts
|
|
1621
|
-
// it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
|
|
1622
|
-
// documented — because a wire key that is not in a schema is invisible to the
|
|
1623
|
-
// minifier's reserve list and gets renamed (
|
|
1624
|
-
domType: px.string().optional(),
|
|
1625
|
-
// Text content of a `<text>` / `<tspan>`. Declared, so a non-string value is a schema error
|
|
1626
|
-
// and the minifier reserves the key; `text` is NOT an alias for it and is not read anywhere.
|
|
1627
|
-
textContent: px.string().optional(),
|
|
1628
|
-
id: px.string().optional(),
|
|
1629
|
-
meta: px.any().optional(),
|
|
1630
|
-
// Player-effects bucket emitted by the Editor's lightweight design format.
|
|
1631
|
-
// Consumed and removed by `
|
|
1632
|
-
// (see `createAnimatorImpl`), so downstream code never sees it.
|
|
1633
|
-
effects: PxEffectsSchema.optional(),
|
|
1634
|
-
// `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
|
|
1635
|
-
// string ref / array of refs / inline definition / mixed array; mirrors
|
|
1636
|
-
// `
|
|
1637
|
-
animate: PxElementAnimationSchema.optional(),
|
|
1638
|
-
style: px.
|
|
1639
|
-
}, PxAttrValueSchema);
|
|
1640
|
-
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({},
|
|
1641
|
-
children: px.lazy(() => px.array(PxNodeSchema), []).optional()
|
|
1642
|
-
}), PxAttrValueSchema);
|
|
1643
|
-
var
|
|
1644
|
-
// `"100%"` and other SVG length strings are legal here — a number-only slot rejected
|
|
1645
|
-
// real documents (e.g. apple-store-look-14-main.json) at the root <svg>.
|
|
1646
|
-
width: px.union([px.number(), px.string()]).optional(),
|
|
1647
|
-
height: px.union([px.number(), px.string()]).optional(),
|
|
1648
|
-
viewBox: px.string().optional(),
|
|
1649
|
-
animator: PxAnimatorConfigSchema.optional()
|
|
1650
|
-
});
|
|
1651
|
-
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({},
|
|
1652
|
-
type: px.literal("svg"),
|
|
1653
|
-
// override string → literal to require 'svg'
|
|
1654
|
-
children: px.array(PxNodeSchema).optional()
|
|
1655
|
-
}), PxAttrValueSchema);
|
|
1656
|
-
var PxBezierPathSchema = implementsInterface()(px.object({
|
|
1657
|
-
v: px.array(px.array(px.number())),
|
|
1658
|
-
i: px.array(px.array(px.number())).optional(),
|
|
1659
|
-
o: px.array(px.array(px.number())).optional(),
|
|
1660
|
-
c: px.boolean().optional()
|
|
1661
|
-
}));
|
|
1079
|
+
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
1080
|
+
// Contextual kind — the `type` convention, see `PxNodeBaseSchema.type`.
|
|
1081
|
+
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
1082
|
+
start: PxAnimatableVec2Schema.optional(),
|
|
1083
|
+
end: PxAnimatableVec2Schema.optional(),
|
|
1084
|
+
center: PxAnimatableVec2Schema.optional(),
|
|
1085
|
+
radius: PxAnimatableNumberSchema.optional(),
|
|
1086
|
+
focal: PxAnimatableVec2Schema.optional(),
|
|
1087
|
+
stops: PxAnimatableGradientStopsSchema.optional(),
|
|
1088
|
+
gradientUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
1089
|
+
spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat]).optional(),
|
|
1090
|
+
gradientTransform: px.string().optional()
|
|
1091
|
+
}));
|
|
1092
|
+
var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
|
|
1093
|
+
var PxTextPathEffectSchema = implementsInterface()(px.object({
|
|
1094
|
+
pathData: px.string(),
|
|
1095
|
+
pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
|
|
1096
|
+
lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
|
|
1097
|
+
method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
|
|
1098
|
+
spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact]).optional(),
|
|
1099
|
+
startOffset: PxAnimatableNumberSchema.optional(),
|
|
1100
|
+
textLength: PxAnimatableNumberSchema.optional()
|
|
1101
|
+
}));
|
|
1102
|
+
var PxTextEffectSchema = implementsInterface()(px.object({
|
|
1103
|
+
useGlyphs: px.boolean().optional()
|
|
1104
|
+
}));
|
|
1105
|
+
var PxEffectsSchema = implementsInterface()(px.object({
|
|
1106
|
+
transformBy: PxTransformByEffectSchema.optional(),
|
|
1107
|
+
repeater: PxRepeaterEffectSchema.optional(),
|
|
1108
|
+
maskedBy: PxMaskedByEffectSchema.optional(),
|
|
1109
|
+
clipPath: PxClipPathEffectSchema.optional(),
|
|
1110
|
+
strokeTrim: PxStrokeTrimEffectSchema.optional(),
|
|
1111
|
+
clone: PxCloneEffectSchema.optional(),
|
|
1112
|
+
fillGradient: PxFillGradientEffectSchema.optional(),
|
|
1113
|
+
strokeGradient: PxStrokeGradientEffectSchema.optional(),
|
|
1114
|
+
textPath: PxTextPathEffectSchema.optional(),
|
|
1115
|
+
text: PxTextEffectSchema.optional()
|
|
1116
|
+
}));
|
|
1117
|
+
var PxNodeBaseSchema = px.openObject({
|
|
1118
|
+
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
1119
|
+
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
1120
|
+
// (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
|
|
1121
|
+
// `fillGradient.type`, editor `preset.type`). Each sits in its own object, so
|
|
1122
|
+
// the carrier disambiguates completely; synonyms (`cloneKind`, `presetShape`)
|
|
1123
|
+
// would add words that all mean "type" and still need the carrier to read.
|
|
1124
|
+
// Guarding a `type` SLOT against a wrong VALUE is the job of strict enums
|
|
1125
|
+
// (issues V3), never of distinct key names.
|
|
1126
|
+
type: px.string(),
|
|
1127
|
+
// The escape hatch for elements that carry a REAL `type` attribute — `<feTurbulence
|
|
1128
|
+
// type="fractalNoise">`, `<feFuncR type="table">`, `<feColorMatrix type="saturate">`.
|
|
1129
|
+
// `type` is taken by the tag name, so the attribute travels here and the renderer puts
|
|
1130
|
+
// it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
|
|
1131
|
+
// documented — because a wire key that is not in a schema is invisible to the
|
|
1132
|
+
// minifier's reserve list and gets renamed (dev-docs/plans/minification-boundary.md §1.1).
|
|
1133
|
+
domType: px.string().optional(),
|
|
1134
|
+
// Text content of a `<text>` / `<tspan>`. Declared, so a non-string value is a schema error
|
|
1135
|
+
// and the minifier reserves the key; `text` is NOT an alias for it and is not read anywhere.
|
|
1136
|
+
textContent: px.string().optional(),
|
|
1137
|
+
id: px.string().optional(),
|
|
1138
|
+
meta: px.any().optional(),
|
|
1139
|
+
// Player-effects bucket emitted by the Editor's lightweight design format.
|
|
1140
|
+
// Consumed and removed by `materializeNodeEffects` before any other normalization
|
|
1141
|
+
// (see `createAnimatorImpl`), so downstream code never sees it.
|
|
1142
|
+
effects: PxEffectsSchema.optional(),
|
|
1143
|
+
// `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
|
|
1144
|
+
// string ref / array of refs / inline definition / mixed array; mirrors
|
|
1145
|
+
// `node.animate` values and what `processNode` resolves at runtime.
|
|
1146
|
+
animate: PxElementAnimationSchema.optional(),
|
|
1147
|
+
style: px.record(px.union([px.string(), px.number()])).optional()
|
|
1148
|
+
}, PxAttrValueSchema);
|
|
1149
|
+
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({}, PxNodeBaseSchema._shape), {
|
|
1150
|
+
children: px.lazy(() => px.array(PxNodeSchema), []).optional()
|
|
1151
|
+
}), PxAttrValueSchema);
|
|
1152
|
+
var PxSvgNodeRootSchema = px.object({
|
|
1153
|
+
// `"100%"` and other SVG length strings are legal here — a number-only slot rejected
|
|
1154
|
+
// real documents (e.g. apple-store-look-14-main.json) at the root <svg>.
|
|
1155
|
+
width: px.union([px.number(), px.string()]).optional(),
|
|
1156
|
+
height: px.union([px.number(), px.string()]).optional(),
|
|
1157
|
+
viewBox: px.string().optional(),
|
|
1158
|
+
animator: PxAnimatorConfigSchema.optional()
|
|
1159
|
+
});
|
|
1160
|
+
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({}, PxNodeBaseSchema._shape), PxSvgNodeRootSchema._shape), {
|
|
1161
|
+
type: px.literal("svg"),
|
|
1162
|
+
// override string → literal to require 'svg'
|
|
1163
|
+
children: px.array(PxNodeSchema).optional()
|
|
1164
|
+
}), PxAttrValueSchema);
|
|
1165
|
+
var PxBezierPathSchema = implementsInterface()(px.object({
|
|
1166
|
+
v: px.array(px.array(px.number())),
|
|
1167
|
+
i: px.array(px.array(px.number())).optional(),
|
|
1168
|
+
o: px.array(px.array(px.number())).optional(),
|
|
1169
|
+
c: px.boolean().optional()
|
|
1170
|
+
}));
|
|
1171
|
+
|
|
1172
|
+
// ../svg-animator-core/src/util/PxAnimatorUtil.ts
|
|
1173
|
+
function bezierToSvgPath(path, forceCurves = false) {
|
|
1174
|
+
var _a, _b, _c, _d;
|
|
1175
|
+
const v = path.v;
|
|
1176
|
+
const i = path.i;
|
|
1177
|
+
const o = path.o;
|
|
1178
|
+
const c = path.c;
|
|
1179
|
+
if (!v.length) return "";
|
|
1180
|
+
const d = [];
|
|
1181
|
+
const len = v.length;
|
|
1182
|
+
d.push("M" + v[0][0] + "," + v[0][1]);
|
|
1183
|
+
for (let idx = 1; idx < len; idx++) {
|
|
1184
|
+
const prevV = v[idx - 1];
|
|
1185
|
+
const prevO = (_a = o == null ? void 0 : o[idx - 1]) != null ? _a : prevV;
|
|
1186
|
+
const currI = (_b = i == null ? void 0 : i[idx]) != null ? _b : v[idx];
|
|
1187
|
+
const currV = v[idx];
|
|
1188
|
+
const isLine = !forceCurves && (prevO[0] === prevV[0] && prevO[1] === prevV[1]) && (currI[0] === currV[0] && currI[1] === currV[1]);
|
|
1189
|
+
if (isLine) {
|
|
1190
|
+
d.push("L" + currV[0] + "," + currV[1]);
|
|
1191
|
+
} else {
|
|
1192
|
+
d.push("C" + prevO[0] + "," + prevO[1] + "," + currI[0] + "," + currI[1] + "," + currV[0] + "," + currV[1]);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
if (c && len > 0) {
|
|
1196
|
+
const lastV = v[len - 1];
|
|
1197
|
+
const lastO = (_c = o == null ? void 0 : o[len - 1]) != null ? _c : lastV;
|
|
1198
|
+
const firstI = (_d = i == null ? void 0 : i[0]) != null ? _d : v[0];
|
|
1199
|
+
const firstV = v[0];
|
|
1200
|
+
const isLine = !forceCurves && (lastO[0] === lastV[0] && lastO[1] === lastV[1]) && (firstI[0] === firstV[0] && firstI[1] === firstV[1]);
|
|
1201
|
+
if (!isLine) {
|
|
1202
|
+
d.push("C" + lastO[0] + "," + lastO[1] + "," + firstI[0] + "," + firstI[1] + "," + firstV[0] + "," + firstV[1]);
|
|
1203
|
+
}
|
|
1204
|
+
d.push("z");
|
|
1205
|
+
}
|
|
1206
|
+
return d.join("");
|
|
1207
|
+
}
|
|
1208
|
+
function interpolateNum(a, b, t) {
|
|
1209
|
+
return a + (b - a) * t;
|
|
1210
|
+
}
|
|
1211
|
+
function interpolateVec(a, b, t) {
|
|
1212
|
+
const res = [];
|
|
1213
|
+
const count = Math.max(a.length, b.length);
|
|
1214
|
+
for (let i = 0; i < count; i++) {
|
|
1215
|
+
res[i] = interpolateNum(a[i] || 0, b[i] || 0, t);
|
|
1216
|
+
}
|
|
1217
|
+
return res;
|
|
1218
|
+
}
|
|
1219
|
+
function interpolateColor(a, b, t) {
|
|
1220
|
+
return [
|
|
1221
|
+
interpolateNum(a[0] || 0, b[0] || 0, t),
|
|
1222
|
+
interpolateNum(a[1] || 0, b[1] || 0, t),
|
|
1223
|
+
interpolateNum(a[2] || 0, b[2] || 0, t),
|
|
1224
|
+
interpolateNum(a[3] === void 0 ? 1 : a[3], b[3] === void 0 ? 1 : b[3], t)
|
|
1225
|
+
];
|
|
1226
|
+
}
|
|
1227
|
+
function interpolateBeziers(paths1, paths2, progress) {
|
|
1228
|
+
const count = Math.max(paths1.length, paths2.length);
|
|
1229
|
+
const res = [];
|
|
1230
|
+
for (let i = 0; i < count; i++) {
|
|
1231
|
+
res.push(interpolateBezier(paths1[i], paths2[i], progress));
|
|
1232
|
+
}
|
|
1233
|
+
return res;
|
|
1234
|
+
}
|
|
1235
|
+
function interpolateBezier(path1, path2, progress) {
|
|
1236
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1237
|
+
if (!path1 || !path2) return path1 || path2 || { v: [] };
|
|
1238
|
+
const t = Math.min(Math.max(progress, 0), 1);
|
|
1239
|
+
const len = Math.min(path1.v.length, path2.v.length);
|
|
1240
|
+
const v = [];
|
|
1241
|
+
const i = [];
|
|
1242
|
+
const o = [];
|
|
1243
|
+
for (let idx = 0; idx < len; idx++) {
|
|
1244
|
+
const v1 = path1.v[idx];
|
|
1245
|
+
const v2 = path2.v[idx];
|
|
1246
|
+
v.push(interpolateVec(v1, v2, t));
|
|
1247
|
+
const i1 = (_b = (_a = path1.i) == null ? void 0 : _a[idx]) != null ? _b : v1;
|
|
1248
|
+
const i2 = (_d = (_c = path2.i) == null ? void 0 : _c[idx]) != null ? _d : v2;
|
|
1249
|
+
i.push(interpolateVec(i1, i2, t));
|
|
1250
|
+
const o1 = (_f = (_e = path1.o) == null ? void 0 : _e[idx]) != null ? _f : v1;
|
|
1251
|
+
const o2 = (_h = (_g = path2.o) == null ? void 0 : _g[idx]) != null ? _h : v2;
|
|
1252
|
+
o.push(interpolateVec(o1, o2, t));
|
|
1253
|
+
}
|
|
1254
|
+
return { v, i: i.length ? i : void 0, o: o.length ? o : void 0, c: (_i = path1.c) != null ? _i : path2.c };
|
|
1255
|
+
}
|
|
1256
|
+
function remap(value, inMin, inMax, outMin, outMax) {
|
|
1257
|
+
if (inMax === inMin) return outMin;
|
|
1258
|
+
const t = (value - inMin) / (inMax - inMin);
|
|
1259
|
+
return outMin + t * (outMax - outMin);
|
|
1260
|
+
}
|
|
1261
|
+
function solveCubicBezierX(p1x, p2x, x) {
|
|
1262
|
+
if (x <= 0) return 0;
|
|
1263
|
+
if (x >= 1) return 1;
|
|
1264
|
+
const cx = 3 * p1x;
|
|
1265
|
+
const bx = 3 * (p2x - p1x) - cx;
|
|
1266
|
+
const ax = 1 - cx - bx;
|
|
1267
|
+
function sampleX(t) {
|
|
1268
|
+
return ((ax * t + bx) * t + cx) * t;
|
|
1269
|
+
}
|
|
1270
|
+
function sampleDX(t) {
|
|
1271
|
+
return (3 * ax * t + 2 * bx) * t + cx;
|
|
1272
|
+
}
|
|
1273
|
+
let t2 = x;
|
|
1274
|
+
let t0 = 0;
|
|
1275
|
+
let t1 = 1;
|
|
1276
|
+
for (let i = 0; i < 8; i++) {
|
|
1277
|
+
const x2 = sampleX(t2) - x;
|
|
1278
|
+
if (Math.abs(x2) < 1e-6) return t2;
|
|
1279
|
+
const d2 = sampleDX(t2);
|
|
1280
|
+
if (Math.abs(d2) < 1e-6) break;
|
|
1281
|
+
t2 -= x2 / d2;
|
|
1282
|
+
}
|
|
1283
|
+
t2 = x;
|
|
1284
|
+
while (t0 < t1) {
|
|
1285
|
+
const x2 = sampleX(t2);
|
|
1286
|
+
if (Math.abs(x2 - x) < 1e-6) return t2;
|
|
1287
|
+
if (x > x2) t0 = t2;
|
|
1288
|
+
else t1 = t2;
|
|
1289
|
+
t2 = (t1 + t0) / 2;
|
|
1290
|
+
}
|
|
1291
|
+
return t2;
|
|
1292
|
+
}
|
|
1293
|
+
function cubicBezier(easing) {
|
|
1294
|
+
const [p1x, p1y, p2x, p2y] = easing;
|
|
1295
|
+
const cy = 3 * p1y;
|
|
1296
|
+
const by = 3 * (p2y - p1y) - cy;
|
|
1297
|
+
const ay = 1 - cy - by;
|
|
1298
|
+
function sampleCurveY(t) {
|
|
1299
|
+
return ((ay * t + by) * t + cy) * t;
|
|
1300
|
+
}
|
|
1301
|
+
return function(x) {
|
|
1302
|
+
return sampleCurveY(solveCubicBezierX(p1x, p2x, x));
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
function lerp2(a, b, t) {
|
|
1306
|
+
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
1307
|
+
}
|
|
1308
|
+
function subdivideCubicBezier(p0, p1, p2, p3, t) {
|
|
1309
|
+
const q0 = lerp2(p0, p1, t);
|
|
1310
|
+
const q1 = lerp2(p1, p2, t);
|
|
1311
|
+
const q2 = lerp2(p2, p3, t);
|
|
1312
|
+
const r0 = lerp2(q0, q1, t);
|
|
1313
|
+
const r1 = lerp2(q1, q2, t);
|
|
1314
|
+
const s = lerp2(r0, r1, t);
|
|
1315
|
+
return {
|
|
1316
|
+
left: [p0, q0, r0, s],
|
|
1317
|
+
right: [s, r1, q2, p3]
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function splitEasing(easing, xFraction) {
|
|
1321
|
+
if (!easing) return { left: void 0, right: void 0 };
|
|
1322
|
+
if (xFraction <= 0) return { left: void 0, right: easing };
|
|
1323
|
+
if (xFraction >= 1) return { left: easing, right: void 0 };
|
|
1324
|
+
const [x1, y1, x2, y2] = easing;
|
|
1325
|
+
const t = solveCubicBezierX(x1, x2, xFraction);
|
|
1326
|
+
const p0 = [0, 0];
|
|
1327
|
+
const p1 = [x1, y1];
|
|
1328
|
+
const p2 = [x2, y2];
|
|
1329
|
+
const p3 = [1, 1];
|
|
1330
|
+
const { left, right } = subdivideCubicBezier(p0, p1, p2, p3, t);
|
|
1331
|
+
const sx = left[3][0];
|
|
1332
|
+
const sy = left[3][1];
|
|
1333
|
+
let leftEasing;
|
|
1334
|
+
if (sx > 1e-9 && Math.abs(sy) > 1e-9) {
|
|
1335
|
+
leftEasing = [
|
|
1336
|
+
left[1][0] / sx,
|
|
1337
|
+
left[1][1] / sy,
|
|
1338
|
+
left[2][0] / sx,
|
|
1339
|
+
left[2][1] / sy
|
|
1340
|
+
];
|
|
1341
|
+
}
|
|
1342
|
+
let rightEasing;
|
|
1343
|
+
const rx = 1 - sx;
|
|
1344
|
+
const ry = 1 - sy;
|
|
1345
|
+
if (rx > 1e-9 && Math.abs(ry) > 1e-9) {
|
|
1346
|
+
rightEasing = [
|
|
1347
|
+
(right[1][0] - sx) / rx,
|
|
1348
|
+
(right[1][1] - sy) / ry,
|
|
1349
|
+
(right[2][0] - sx) / rx,
|
|
1350
|
+
(right[2][1] - sy) / ry
|
|
1351
|
+
];
|
|
1352
|
+
}
|
|
1353
|
+
return { left: leftEasing, right: rightEasing };
|
|
1354
|
+
}
|
|
1355
|
+
function reverseEasing(easing) {
|
|
1356
|
+
if (!easing) return void 0;
|
|
1357
|
+
return [1 - easing[2], 1 - easing[3], 1 - easing[0], 1 - easing[1]];
|
|
1358
|
+
}
|
|
1359
|
+
function toRGBA(color) {
|
|
1360
|
+
const r = Math.round(color[0] * 255);
|
|
1361
|
+
const g = Math.round(color[1] * 255);
|
|
1362
|
+
const b = Math.round(color[2] * 255);
|
|
1363
|
+
return color.length === 4 ? "rgba(" + r + "," + g + "," + b + "," + color[3] + ")" : "rgb(" + r + "," + g + "," + b + ")";
|
|
1364
|
+
}
|
|
1365
|
+
function parseRgba(s) {
|
|
1366
|
+
var _a;
|
|
1367
|
+
const inner = (_a = s.match(/rgba?\((.*)\)/)) == null ? void 0 : _a[1];
|
|
1368
|
+
if (!inner) throw new Error("Invalid rgb/rgba format");
|
|
1369
|
+
const parts = inner.split(",").map((v) => +v.trim());
|
|
1370
|
+
return [parts[0] / 255, parts[1] / 255, parts[2] / 255, ...parts[3] !== void 0 ? [parts[3]] : []];
|
|
1371
|
+
}
|
|
1372
|
+
function parseHex(s) {
|
|
1373
|
+
const hex = s.slice(1);
|
|
1374
|
+
const isShort = hex.length <= 4;
|
|
1375
|
+
const r = isShort ? hex[0] + hex[0] : hex.slice(0, 2);
|
|
1376
|
+
const g = isShort ? hex[1] + hex[1] : hex.slice(2, 4);
|
|
1377
|
+
const b = isShort ? hex[2] + hex[2] : hex.slice(4, 6);
|
|
1378
|
+
const a = hex.length === 4 ? hex[3] + hex[3] : hex.length === 8 ? hex.slice(6, 8) : null;
|
|
1379
|
+
const result = [
|
|
1380
|
+
parseInt(r, 16) / 255,
|
|
1381
|
+
parseInt(g, 16) / 255,
|
|
1382
|
+
parseInt(b, 16) / 255
|
|
1383
|
+
];
|
|
1384
|
+
if (a !== null) {
|
|
1385
|
+
result.push(parseInt(a, 16) / 255);
|
|
1386
|
+
}
|
|
1387
|
+
return result;
|
|
1388
|
+
}
|
|
1389
|
+
function parseColor(s) {
|
|
1390
|
+
if (!s) return void 0;
|
|
1391
|
+
if (Array.isArray(s)) return s;
|
|
1392
|
+
if (typeof s !== "string") return void 0;
|
|
1393
|
+
if (s.startsWith("#")) {
|
|
1394
|
+
return parseHex(s);
|
|
1395
|
+
} else if (s.startsWith("rgb")) {
|
|
1396
|
+
return parseRgba(s);
|
|
1397
|
+
} else {
|
|
1398
|
+
console.warn("Unsupported color format: " + s);
|
|
1399
|
+
}
|
|
1400
|
+
return void 0;
|
|
1401
|
+
}
|
|
1402
|
+
var PX_COLOR_ATTR_NAMES = /* @__PURE__ */ new Set(["color", "fill", "flood-color", "lighting-color", "stop-color", "stroke"]);
|
|
1403
|
+
var PX_TRANSFORM_FN_NAMES = /* @__PURE__ */ new Set(["translate", "rotate", "scale", "skew"]);
|
|
1404
|
+
var PX_PCT_BASED_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
1405
|
+
function composeTransformParts(parts, opts) {
|
|
1406
|
+
var _a;
|
|
1407
|
+
if (!parts) return "";
|
|
1408
|
+
const withUnits = (_a = opts == null ? void 0 : opts.withUnits) != null ? _a : true;
|
|
1409
|
+
const segs = [];
|
|
1410
|
+
const t = parts.translate;
|
|
1411
|
+
const o = parts.origin;
|
|
1412
|
+
const r = parts.rotate;
|
|
1413
|
+
const k = parts.skew;
|
|
1414
|
+
const s = parts.scale;
|
|
1415
|
+
const tu = withUnits ? "px" : "";
|
|
1416
|
+
const ru = withUnits ? "deg" : "";
|
|
1417
|
+
if (t) segs.push("translate(" + t[0] + tu + "," + t[1] + tu + ")");
|
|
1418
|
+
if (o) segs.push("translate(" + o[0] + tu + "," + o[1] + tu + ")");
|
|
1419
|
+
if (r !== void 0 && r !== null) segs.push("rotate(" + r + ru + ")");
|
|
1420
|
+
if (k !== void 0 && k !== null) segs.push("skewX(" + k + ru + ")");
|
|
1421
|
+
if (s) segs.push("scale(" + s[0] + "," + s[1] + ")");
|
|
1422
|
+
if (o) segs.push("translate(" + -o[0] + tu + "," + -o[1] + tu + ")");
|
|
1423
|
+
return segs.join("");
|
|
1424
|
+
}
|
|
1425
|
+
function parseTransformParts(str) {
|
|
1426
|
+
var _a, _b;
|
|
1427
|
+
if (!str || typeof str !== "string") return void 0;
|
|
1428
|
+
const out = {};
|
|
1429
|
+
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
1430
|
+
const order = ["translate", "rotate", "skewX", "scale"];
|
|
1431
|
+
let lastIdx = -1;
|
|
1432
|
+
let m;
|
|
1433
|
+
while ((m = re.exec(str)) !== null) {
|
|
1434
|
+
const fn = m[1];
|
|
1435
|
+
const idx = order.indexOf(fn);
|
|
1436
|
+
if (idx < 0 || idx <= lastIdx) return void 0;
|
|
1437
|
+
lastIdx = idx;
|
|
1438
|
+
const nums = m[2].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
1439
|
+
if (nums.some((n) => Number.isNaN(n))) return void 0;
|
|
1440
|
+
if (fn === "translate") {
|
|
1441
|
+
if (nums.length < 1 || nums.length > 2) return void 0;
|
|
1442
|
+
out.translate = [nums[0], (_a = nums[1]) != null ? _a : 0];
|
|
1443
|
+
} else if (fn === "rotate") {
|
|
1444
|
+
if (nums.length !== 1) return void 0;
|
|
1445
|
+
out.rotate = nums[0];
|
|
1446
|
+
} else if (fn === "skewX") {
|
|
1447
|
+
if (nums.length !== 1) return void 0;
|
|
1448
|
+
out.skew = nums[0];
|
|
1449
|
+
} else {
|
|
1450
|
+
if (nums.length < 1 || nums.length > 2) return void 0;
|
|
1451
|
+
out.scale = [nums[0], (_b = nums[1]) != null ? _b : nums[0]];
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
if (str.replace(/([a-zA-Z]+)\s*\(([^)]*)\)/g, "").replace(/[\s,]/g, "").length) return void 0;
|
|
1455
|
+
return Object.keys(out).length ? out : void 0;
|
|
1456
|
+
}
|
|
1457
|
+
var PX_STYLE_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
1458
|
+
var PX_DEFAULT_DURATION_MS = 1e3;
|
|
1459
|
+
function kebabToCamelCaseWord(kebab) {
|
|
1460
|
+
return kebab.includes("-") ? kebab.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()) : kebab;
|
|
1461
|
+
}
|
|
1462
|
+
function isCamelCaseWord(word) {
|
|
1463
|
+
return !word.includes("-") && /[a-z][A-Z]/.test(word);
|
|
1464
|
+
}
|
|
1465
|
+
var SVG_CAMEL_CASE_ATTRS = /* @__PURE__ */ new Set([
|
|
1466
|
+
// Transform/positioning
|
|
1467
|
+
"viewBox",
|
|
1468
|
+
"preserveAspectRatio",
|
|
1469
|
+
// Gradient
|
|
1470
|
+
"gradientUnits",
|
|
1471
|
+
"gradientTransform",
|
|
1472
|
+
"spreadMethod",
|
|
1473
|
+
// Pattern
|
|
1474
|
+
"patternUnits",
|
|
1475
|
+
"patternContentUnits",
|
|
1476
|
+
"patternTransform",
|
|
1477
|
+
// Clipping/masking
|
|
1478
|
+
"clipPathUnits",
|
|
1479
|
+
"maskUnits",
|
|
1480
|
+
"maskContentUnits",
|
|
1481
|
+
// Marker (SVG spec keeps these camelCase, like viewBox)
|
|
1482
|
+
"markerUnits",
|
|
1483
|
+
"markerWidth",
|
|
1484
|
+
"markerHeight",
|
|
1485
|
+
"refX",
|
|
1486
|
+
"refY",
|
|
1487
|
+
// Text
|
|
1488
|
+
"textLength",
|
|
1489
|
+
"lengthAdjust",
|
|
1490
|
+
"startOffset",
|
|
1491
|
+
// Filter
|
|
1492
|
+
"filterUnits",
|
|
1493
|
+
"primitiveUnits",
|
|
1494
|
+
"tableValues",
|
|
1495
|
+
// feFuncR/G/B/A transfer table (type="table")
|
|
1496
|
+
"stdDeviation",
|
|
1497
|
+
"baseFrequency",
|
|
1498
|
+
"numOctaves",
|
|
1499
|
+
"surfaceScale",
|
|
1500
|
+
"diffuseConstant",
|
|
1501
|
+
"specularConstant",
|
|
1502
|
+
"specularExponent",
|
|
1503
|
+
"kernelMatrix",
|
|
1504
|
+
"kernelUnitLength",
|
|
1505
|
+
"edgeMode",
|
|
1506
|
+
"preserveAlpha",
|
|
1507
|
+
"targetX",
|
|
1508
|
+
"targetY"
|
|
1509
|
+
// // Animation
|
|
1510
|
+
// 'attributeName',
|
|
1511
|
+
// 'attributeType',
|
|
1512
|
+
// 'calcMode',
|
|
1513
|
+
// 'keyTimes',
|
|
1514
|
+
// 'keySplines',
|
|
1515
|
+
// 'repeatCount',
|
|
1516
|
+
// 'repeatDur'
|
|
1517
|
+
]);
|
|
1518
|
+
function camelCaseToKebabWordIfNeeded(camel) {
|
|
1519
|
+
return SVG_CAMEL_CASE_ATTRS.has(camel) ? camel : camel.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1520
|
+
}
|
|
1521
|
+
function clamp(value, min, max) {
|
|
1522
|
+
return Math.max(min, Math.min(value, max));
|
|
1523
|
+
}
|
|
1524
|
+
function bezier2D_pointAt(P0, P1, P2, P3, t) {
|
|
1525
|
+
if (t <= 0) return [P0[0], P0[1]];
|
|
1526
|
+
if (t >= 1) return [P3[0], P3[1]];
|
|
1527
|
+
const u = 1 - t;
|
|
1528
|
+
const u2 = u * u;
|
|
1529
|
+
const u3 = u2 * u;
|
|
1530
|
+
const t2 = t * t;
|
|
1531
|
+
const t3 = t2 * t;
|
|
1532
|
+
const w0 = u3;
|
|
1533
|
+
const w1 = 3 * t * u2;
|
|
1534
|
+
const w2 = 3 * t2 * u;
|
|
1535
|
+
const w3 = t3;
|
|
1536
|
+
return [
|
|
1537
|
+
w0 * P0[0] + w1 * P1[0] + w2 * P2[0] + w3 * P3[0],
|
|
1538
|
+
w0 * P0[1] + w1 * P1[1] + w2 * P2[1] + w3 * P3[1]
|
|
1539
|
+
];
|
|
1540
|
+
}
|
|
1541
|
+
var BEZIER_T_NUDGE = 1e-4;
|
|
1542
|
+
function bezier2D_derivativeAt(P0, P1, P2, P3, t) {
|
|
1543
|
+
const result = _bezier2D_derivativeAtRaw(P0, P1, P2, P3, t);
|
|
1544
|
+
if (result[0] === 0 && result[1] === 0) {
|
|
1545
|
+
const nudgedT = t < 0.5 ? t + BEZIER_T_NUDGE : t - BEZIER_T_NUDGE;
|
|
1546
|
+
return _bezier2D_derivativeAtRaw(P0, P1, P2, P3, nudgedT);
|
|
1547
|
+
}
|
|
1548
|
+
return result;
|
|
1549
|
+
}
|
|
1550
|
+
function _bezier2D_derivativeAtRaw(P0, P1, P2, P3, t) {
|
|
1551
|
+
const u = 1 - t;
|
|
1552
|
+
const a = 3 * u * u;
|
|
1553
|
+
const b = 6 * t * u;
|
|
1554
|
+
const c = 3 * t * t;
|
|
1555
|
+
return [
|
|
1556
|
+
a * (P1[0] - P0[0]) + b * (P2[0] - P1[0]) + c * (P3[0] - P2[0]),
|
|
1557
|
+
a * (P1[1] - P0[1]) + b * (P2[1] - P1[1]) + c * (P3[1] - P2[1])
|
|
1558
|
+
];
|
|
1559
|
+
}
|
|
1560
|
+
function bezier2D_arcLengthLUT(P0, P1, P2, P3, steps = 100) {
|
|
1561
|
+
const n = steps + 1;
|
|
1562
|
+
const ts = new Float64Array(n);
|
|
1563
|
+
const ds = new Float64Array(n);
|
|
1564
|
+
let prev = bezier2D_pointAt(P0, P1, P2, P3, 0);
|
|
1565
|
+
ts[0] = 0;
|
|
1566
|
+
ds[0] = 0;
|
|
1567
|
+
let cum = 0;
|
|
1568
|
+
for (let i = 1; i < n; i++) {
|
|
1569
|
+
const t = i / steps;
|
|
1570
|
+
const cur = bezier2D_pointAt(P0, P1, P2, P3, t);
|
|
1571
|
+
const dx = cur[0] - prev[0];
|
|
1572
|
+
const dy = cur[1] - prev[1];
|
|
1573
|
+
cum += Math.sqrt(dx * dx + dy * dy);
|
|
1574
|
+
ts[i] = t;
|
|
1575
|
+
ds[i] = cum;
|
|
1576
|
+
prev = cur;
|
|
1577
|
+
}
|
|
1578
|
+
return { ts, ds };
|
|
1579
|
+
}
|
|
1580
|
+
function bezier2D_arcAtT(lut, t) {
|
|
1581
|
+
const { ts, ds } = lut;
|
|
1582
|
+
const last = ts.length - 1;
|
|
1583
|
+
if (t <= ts[0]) return ds[0];
|
|
1584
|
+
if (t >= ts[last]) return ds[last];
|
|
1585
|
+
let lo = 1, hi = last;
|
|
1586
|
+
while (lo < hi) {
|
|
1587
|
+
const mid = lo + hi >>> 1;
|
|
1588
|
+
if (ts[mid] < t) lo = mid + 1;
|
|
1589
|
+
else hi = mid;
|
|
1590
|
+
}
|
|
1591
|
+
const tPrev = ts[hi - 1];
|
|
1592
|
+
const span = ts[hi] - tPrev;
|
|
1593
|
+
const frac = span > 0 ? (t - tPrev) / span : 0;
|
|
1594
|
+
return ds[hi - 1] + frac * (ds[hi] - ds[hi - 1]);
|
|
1595
|
+
}
|
|
1596
|
+
function invertEasing(easing) {
|
|
1597
|
+
if (!easing) return (y) => y;
|
|
1598
|
+
const flipped = [easing[1], easing[0], easing[3], easing[2]];
|
|
1599
|
+
return cubicBezier(flipped);
|
|
1600
|
+
}
|
|
1662
1601
|
|
|
1663
1602
|
// ../svg-animator-core/src/materialize/PxMotionPath.ts
|
|
1664
1603
|
function getKfTranslate(kf) {
|
|
1665
|
-
const v =
|
|
1604
|
+
const v = keyframeValue(kf);
|
|
1666
1605
|
if (!v) return void 0;
|
|
1667
1606
|
if (Array.isArray(v) && v.length >= 2 && typeof v[0] === "number" && typeof v[1] === "number") {
|
|
1668
1607
|
return [v[0], v[1]];
|
|
@@ -1672,17 +1611,17 @@ var PixodeskAnimator = (() => {
|
|
|
1672
1611
|
return void 0;
|
|
1673
1612
|
}
|
|
1674
1613
|
function getKfTime(kf) {
|
|
1675
|
-
return
|
|
1614
|
+
return keyframeTime(kf);
|
|
1676
1615
|
}
|
|
1677
1616
|
function getKfEasing(kf) {
|
|
1678
|
-
return
|
|
1617
|
+
return keyframeEasing(kf);
|
|
1679
1618
|
}
|
|
1680
1619
|
function propAnimIsMotionPath(anim) {
|
|
1681
1620
|
const kfs = anim.keyframes;
|
|
1682
1621
|
if (!Array.isArray(kfs)) return false;
|
|
1683
1622
|
if (anim.autoOrient) return true;
|
|
1684
1623
|
for (const kf of kfs) {
|
|
1685
|
-
if (
|
|
1624
|
+
if (keyframeTangentIn(kf) || keyframeTangentOut(kf)) return true;
|
|
1686
1625
|
}
|
|
1687
1626
|
return false;
|
|
1688
1627
|
}
|
|
@@ -1691,8 +1630,8 @@ var PixodeskAnimator = (() => {
|
|
|
1691
1630
|
let byNext = _segmentCache.get(prevKf);
|
|
1692
1631
|
const existing = byNext == null ? void 0 : byNext.get(nextKf);
|
|
1693
1632
|
if (existing) return existing;
|
|
1694
|
-
const to =
|
|
1695
|
-
const ti =
|
|
1633
|
+
const to = keyframeTangentOut(prevKf);
|
|
1634
|
+
const ti = keyframeTangentIn(nextKf);
|
|
1696
1635
|
const P1 = [prevPos[0] + (to ? to[0] : 0), prevPos[1] + (to ? to[1] : 0)];
|
|
1697
1636
|
const P2 = [nextPos[0] + (ti ? ti[0] : 0), nextPos[1] + (ti ? ti[1] : 0)];
|
|
1698
1637
|
const lut = bezier2D_arcLengthLUT(prevPos, P1, P2, nextPos);
|
|
@@ -1785,7 +1724,7 @@ var PixodeskAnimator = (() => {
|
|
|
1785
1724
|
function unwrapAutoOrientRotations(kfs) {
|
|
1786
1725
|
let prev;
|
|
1787
1726
|
for (const kf of kfs) {
|
|
1788
|
-
const v =
|
|
1727
|
+
const v = keyframeValue(kf);
|
|
1789
1728
|
if (!v || typeof v.rotate !== "number") continue;
|
|
1790
1729
|
if (prev === void 0) {
|
|
1791
1730
|
prev = v.rotate;
|
|
@@ -1802,7 +1741,7 @@ var PixodeskAnimator = (() => {
|
|
|
1802
1741
|
return { t: time, v: value };
|
|
1803
1742
|
}
|
|
1804
1743
|
function getKfValueParts(kf) {
|
|
1805
|
-
const v =
|
|
1744
|
+
const v = keyframeValue(kf);
|
|
1806
1745
|
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
1807
1746
|
return v;
|
|
1808
1747
|
}
|
|
@@ -1864,7 +1803,7 @@ var PixodeskAnimator = (() => {
|
|
|
1864
1803
|
}
|
|
1865
1804
|
function insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol) {
|
|
1866
1805
|
const lastKf = out[out.length - 1];
|
|
1867
|
-
const lastV =
|
|
1806
|
+
const lastV = keyframeValue(lastKf);
|
|
1868
1807
|
const prevExit = lastV == null ? void 0 : lastV.rotate;
|
|
1869
1808
|
if (typeof prevExit !== "number") return;
|
|
1870
1809
|
const boundaryV = getKfValueParts(prevKf);
|
|
@@ -2012,7 +1951,7 @@ var PixodeskAnimator = (() => {
|
|
|
2012
1951
|
}
|
|
2013
1952
|
|
|
2014
1953
|
// ../svg-animator-core/src/animation/PxDefinitions.ts
|
|
2015
|
-
var
|
|
1954
|
+
var PX_LOOP_JUMP_SHIFT_MS = 1;
|
|
2016
1955
|
function deepEqualValue(a, b) {
|
|
2017
1956
|
if (a === b) return true;
|
|
2018
1957
|
if (typeof a !== typeof b || a === null || b === null || typeof a !== "object") return false;
|
|
@@ -2188,7 +2127,7 @@ var PixodeskAnimator = (() => {
|
|
|
2188
2127
|
const bPaths = (_b = b == null ? void 0 : b.paths) != null ? _b : Array.isArray(b) ? b : [];
|
|
2189
2128
|
return { paths: interpolateBeziers(aPaths, bPaths, t) };
|
|
2190
2129
|
}
|
|
2191
|
-
if (
|
|
2130
|
+
if (PX_COLOR_ATTR_NAMES.has(propName)) {
|
|
2192
2131
|
return interpolateColor(a || [0, 0, 0, 1], b || [0, 0, 0, 1], t);
|
|
2193
2132
|
}
|
|
2194
2133
|
if (propName === "transform" && typeof a === "object" && a !== null && !Array.isArray(a) && typeof b === "object" && b !== null && !Array.isArray(b)) {
|
|
@@ -2197,7 +2136,7 @@ var PixodeskAnimator = (() => {
|
|
|
2197
2136
|
if (propName === "rotate" && typeof a === "number" && typeof b === "number") {
|
|
2198
2137
|
return interpolateNum(a, b, t);
|
|
2199
2138
|
}
|
|
2200
|
-
if (
|
|
2139
|
+
if (PX_TRANSFORM_FN_NAMES.has(propName) || propName === "stroke-dasharray" || propName === "strokeDasharray") {
|
|
2201
2140
|
return interpolateVec(a || [], b || [], t);
|
|
2202
2141
|
}
|
|
2203
2142
|
return interpolateNum(+(a || 0), +(b || 0), t);
|
|
@@ -2249,8 +2188,8 @@ var PixodeskAnimator = (() => {
|
|
|
2249
2188
|
relT: (kf.t - segStartT) / segDuration,
|
|
2250
2189
|
v: kf.v,
|
|
2251
2190
|
e: kf.e,
|
|
2252
|
-
tangentIn:
|
|
2253
|
-
tangentOut:
|
|
2191
|
+
tangentIn: keyframeTangentIn(kf),
|
|
2192
|
+
tangentOut: keyframeTangentOut(kf)
|
|
2254
2193
|
}));
|
|
2255
2194
|
const fullReps = Math.floor(fillDuration / segDuration);
|
|
2256
2195
|
const remainder = fillDuration - fullReps * segDuration;
|
|
@@ -2316,7 +2255,7 @@ var PixodeskAnimator = (() => {
|
|
|
2316
2255
|
}
|
|
2317
2256
|
}
|
|
2318
2257
|
const pushed = {
|
|
2319
|
-
t: repStart + entry.relT * segDuration + (isBoundary ?
|
|
2258
|
+
t: repStart + entry.relT * segDuration + (isBoundary ? PX_LOOP_JUMP_SHIFT_MS : 0),
|
|
2320
2259
|
v: entry.v,
|
|
2321
2260
|
e: i < entries.length - 1 ? entry.e : void 0
|
|
2322
2261
|
};
|
|
@@ -2403,14 +2342,14 @@ var PixodeskAnimator = (() => {
|
|
|
2403
2342
|
const keyframes = propAnim.keyframes || [];
|
|
2404
2343
|
const normalized = [];
|
|
2405
2344
|
for (const kf of keyframes) {
|
|
2406
|
-
const timePct =
|
|
2407
|
-
let value =
|
|
2408
|
-
const easing =
|
|
2345
|
+
const timePct = keyframeTime(kf);
|
|
2346
|
+
let value = keyframeValue(kf);
|
|
2347
|
+
const easing = keyframeEasing(kf);
|
|
2409
2348
|
if (propName === "d") {
|
|
2410
2349
|
value = normalizePathValue(value);
|
|
2411
2350
|
}
|
|
2412
2351
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
2413
|
-
if (
|
|
2352
|
+
if (PX_COLOR_ATTR_NAMES.has(propNameKebab)) {
|
|
2414
2353
|
value = (_a = parseColor(value)) != null ? _a : value;
|
|
2415
2354
|
}
|
|
2416
2355
|
const normKf = {
|
|
@@ -2418,8 +2357,8 @@ var PixodeskAnimator = (() => {
|
|
|
2418
2357
|
v: value,
|
|
2419
2358
|
e: resolveEasing(easing, defs)
|
|
2420
2359
|
};
|
|
2421
|
-
const tIn =
|
|
2422
|
-
const tOut =
|
|
2360
|
+
const tIn = keyframeTangentIn(kf);
|
|
2361
|
+
const tOut = keyframeTangentOut(kf);
|
|
2423
2362
|
if (tIn) normKf.tangentIn = tIn;
|
|
2424
2363
|
if (tOut) normKf.tangentOut = tOut;
|
|
2425
2364
|
normalized.push(normKf);
|
|
@@ -2465,7 +2404,7 @@ var PixodeskAnimator = (() => {
|
|
|
2465
2404
|
}
|
|
2466
2405
|
return animDef;
|
|
2467
2406
|
}
|
|
2468
|
-
const channels = Object.keys(animDef).filter((k) =>
|
|
2407
|
+
const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
|
|
2469
2408
|
if (channels.length !== 1) return animDef;
|
|
2470
2409
|
const ch = channels[0];
|
|
2471
2410
|
const chAnim = animDef[ch];
|
|
@@ -2494,14 +2433,12 @@ var PixodeskAnimator = (() => {
|
|
|
2494
2433
|
}
|
|
2495
2434
|
return normalized;
|
|
2496
2435
|
}
|
|
2497
|
-
function
|
|
2436
|
+
function normalizeBindings(doc, engine = PxTimelineEngine.native) {
|
|
2498
2437
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
2499
|
-
const defs =
|
|
2438
|
+
const defs = getDefinitions(doc);
|
|
2500
2439
|
const duration = animatorConfig.duration || 1e3;
|
|
2501
2440
|
const bindings = [];
|
|
2502
|
-
const processAnimation = (id,
|
|
2503
|
-
if (!animate) return null;
|
|
2504
|
-
const animDefs = resolveElementAnimation(animate, defs);
|
|
2441
|
+
const processAnimation = (id, animDefs, staticTransform) => {
|
|
2505
2442
|
if (animDefs.length === 0) return null;
|
|
2506
2443
|
const merged = mergeStaticTransformIntoAnimDef(mergeAnimationDefinitions(animDefs), staticTransform);
|
|
2507
2444
|
const normalizedAnim = normalizeAnimationDefinition(merged, duration, defs, engine);
|
|
@@ -2514,7 +2451,9 @@ var PixodeskAnimator = (() => {
|
|
|
2514
2451
|
const docBindings = getBindings(doc);
|
|
2515
2452
|
if (docBindings) {
|
|
2516
2453
|
for (const binding of docBindings) {
|
|
2517
|
-
const
|
|
2454
|
+
const id = binding.target.startsWith("#") ? binding.target.slice(1) : binding.target;
|
|
2455
|
+
const animDefs = binding.animateWith.map((name) => resolveAnimation(name, defs)).filter((d) => !!d);
|
|
2456
|
+
const normalized = processAnimation(id, animDefs);
|
|
2518
2457
|
if (normalized) bindings.push(normalized);
|
|
2519
2458
|
}
|
|
2520
2459
|
}
|
|
@@ -2523,7 +2462,7 @@ var PixodeskAnimator = (() => {
|
|
|
2523
2462
|
if (inlineAnim && Object.keys(inlineAnim).length > 0) {
|
|
2524
2463
|
const nodeId = node.id || generateElementId();
|
|
2525
2464
|
node.id = nodeId;
|
|
2526
|
-
const normalized = processAnimation(nodeId, inlineAnim, node.transform);
|
|
2465
|
+
const normalized = processAnimation(nodeId, resolveElementAnimation(inlineAnim, defs), node.transform);
|
|
2527
2466
|
if (normalized) bindings.push(normalized);
|
|
2528
2467
|
}
|
|
2529
2468
|
if (node.children) {
|
|
@@ -2566,7 +2505,7 @@ var PixodeskAnimator = (() => {
|
|
|
2566
2505
|
const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
|
|
2567
2506
|
let localProgress = prevKf === nextKf ? 0 : remap(progress, (_a = prevKf.t) != null ? _a : 0, (_b = nextKf.t) != null ? _b : 0, 0, 1);
|
|
2568
2507
|
localProgress = clamp(localProgress, 0, 1);
|
|
2569
|
-
const easing =
|
|
2508
|
+
const easing = keyframeEasing(prevKf);
|
|
2570
2509
|
if (easing && Array.isArray(easing)) {
|
|
2571
2510
|
try {
|
|
2572
2511
|
localProgress = cubicBezier(easing)(localProgress);
|
|
@@ -2585,7 +2524,7 @@ var PixodeskAnimator = (() => {
|
|
|
2585
2524
|
nextPaths,
|
|
2586
2525
|
localProgress
|
|
2587
2526
|
).map((bz) => bezierToSvgPath(bz)).join("");
|
|
2588
|
-
} else if (
|
|
2527
|
+
} else if (PX_COLOR_ATTR_NAMES.has(cssAttrName)) {
|
|
2589
2528
|
cssValue = toRGBA(interpolateColor(
|
|
2590
2529
|
prevV || [0, 0, 0, 1],
|
|
2591
2530
|
nextV || [0, 0, 0, 1],
|
|
@@ -2666,7 +2605,7 @@ var PixodeskAnimator = (() => {
|
|
|
2666
2605
|
);
|
|
2667
2606
|
cssValue = num;
|
|
2668
2607
|
}
|
|
2669
|
-
if (
|
|
2608
|
+
if (PX_PCT_BASED_ATTR_NAMES.has(cssAttrName) && typeof cssValue === "number") {
|
|
2670
2609
|
cssValue = cssValue * 100 + "%";
|
|
2671
2610
|
}
|
|
2672
2611
|
return { k: cssAttrName, v: cssValue === null ? "" : "" + cssValue };
|
|
@@ -2730,16 +2669,16 @@ var PixodeskAnimator = (() => {
|
|
|
2730
2669
|
}
|
|
2731
2670
|
g.clearTimeout(handle);
|
|
2732
2671
|
}
|
|
2733
|
-
function
|
|
2672
|
+
function createAdapterAnimator(doc, adapter, callbacks) {
|
|
2734
2673
|
var _a;
|
|
2735
2674
|
const config = getAnimatorConfig(doc) || {};
|
|
2736
|
-
const bindings =
|
|
2675
|
+
const bindings = normalizeBindings(doc, PxTimelineEngine.js);
|
|
2737
2676
|
const _iterations = config.iterations;
|
|
2738
2677
|
let iterations = 1;
|
|
2739
2678
|
if (typeof _iterations === "number") iterations = _iterations || 1;
|
|
2740
2679
|
if (_iterations === "infinite") iterations = Infinity;
|
|
2741
2680
|
if (iterations < 1) iterations = 1;
|
|
2742
|
-
const duration = +(config.duration ||
|
|
2681
|
+
const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
|
|
2743
2682
|
const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : 1) * duration : 0;
|
|
2744
2683
|
const direction = config.direction || "normal";
|
|
2745
2684
|
const fill = (_a = config.fill) != null ? _a : "forwards";
|
|
@@ -3013,10 +2952,6 @@ var PixodeskAnimator = (() => {
|
|
|
3013
2952
|
function asError(error) {
|
|
3014
2953
|
return typeof error === "string" ? new Error(error) : error;
|
|
3015
2954
|
}
|
|
3016
|
-
function isSilenced(silent, kind) {
|
|
3017
|
-
if (!silent) return false;
|
|
3018
|
-
return silent === true || silent.includes(kind);
|
|
3019
|
-
}
|
|
3020
2955
|
function createDiagnostics(config, prefix) {
|
|
3021
2956
|
const tag = prefix ? prefix + " " : "";
|
|
3022
2957
|
return {
|
|
@@ -3025,26 +2960,84 @@ var PixodeskAnimator = (() => {
|
|
|
3025
2960
|
config.onWarn({ kind, message, detail });
|
|
3026
2961
|
return;
|
|
3027
2962
|
}
|
|
3028
|
-
if (
|
|
2963
|
+
if (config == null ? void 0 : config.muteWarn) return;
|
|
3029
2964
|
const line = tag + kind + ": " + message;
|
|
3030
2965
|
if (detail === void 0) console.warn(line);
|
|
3031
2966
|
else console.warn(line, detail);
|
|
3032
2967
|
},
|
|
3033
|
-
error: (kind, error) => {
|
|
2968
|
+
error: (kind, error, detail) => {
|
|
3034
2969
|
const err = asError(error);
|
|
3035
2970
|
if (config == null ? void 0 : config.onError) {
|
|
3036
|
-
config.onError({ kind, message: err.message, error: err });
|
|
2971
|
+
config.onError({ kind, message: err.message, error: err, detail });
|
|
3037
2972
|
return;
|
|
3038
2973
|
}
|
|
3039
|
-
if (
|
|
3040
|
-
|
|
2974
|
+
if (config == null ? void 0 : config.muteError) return;
|
|
2975
|
+
const line = tag + kind + ": " + err.message;
|
|
2976
|
+
if (detail === void 0) console.error(line);
|
|
2977
|
+
else console.error(line, detail);
|
|
3041
2978
|
}
|
|
3042
2979
|
};
|
|
3043
2980
|
}
|
|
3044
2981
|
|
|
2982
|
+
// ../svg-animator-core/src/playback/PxScrollMath.ts
|
|
2983
|
+
function isScrollTimeline(config) {
|
|
2984
|
+
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
2985
|
+
}
|
|
2986
|
+
function scrollTotalDurationMs(config) {
|
|
2987
|
+
const duration = typeof (config == null ? void 0 : config.duration) === "number" && config.duration > 0 ? config.duration : PX_DEFAULT_DURATION_MS;
|
|
2988
|
+
const iterations = typeof (config == null ? void 0 : config.iterations) === "number" && config.iterations > 0 ? config.iterations : 1;
|
|
2989
|
+
return duration * iterations;
|
|
2990
|
+
}
|
|
2991
|
+
function scrollPhaseInterval(phase, subjectSize, scrollportSize) {
|
|
2992
|
+
const s = subjectSize, vp = scrollportSize;
|
|
2993
|
+
switch (phase) {
|
|
2994
|
+
case "cover":
|
|
2995
|
+
return [0, s + vp];
|
|
2996
|
+
case "entry":
|
|
2997
|
+
return [0, Math.min(s, vp)];
|
|
2998
|
+
case "contain":
|
|
2999
|
+
return [Math.min(s, vp), Math.max(s, vp)];
|
|
3000
|
+
case "exit":
|
|
3001
|
+
return [Math.max(s, vp), s + vp];
|
|
3002
|
+
case "entry-crossing":
|
|
3003
|
+
return [0, s];
|
|
3004
|
+
case "exit-crossing":
|
|
3005
|
+
return [vp, s + vp];
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
var DEFAULT_PHASE = "cover";
|
|
3009
|
+
function resolveRangePointU(point, defaultFraction, subjectSize, scrollportSize) {
|
|
3010
|
+
var _a;
|
|
3011
|
+
const [u0, u1] = scrollPhaseInterval((_a = point == null ? void 0 : point.phase) != null ? _a : DEFAULT_PHASE, subjectSize, scrollportSize);
|
|
3012
|
+
const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
|
|
3013
|
+
return u0 + fraction * (u1 - u0);
|
|
3014
|
+
}
|
|
3015
|
+
function scrollViewProgress(subjectStart, subjectSize, scrollportSize, range) {
|
|
3016
|
+
const u = scrollportSize - subjectStart;
|
|
3017
|
+
const uStart = resolveRangePointU(range == null ? void 0 : range.start, 0, subjectSize, scrollportSize);
|
|
3018
|
+
const uEnd = resolveRangePointU(range == null ? void 0 : range.end, 1, subjectSize, scrollportSize);
|
|
3019
|
+
if (uEnd <= uStart) return u >= uEnd ? 1 : 0;
|
|
3020
|
+
return clamp((u - uStart) / (uEnd - uStart), 0, 1);
|
|
3021
|
+
}
|
|
3022
|
+
function scrollOffsetProgress(offset, maxOffset, range) {
|
|
3023
|
+
var _a, _b;
|
|
3024
|
+
const raw = maxOffset > 0 ? clamp(offset / maxOffset, 0, 1) : 1;
|
|
3025
|
+
const start = typeof ((_a = range == null ? void 0 : range.start) == null ? void 0 : _a.fraction) === "number" ? range.start.fraction : 0;
|
|
3026
|
+
const end = typeof ((_b = range == null ? void 0 : range.end) == null ? void 0 : _b.fraction) === "number" ? range.end.fraction : 1;
|
|
3027
|
+
if (end <= start) return raw >= end ? 1 : 0;
|
|
3028
|
+
return clamp((raw - start) / (end - start), 0, 1);
|
|
3029
|
+
}
|
|
3030
|
+
function scrollResolveAxis(axis, writingMode) {
|
|
3031
|
+
const a = axis != null ? axis : "block";
|
|
3032
|
+
if (a === "x" || a === "y") return a;
|
|
3033
|
+
const vertical = !!writingMode && writingMode.startsWith("vertical");
|
|
3034
|
+
if (a === "inline") return vertical ? "y" : "x";
|
|
3035
|
+
return vertical ? "x" : "y";
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3045
3038
|
// src/shared/PxAnimatorCallbacks.ts
|
|
3046
3039
|
function toEngineCallbacks(inline) {
|
|
3047
|
-
const { onPlay, onPause, onCancel, onFinish, onRemove, onStop, onWarn, onError,
|
|
3040
|
+
const { onPlay, onPause, onCancel, onFinish, onRemove, onStop, onWarn, onError, muteWarn, muteError } = inline != null ? inline : {};
|
|
3048
3041
|
const withStop = (own) => own || onStop ? () => {
|
|
3049
3042
|
own == null ? void 0 : own();
|
|
3050
3043
|
onStop == null ? void 0 : onStop();
|
|
@@ -3057,18 +3050,47 @@ var PixodeskAnimator = (() => {
|
|
|
3057
3050
|
onRemove: withStop(onRemove),
|
|
3058
3051
|
onWarn,
|
|
3059
3052
|
onError,
|
|
3060
|
-
|
|
3053
|
+
muteWarn,
|
|
3054
|
+
muteError
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
function createInertAnimator() {
|
|
3058
|
+
return {
|
|
3059
|
+
isReady: () => false,
|
|
3060
|
+
getRootElement: () => null,
|
|
3061
|
+
isPlaying: () => false,
|
|
3062
|
+
play: () => {
|
|
3063
|
+
},
|
|
3064
|
+
pause: () => {
|
|
3065
|
+
},
|
|
3066
|
+
cancel: () => {
|
|
3067
|
+
},
|
|
3068
|
+
finish: () => {
|
|
3069
|
+
},
|
|
3070
|
+
setPlaybackRate: () => {
|
|
3071
|
+
},
|
|
3072
|
+
getCurrentTime: () => null,
|
|
3073
|
+
setCurrentTime: () => {
|
|
3074
|
+
},
|
|
3075
|
+
getCurrentProgress: () => null,
|
|
3076
|
+
setCurrentProgress: () => {
|
|
3077
|
+
},
|
|
3078
|
+
destroy: () => {
|
|
3079
|
+
}
|
|
3061
3080
|
};
|
|
3062
3081
|
}
|
|
3082
|
+
function asThrownError(e) {
|
|
3083
|
+
return e instanceof Error ? e : new Error(String(e));
|
|
3084
|
+
}
|
|
3063
3085
|
|
|
3064
3086
|
// src/triggers/PxAnimatorTriggers.ts
|
|
3065
|
-
function setupAnimationTriggers(api,
|
|
3087
|
+
function setupAnimationTriggers(api, trigger, diag) {
|
|
3066
3088
|
const report = diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]");
|
|
3067
3089
|
const cleanups = [];
|
|
3068
3090
|
const dispose = () => {
|
|
3069
3091
|
for (const undo of cleanups.splice(0)) undo();
|
|
3070
3092
|
};
|
|
3071
|
-
const { startOn, outAction, scrollIntoViewThreshold } = resolveTrigger(
|
|
3093
|
+
const { startOn, outAction, scrollIntoViewThreshold } = resolveTrigger(trigger);
|
|
3072
3094
|
const root = api.getRootElement();
|
|
3073
3095
|
if (!root) {
|
|
3074
3096
|
report.warn(PxDiagnosticKind.host, "setupAnimationTriggers: No root element found for animation.");
|
|
@@ -3195,7 +3217,7 @@ var PixodeskAnimator = (() => {
|
|
|
3195
3217
|
diag.warn(PxDiagnosticKind.host, "createFrameLoopAnimator: No root element provided");
|
|
3196
3218
|
}
|
|
3197
3219
|
}
|
|
3198
|
-
const basicApi =
|
|
3220
|
+
const basicApi = createAdapterAnimator(
|
|
3199
3221
|
doc,
|
|
3200
3222
|
adapter || createDomAdapter(rootElement, diag),
|
|
3201
3223
|
callbacks
|
|
@@ -3235,7 +3257,7 @@ var PixodeskAnimator = (() => {
|
|
|
3235
3257
|
const element = elements[i];
|
|
3236
3258
|
const effectiveAttrName = attrName === "transform" && element.tagName === "pattern" ? "patternTransform" : attrName;
|
|
3237
3259
|
element.setAttribute(effectiveAttrName, value);
|
|
3238
|
-
if (
|
|
3260
|
+
if (PX_STYLE_ATTR_NAMES.has(attrName)) {
|
|
3239
3261
|
element.style[attrName] = value;
|
|
3240
3262
|
}
|
|
3241
3263
|
}
|
|
@@ -3246,20 +3268,20 @@ var PixodeskAnimator = (() => {
|
|
|
3246
3268
|
|
|
3247
3269
|
// src/engines/PxAnimatorWebApi.ts
|
|
3248
3270
|
function createCssKf(kf, t, propName, unsupportedSet) {
|
|
3249
|
-
let value =
|
|
3250
|
-
const e =
|
|
3271
|
+
let value = keyframeValue(kf);
|
|
3272
|
+
const e = keyframeEasing(kf);
|
|
3251
3273
|
const cssKf = {
|
|
3252
3274
|
offset: t,
|
|
3253
3275
|
easing: e && Array.isArray(e) ? "cubic-bezier(" + e.join(",") + ")" : void 0
|
|
3254
3276
|
};
|
|
3255
3277
|
let cssValue;
|
|
3256
3278
|
let cssKey = propName;
|
|
3257
|
-
if (
|
|
3279
|
+
if (PX_COLOR_ATTR_NAMES.has(propName) && Array.isArray(value)) {
|
|
3258
3280
|
cssValue = toRGBA(value);
|
|
3259
3281
|
} else if (propName === "transform" && value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
3260
3282
|
cssValue = composeTransformParts(value, { withUnits: true });
|
|
3261
3283
|
cssKey = "transform";
|
|
3262
|
-
} else if (
|
|
3284
|
+
} else if (PX_TRANSFORM_FN_NAMES.has(propName)) {
|
|
3263
3285
|
if (Array.isArray(value)) {
|
|
3264
3286
|
if (propName === "translate") value = value.map((v) => v + "px");
|
|
3265
3287
|
value = value.join(",");
|
|
@@ -3270,7 +3292,7 @@ var PixodeskAnimator = (() => {
|
|
|
3270
3292
|
} else if (propName === "d") {
|
|
3271
3293
|
const paths = value && typeof value === "object" && Array.isArray(value.paths) ? value.paths : [];
|
|
3272
3294
|
cssValue = 'path("' + paths.map((bz) => bezierToSvgPath(bz, true)).join("") + '")';
|
|
3273
|
-
} else if (
|
|
3295
|
+
} else if (PX_PCT_BASED_ATTR_NAMES.has(propName) && typeof value === "number") {
|
|
3274
3296
|
cssValue = value * 100 + "%";
|
|
3275
3297
|
} else {
|
|
3276
3298
|
cssValue = "" + value;
|
|
@@ -3353,7 +3375,7 @@ var PixodeskAnimator = (() => {
|
|
|
3353
3375
|
diag.warn(PxDiagnosticKind.host, "createWebApiAnimator: No root element provided");
|
|
3354
3376
|
}
|
|
3355
3377
|
}
|
|
3356
|
-
const bindings =
|
|
3378
|
+
const bindings = normalizeBindings(doc, PxTimelineEngine.native);
|
|
3357
3379
|
const animations = [];
|
|
3358
3380
|
const _iterations = config.iterations;
|
|
3359
3381
|
let iterations;
|
|
@@ -3835,7 +3857,7 @@ var PixodeskAnimator = (() => {
|
|
|
3835
3857
|
unpin = () => {
|
|
3836
3858
|
};
|
|
3837
3859
|
}
|
|
3838
|
-
const api = (animatorConfig.engine !==
|
|
3860
|
+
const api = (animatorConfig.engine !== PxTimelineEngineSetting.js ? createWebApiAnimator(doc, cb, rootElement, isNativeForced(animatorConfig.engine)) : null) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
3839
3861
|
const subject = ((_a = api.getRootElement) == null ? void 0 : _a.call(api)) || rootElement;
|
|
3840
3862
|
if (subject) {
|
|
3841
3863
|
unpin = applyScrollPin(subject, animatorConfig.scroll);
|
|
@@ -3861,7 +3883,7 @@ var PixodeskAnimator = (() => {
|
|
|
3861
3883
|
});
|
|
3862
3884
|
}
|
|
3863
3885
|
return finaliseAnimator(animatorConfig, callbacks, (cb) => {
|
|
3864
|
-
if (animatorConfig.engine ===
|
|
3886
|
+
if (animatorConfig.engine === PxTimelineEngineSetting.js) {
|
|
3865
3887
|
return createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
3866
3888
|
}
|
|
3867
3889
|
return createWebApiAnimator(
|
|
@@ -3876,8 +3898,18 @@ var PixodeskAnimator = (() => {
|
|
|
3876
3898
|
if (!(options == null ? void 0 : options.doc)) throw new Error("createAnimator: `doc` is required");
|
|
3877
3899
|
return options.doc;
|
|
3878
3900
|
}
|
|
3901
|
+
function buildOrReport(options, build) {
|
|
3902
|
+
try {
|
|
3903
|
+
return build();
|
|
3904
|
+
} catch (e) {
|
|
3905
|
+
const err = asThrownError(e);
|
|
3906
|
+
createDiagnostics(options, "[PxAnimator]").error(PxDiagnosticKind.internal, "createAnimator: could not build the player \u2014 " + err.message, err);
|
|
3907
|
+
return createInertAnimator();
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3879
3910
|
function createPrerenderedAnimator(options) {
|
|
3880
|
-
|
|
3911
|
+
const doc = requireDoc(options);
|
|
3912
|
+
return buildOrReport(options, () => bindWithEngineChoice(doc, void 0, toEngineCallbacks(options), null));
|
|
3881
3913
|
}
|
|
3882
3914
|
|
|
3883
3915
|
// src/shared/PxAnimatorKeys.ts
|