@algorisys/tinyfly 0.70.1 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -8
- package/bin/tinyfly.mjs +95 -2
- package/lib/addons/adapters.js +31 -12
- package/lib/addons/characters.js +204 -0
- package/lib/addons/export.js +476 -440
- package/lib/browser/tinyfly.iife.js +4 -4
- package/lib/browser/tinyfly.js +1352 -1115
- package/lib/browser/tinyfly.umd.js +4 -4
- package/lib/embed/tinyfly-embed.iife.js +1 -1
- package/lib/embed/tinyfly-embed.js +1 -1
- package/lib/engine/tinyfly-engine.js +313 -277
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/headless/headless.js +947 -0
- package/lib/types/adapters/canvas/canvas-adapter.d.ts +32 -2
- package/lib/types/browser/index.d.ts +3 -1
- package/lib/types/characters/index.d.ts +5 -0
- package/lib/types/characters/stick-figure.d.ts +162 -0
- package/lib/types/engine/authoring/index.d.ts +1 -0
- package/lib/types/engine/authoring/narration.d.ts +80 -0
- package/lib/types/engine/export/captions.d.ts +31 -0
- package/lib/types/engine/export/index.d.ts +1 -0
- package/lib/types/headless/ffmpeg-args.d.ts +28 -0
- package/lib/types/headless/frame-renderer.d.ts +45 -0
- package/lib/types/headless/index.d.ts +12 -0
- package/lib/types/headless/narration-audio.d.ts +13 -0
- package/lib/types/headless/node-audio.d.ts +46 -0
- package/lib/types/headless/node-video.d.ts +48 -0
- package/lib/types/headless/scene-captions.d.ts +4 -0
- package/lib/types/headless/video-scene.d.ts +57 -0
- package/package.json +19 -4
|
@@ -5,25 +5,25 @@ function _t(t) {
|
|
|
5
5
|
return typeof t == "object" && t !== null && t.type !== "cubic-bezier";
|
|
6
6
|
}
|
|
7
7
|
const rt = 1;
|
|
8
|
-
function
|
|
8
|
+
function kt(t) {
|
|
9
9
|
return t.property === "text" && "textConfig" in t;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function U(t) {
|
|
12
12
|
return t.kind === "inertia" && "inertia" in t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function V(t) {
|
|
15
15
|
return t.kind === "spring" && "spring" in t;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Ht(t) {
|
|
18
18
|
return t.property === "motionPath" && "motionPathConfig" in t;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function Fn(t) {
|
|
21
21
|
return typeof t == "object" && t !== null && "x" in t && "y" in t && "angle" in t;
|
|
22
22
|
}
|
|
23
23
|
function ge(t) {
|
|
24
24
|
return "keyframes" in t;
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class On {
|
|
27
27
|
_currentTime = 0;
|
|
28
28
|
_isRunning = !1;
|
|
29
29
|
onTick = null;
|
|
@@ -49,7 +49,7 @@ class En {
|
|
|
49
49
|
this._currentTime = e;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
class
|
|
52
|
+
class Nn {
|
|
53
53
|
_currentTime = 0;
|
|
54
54
|
_isRunning = !1;
|
|
55
55
|
_lastFrameTime = null;
|
|
@@ -132,17 +132,17 @@ function qt(t, e, n) {
|
|
|
132
132
|
function ye(t, e) {
|
|
133
133
|
return Array.from({ length: t }, (n, s) => qt(s, t, e));
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function xt(t, e) {
|
|
136
136
|
return t <= 1 ? 0 : Math.max(...ye(t, e));
|
|
137
137
|
}
|
|
138
|
-
const
|
|
138
|
+
const G = 1, Wt = 6e4, et = Wt / G, C = {
|
|
139
139
|
stiffness: 180,
|
|
140
140
|
damping: 12,
|
|
141
141
|
mass: 1,
|
|
142
142
|
velocity: 0,
|
|
143
143
|
restDelta: 0.01,
|
|
144
144
|
restSpeed: 0.1
|
|
145
|
-
},
|
|
145
|
+
}, Xn = {
|
|
146
146
|
gentle: { stiffness: 120, damping: 18, mass: 1 },
|
|
147
147
|
default: { stiffness: 180, damping: 12, mass: 1 },
|
|
148
148
|
snappy: { stiffness: 280, damping: 20, mass: 1 },
|
|
@@ -175,7 +175,7 @@ class it {
|
|
|
175
175
|
/** Once at rest we stop simulating; every later time returns `to`. */
|
|
176
176
|
settledStep = null;
|
|
177
177
|
constructor(e) {
|
|
178
|
-
this.from = e.from, this.to = e.to, this.stiffness = e.stiffness ??
|
|
178
|
+
this.from = e.from, this.to = e.to, this.stiffness = e.stiffness ?? C.stiffness, this.damping = e.damping ?? C.damping, this.mass = e.mass ?? C.mass, this.restDelta = e.restDelta ?? C.restDelta, this.restSpeed = e.restSpeed ?? C.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = e.velocity ?? C.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Whether a position/velocity pair counts as settled.
|
|
@@ -193,10 +193,10 @@ class it {
|
|
|
193
193
|
*/
|
|
194
194
|
valueAt(e) {
|
|
195
195
|
if (e <= 0) return this.from;
|
|
196
|
-
const n = Math.floor(e /
|
|
196
|
+
const n = Math.floor(e / G);
|
|
197
197
|
if (this.simulateTo(n + 1), this.settledStep !== null && n >= this.settledStep)
|
|
198
198
|
return this.to;
|
|
199
|
-
const s = this.samples[Math.min(n, this.samples.length - 1)], r = this.samples[Math.min(n + 1, this.samples.length - 1)], i = e /
|
|
199
|
+
const s = this.samples[Math.min(n, this.samples.length - 1)], r = this.samples[Math.min(n + 1, this.samples.length - 1)], i = e / G - n;
|
|
200
200
|
return s + (r - s) * i;
|
|
201
201
|
}
|
|
202
202
|
/**
|
|
@@ -204,12 +204,12 @@ class it {
|
|
|
204
204
|
* of a spring track. Runs the simulation to completion once.
|
|
205
205
|
*/
|
|
206
206
|
settleTime() {
|
|
207
|
-
return this.simulateTo(et + 1), this.settledStep !== null ? this.settledStep *
|
|
207
|
+
return this.simulateTo(et + 1), this.settledStep !== null ? this.settledStep * G : Wt;
|
|
208
208
|
}
|
|
209
209
|
/** Advance the cached simulation until it holds at least `steps` samples. */
|
|
210
210
|
simulateTo(e) {
|
|
211
211
|
if (this.settledStep !== null) return;
|
|
212
|
-
const n = Math.min(e, et + 1), s =
|
|
212
|
+
const n = Math.min(e, et + 1), s = G / 1e3;
|
|
213
213
|
for (; this.samples.length < n; ) {
|
|
214
214
|
const r = this.samples[this.samples.length - 1], i = r - this.to, a = -this.stiffness * i, o = -this.damping * this.velocity, c = (a + o) / this.mass;
|
|
215
215
|
this.velocity += c * s;
|
|
@@ -222,18 +222,18 @@ class it {
|
|
|
222
222
|
this.samples.length > et && (this.settledStep = et);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function Yn(t, e) {
|
|
226
226
|
return new it(t).valueAt(e);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Un(t) {
|
|
229
229
|
return new it(t).settleTime();
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
const e = t.stiffness ??
|
|
231
|
+
function Vn(t) {
|
|
232
|
+
const e = t.stiffness ?? C.stiffness, n = t.damping ?? C.damping, s = t.mass ?? C.mass;
|
|
233
233
|
return n < 2 * Math.sqrt(e * s);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
const e = t.stiffness ??
|
|
235
|
+
function Hn(t) {
|
|
236
|
+
const e = t.stiffness ?? C.stiffness, n = t.mass ?? C.mass;
|
|
237
237
|
return 2 * Math.sqrt(e * n);
|
|
238
238
|
}
|
|
239
239
|
const wt = 4, _e = 2e-3, Me = 1e-4, Te = 6e4;
|
|
@@ -244,7 +244,7 @@ function at(t) {
|
|
|
244
244
|
function be(t) {
|
|
245
245
|
return t.from + t.velocity / at(t);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function ke(t, e) {
|
|
248
248
|
if (e === void 0) return t;
|
|
249
249
|
if (typeof e == "number")
|
|
250
250
|
return e > 0 ? Math.round(t / e) * e : t;
|
|
@@ -255,7 +255,7 @@ function xe(t, e) {
|
|
|
255
255
|
return n;
|
|
256
256
|
}
|
|
257
257
|
function ot(t) {
|
|
258
|
-
let e =
|
|
258
|
+
let e = ke(be(t), t.end);
|
|
259
259
|
return t.min !== void 0 && (e = Math.max(t.min, e)), t.max !== void 0 && (e = Math.min(t.max, e)), e;
|
|
260
260
|
}
|
|
261
261
|
function ct(t) {
|
|
@@ -273,48 +273,48 @@ function Mt(t, e) {
|
|
|
273
273
|
const s = at(t);
|
|
274
274
|
return t.from + (n - t.from) * (1 - Math.exp(-s * e / 1e3));
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function zn(t, e) {
|
|
277
277
|
const n = at(t), s = ot(t);
|
|
278
278
|
return e >= ct(t) ? 0 : (s - t.from) * n * Math.exp(-n * Math.max(0, e) / 1e3);
|
|
279
279
|
}
|
|
280
|
-
const Tt = (t) => t,
|
|
280
|
+
const Tt = (t) => t, xe = (t) => t * t, ve = (t) => 1 - (1 - t) * (1 - t), Se = (t) => t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2, jt = (t) => t * t * t, Kt = (t) => 1 - Math.pow(1 - t, 3), Qt = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, Ae = jt, we = Kt, Pe = Qt, $e = {
|
|
281
281
|
linear: Tt,
|
|
282
282
|
"ease-in": Ae,
|
|
283
283
|
"ease-out": we,
|
|
284
284
|
"ease-in-out": Pe,
|
|
285
|
-
"ease-in-quad":
|
|
285
|
+
"ease-in-quad": xe,
|
|
286
286
|
"ease-out-quad": ve,
|
|
287
287
|
"ease-in-out-quad": Se,
|
|
288
288
|
"ease-in-cubic": jt,
|
|
289
289
|
"ease-out-cubic": Kt,
|
|
290
290
|
"ease-in-out-cubic": Qt
|
|
291
291
|
};
|
|
292
|
-
function
|
|
293
|
-
const [e, n, s, r] = t, i = 3 * e, a = 3 * (s - e) - i, o = 1 - i - a, c = 3 * n, u = 3 * (r - n) - c, l = 1 - c - u, h = (
|
|
294
|
-
let g =
|
|
292
|
+
function Re(t) {
|
|
293
|
+
const [e, n, s, r] = t, i = 3 * e, a = 3 * (s - e) - i, o = 1 - i - a, c = 3 * n, u = 3 * (r - n) - c, l = 1 - c - u, h = (d) => ((o * d + a) * d + i) * d, p = (d) => ((l * d + u) * d + c) * d, f = (d) => (3 * o * d + 2 * a) * d + i, M = (d) => {
|
|
294
|
+
let g = d;
|
|
295
295
|
for (let T = 0; T < 8; T++) {
|
|
296
|
-
const
|
|
297
|
-
if (Math.abs(
|
|
296
|
+
const k = h(g) - d;
|
|
297
|
+
if (Math.abs(k) < 1e-7)
|
|
298
298
|
return g;
|
|
299
299
|
const m = f(g);
|
|
300
300
|
if (Math.abs(m) < 1e-7)
|
|
301
301
|
break;
|
|
302
|
-
g -=
|
|
302
|
+
g -= k / m;
|
|
303
303
|
}
|
|
304
304
|
let y = 0, _ = 1;
|
|
305
|
-
for (g =
|
|
305
|
+
for (g = d; y < _; ) {
|
|
306
306
|
const T = h(g);
|
|
307
|
-
if (Math.abs(T -
|
|
307
|
+
if (Math.abs(T - d) < 1e-7)
|
|
308
308
|
return g;
|
|
309
|
-
|
|
309
|
+
d > T ? y = g : _ = g, g = (y + _) / 2;
|
|
310
310
|
}
|
|
311
311
|
return g;
|
|
312
312
|
};
|
|
313
|
-
return (
|
|
314
|
-
if (
|
|
315
|
-
if (
|
|
316
|
-
const g = M(
|
|
317
|
-
return
|
|
313
|
+
return (d) => {
|
|
314
|
+
if (d <= 0) return 0;
|
|
315
|
+
if (d >= 1) return 1;
|
|
316
|
+
const g = M(d);
|
|
317
|
+
return p(g);
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
function ht(t, e = "out") {
|
|
@@ -322,11 +322,11 @@ function ht(t, e = "out") {
|
|
|
322
322
|
const n = (s) => 1 - t(1 - s);
|
|
323
323
|
return e === "in" ? n : (s) => s < 0.5 ? n(s * 2) / 2 : t(s * 2 - 1) / 2 + 0.5;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function De(t = 1, e = 0.3) {
|
|
326
326
|
const n = Math.max(1, t), s = e / (2 * Math.PI) * Math.asin(1 / n);
|
|
327
327
|
return (r) => r <= 0 ? 0 : r >= 1 ? 1 : n * Math.pow(2, -10 * r) * Math.sin((r - s) * (2 * Math.PI) / e) + 1;
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const Ce = (t) => {
|
|
330
330
|
if (t <= 0) return 0;
|
|
331
331
|
if (t >= 1) return 1;
|
|
332
332
|
if (t < 1 / 2.75) return 7.5625 * t * t;
|
|
@@ -341,7 +341,7 @@ const $e = (t) => {
|
|
|
341
341
|
const s = t - 2.625 / 2.75;
|
|
342
342
|
return 7.5625 * s * s + 0.984375;
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function Ie(t = 1.70158) {
|
|
345
345
|
return (e) => {
|
|
346
346
|
if (e <= 0) return 0;
|
|
347
347
|
if (e >= 1) return 1;
|
|
@@ -372,17 +372,17 @@ function Le(t) {
|
|
|
372
372
|
case "steps":
|
|
373
373
|
return Ee(t.count, t.position);
|
|
374
374
|
case "elastic":
|
|
375
|
-
return ht(
|
|
375
|
+
return ht(De(t.amplitude, t.period), t.mode);
|
|
376
376
|
case "bounce":
|
|
377
|
-
return ht(
|
|
377
|
+
return ht(Ce, t.mode);
|
|
378
378
|
case "back":
|
|
379
|
-
return ht(
|
|
379
|
+
return ht(Ie(t.overshoot), t.mode);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
function
|
|
383
|
-
return t === void 0 ? Tt : de(t) ?
|
|
382
|
+
function Gt(t) {
|
|
383
|
+
return t === void 0 ? Tt : de(t) ? Re(t.points) : _t(t) ? Le(t) : $e[t] ?? Tt;
|
|
384
384
|
}
|
|
385
|
-
const Pt = 32,
|
|
385
|
+
const Pt = 32, Fe = 256, z = /* @__PURE__ */ new Map(), Oe = /[MmLlHhVvCcSsQqTtAaZz]/, Ne = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Xe = {
|
|
386
386
|
M: 2,
|
|
387
387
|
L: 2,
|
|
388
388
|
H: 1,
|
|
@@ -402,7 +402,7 @@ function Ye(t) {
|
|
|
402
402
|
};
|
|
403
403
|
for (; n < t.length && (r(), !(n >= t.length)); ) {
|
|
404
404
|
const i = t[n];
|
|
405
|
-
if (
|
|
405
|
+
if (Oe.test(i)) {
|
|
406
406
|
s = { type: i, args: [] }, e.push(s), n++;
|
|
407
407
|
continue;
|
|
408
408
|
}
|
|
@@ -419,31 +419,31 @@ function Ye(t) {
|
|
|
419
419
|
}
|
|
420
420
|
return e;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function Ue(t, e, n, s, r, i, a, o, c) {
|
|
423
423
|
if (t === o && e === c) return [];
|
|
424
424
|
let u = Math.abs(n), l = Math.abs(s);
|
|
425
425
|
if (u === 0 || l === 0) return [[t, e, o, c, o, c]];
|
|
426
|
-
const h = r * Math.PI / 180,
|
|
426
|
+
const h = r * Math.PI / 180, p = Math.cos(h), f = Math.sin(h), M = (t - o) / 2, d = (e - c) / 2, g = p * M + f * d, y = -f * M + p * d, _ = g * g / (u * u) + y * y / (l * l);
|
|
427
427
|
if (_ > 1) {
|
|
428
428
|
const S = Math.sqrt(_);
|
|
429
429
|
u *= S, l *= S;
|
|
430
430
|
}
|
|
431
|
-
const T = i === a ? -1 : 1,
|
|
432
|
-
const lt = S *
|
|
433
|
-
return S *
|
|
434
|
-
}, w =
|
|
435
|
-
let P =
|
|
431
|
+
const T = i === a ? -1 : 1, k = u * u * l * l - u * u * y * y - l * l * g * g, m = u * u * y * y + l * l * g * g, x = T * Math.sqrt(Math.max(0, k / m)), b = x * u * y / l, L = -x * l * g / u, Z = p * b - f * L + (t + o) / 2, v = f * b + p * L + (e + c) / 2, R = (S, $, D, H) => {
|
|
432
|
+
const lt = S * D + $ * H, tt = Math.sqrt((S * S + $ * $) * (D * D + H * H)), j = Math.acos(Math.max(-1, Math.min(1, lt / tt)));
|
|
433
|
+
return S * H - $ * D < 0 ? -j : j;
|
|
434
|
+
}, w = R(1, 0, (g - b) / u, (y - L) / l);
|
|
435
|
+
let P = R((g - b) / u, (y - L) / l, (-g - b) / u, (-y - L) / l);
|
|
436
436
|
!a && P > 0 && (P -= 2 * Math.PI), a && P < 0 && (P += 2 * Math.PI);
|
|
437
437
|
const X = Math.max(1, Math.ceil(Math.abs(P) / (Math.PI / 2))), ut = P / X, J = 4 / 3 * Math.tan(ut / 4), vt = (S) => {
|
|
438
|
-
const
|
|
439
|
-
return [
|
|
438
|
+
const $ = u * Math.cos(S), D = l * Math.sin(S);
|
|
439
|
+
return [p * $ - f * D + Z, f * $ + p * D + v];
|
|
440
440
|
}, St = (S) => {
|
|
441
|
-
const
|
|
442
|
-
return [
|
|
441
|
+
const $ = -u * Math.sin(S), D = l * Math.cos(S);
|
|
442
|
+
return [p * $ - f * D, f * $ + p * D];
|
|
443
443
|
}, At = [];
|
|
444
444
|
for (let S = 0; S < X; S++) {
|
|
445
|
-
const
|
|
446
|
-
At.push([
|
|
445
|
+
const $ = w + S * ut, D = $ + ut, [H, lt] = vt($), [tt, j] = S === X - 1 ? [o, c] : vt(D), [le, he] = St($), [fe, pe] = St(D);
|
|
446
|
+
At.push([H + J * le, lt + J * he, tt - J * fe, j - J * pe, tt, j]);
|
|
447
447
|
}
|
|
448
448
|
return At;
|
|
449
449
|
}
|
|
@@ -451,7 +451,7 @@ function N(t, e, n, s, r) {
|
|
|
451
451
|
const i = 1 - r;
|
|
452
452
|
return i * i * i * t + 3 * i * i * r * e + 3 * i * r * r * n + r * r * r * s;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function $t(t, e, n, s, r) {
|
|
455
455
|
const i = 1 - r;
|
|
456
456
|
return 3 * i * i * (e - t) + 6 * i * r * (n - e) + 3 * r * r * (s - n);
|
|
457
457
|
}
|
|
@@ -469,10 +469,10 @@ function K(t, e, n, s) {
|
|
|
469
469
|
}
|
|
470
470
|
function nt(t, e, n) {
|
|
471
471
|
const [s, r, i, a, o, c] = n, u = [0];
|
|
472
|
-
let l = t, h = e,
|
|
472
|
+
let l = t, h = e, p = 0;
|
|
473
473
|
for (let f = 1; f <= Pt; f++) {
|
|
474
|
-
const M = f / Pt,
|
|
475
|
-
|
|
474
|
+
const M = f / Pt, d = N(t, s, i, o, M), g = N(e, r, a, c, M);
|
|
475
|
+
p += Math.hypot(d - l, g - h), u.push(p), l = d, h = g;
|
|
476
476
|
}
|
|
477
477
|
return {
|
|
478
478
|
subpath: 0,
|
|
@@ -482,7 +482,7 @@ function nt(t, e, n) {
|
|
|
482
482
|
startY: e,
|
|
483
483
|
endX: o,
|
|
484
484
|
endY: c,
|
|
485
|
-
length:
|
|
485
|
+
length: p,
|
|
486
486
|
lengths: u
|
|
487
487
|
};
|
|
488
488
|
}
|
|
@@ -491,82 +491,82 @@ function q(t) {
|
|
|
491
491
|
if (e) return e;
|
|
492
492
|
const n = [];
|
|
493
493
|
let s = 0, r = 0, i = 0, a = 0, o = null, c = null, u = -1;
|
|
494
|
-
const l = /* @__PURE__ */ new Set(), h = (
|
|
495
|
-
u < 0 && (u = 0),
|
|
494
|
+
const l = /* @__PURE__ */ new Set(), h = (d) => {
|
|
495
|
+
u < 0 && (u = 0), d.subpath = u, n.push(d);
|
|
496
496
|
};
|
|
497
|
-
for (const { type:
|
|
498
|
-
const y =
|
|
497
|
+
for (const { type: d, args: g } of Ye(t)) {
|
|
498
|
+
const y = d.toUpperCase(), _ = d !== y, T = Xe[y];
|
|
499
499
|
if (y === "Z") {
|
|
500
500
|
(s !== i || r !== a) && h(K(s, r, i, a)), u >= 0 && l.add(u), s = i, r = a, o = c = null;
|
|
501
501
|
continue;
|
|
502
502
|
}
|
|
503
|
-
for (let
|
|
504
|
-
const m = g.slice(
|
|
503
|
+
for (let k = 0; k + T <= g.length; k += T) {
|
|
504
|
+
const m = g.slice(k, k + T), x = _ ? s : 0, b = _ ? r : 0;
|
|
505
505
|
let L = null, Z = null;
|
|
506
506
|
switch (y) {
|
|
507
507
|
case "M":
|
|
508
|
-
|
|
508
|
+
k === 0 ? (s = m[0] + x, r = m[1] + b, i = s, a = r, (u < 0 || n[n.length - 1]?.subpath === u) && u++) : (h(K(s, r, m[0] + x, m[1] + b)), s = m[0] + x, r = m[1] + b);
|
|
509
509
|
break;
|
|
510
510
|
case "L":
|
|
511
|
-
h(K(s, r, m[0] +
|
|
511
|
+
h(K(s, r, m[0] + x, m[1] + b)), s = m[0] + x, r = m[1] + b;
|
|
512
512
|
break;
|
|
513
513
|
case "H":
|
|
514
|
-
h(K(s, r, m[0] +
|
|
514
|
+
h(K(s, r, m[0] + x, r)), s = m[0] + x;
|
|
515
515
|
break;
|
|
516
516
|
case "V":
|
|
517
517
|
h(K(s, r, s, m[0] + b)), r = m[0] + b;
|
|
518
518
|
break;
|
|
519
519
|
case "C": {
|
|
520
|
-
const v = [m[0] +
|
|
520
|
+
const v = [m[0] + x, m[1] + b, m[2] + x, m[3] + b, m[4] + x, m[5] + b];
|
|
521
521
|
h(nt(s, r, v)), L = [v[2], v[3]], s = v[4], r = v[5];
|
|
522
522
|
break;
|
|
523
523
|
}
|
|
524
524
|
case "S": {
|
|
525
|
-
const [v,
|
|
525
|
+
const [v, R] = o ? [2 * s - o[0], 2 * r - o[1]] : [s, r], w = [v, R, m[0] + x, m[1] + b, m[2] + x, m[3] + b];
|
|
526
526
|
h(nt(s, r, w)), L = [w[2], w[3]], s = w[4], r = w[5];
|
|
527
527
|
break;
|
|
528
528
|
}
|
|
529
529
|
case "Q":
|
|
530
530
|
case "T": {
|
|
531
|
-
let v = s,
|
|
532
|
-
y === "Q" ? (v = m[0] +
|
|
533
|
-
const w = y === "Q" ? m[2] +
|
|
531
|
+
let v = s, R = r;
|
|
532
|
+
y === "Q" ? (v = m[0] + x, R = m[1] + b) : c && (v = 2 * s - c[0], R = 2 * r - c[1]);
|
|
533
|
+
const w = y === "Q" ? m[2] + x : m[0] + x, P = y === "Q" ? m[3] + b : m[1] + b;
|
|
534
534
|
h(
|
|
535
535
|
nt(s, r, [
|
|
536
536
|
s + 2 / 3 * (v - s),
|
|
537
|
-
r + 2 / 3 * (
|
|
537
|
+
r + 2 / 3 * (R - r),
|
|
538
538
|
w + 2 / 3 * (v - w),
|
|
539
|
-
P + 2 / 3 * (
|
|
539
|
+
P + 2 / 3 * (R - P),
|
|
540
540
|
w,
|
|
541
541
|
P
|
|
542
542
|
])
|
|
543
|
-
), Z = [v,
|
|
543
|
+
), Z = [v, R], s = w, r = P;
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
case "A": {
|
|
547
|
-
const v = m[5] +
|
|
547
|
+
const v = m[5] + x, R = m[6] + b;
|
|
548
548
|
let w = s, P = r;
|
|
549
|
-
for (const X of
|
|
549
|
+
for (const X of Ue(s, r, m[0], m[1], m[2], m[3], m[4], v, R))
|
|
550
550
|
h(nt(w, P, X)), w = X[4], P = X[5];
|
|
551
|
-
s = v, r =
|
|
551
|
+
s = v, r = R;
|
|
552
552
|
break;
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
o = L, c = Z;
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
const
|
|
559
|
-
for (let
|
|
560
|
-
const g = n[
|
|
561
|
-
let y =
|
|
558
|
+
const p = n.reduce((d, g) => d + g.length, 0), f = [];
|
|
559
|
+
for (let d = 0; d < n.length; ) {
|
|
560
|
+
const g = n[d].subpath;
|
|
561
|
+
let y = d, _ = 0;
|
|
562
562
|
for (; y < n.length && n[y].subpath === g; ) _ += n[y++].length;
|
|
563
|
-
const T = n[
|
|
564
|
-
f.push({ start:
|
|
563
|
+
const T = n[d], k = n[y - 1], m = l.has(g) || Math.abs(k.endX - T.startX) < 1e-9 && Math.abs(k.endY - T.startY) < 1e-9;
|
|
564
|
+
f.push({ start: d, end: y, length: _, closed: m }), d = y;
|
|
565
565
|
}
|
|
566
|
-
const M = { segments: n, totalLength:
|
|
567
|
-
return z.size >=
|
|
566
|
+
const M = { segments: n, totalLength: p, subpaths: f };
|
|
567
|
+
return z.size >= Fe && z.delete(z.keys().next().value), z.set(t, M), M;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Ve(t, e) {
|
|
570
570
|
const n = t.lengths;
|
|
571
571
|
if (e <= 0) return 0;
|
|
572
572
|
if (e >= t.length) return 1;
|
|
@@ -578,7 +578,7 @@ function He(t, e) {
|
|
|
578
578
|
const i = n[r] - n[s], a = i > 0 ? (e - n[s]) / i : 0;
|
|
579
579
|
return (s + a) / (n.length - 1);
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function He(t, e) {
|
|
582
582
|
if (t.type === "L") {
|
|
583
583
|
const h = t.length > 0 ? Math.max(0, Math.min(1, e / t.length)) : 0;
|
|
584
584
|
return {
|
|
@@ -587,11 +587,11 @@ function Ue(t, e) {
|
|
|
587
587
|
angle: Math.atan2(t.endY - t.startY, t.endX - t.startX) * 180 / Math.PI
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
|
-
const [n, s, r, i, a, o] = t.points, c =
|
|
591
|
-
let u =
|
|
590
|
+
const [n, s, r, i, a, o] = t.points, c = Ve(t, e);
|
|
591
|
+
let u = $t(t.startX, n, r, a, c), l = $t(t.startY, s, i, o, c);
|
|
592
592
|
if (Math.hypot(u, l) < 1e-9) {
|
|
593
|
-
const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3),
|
|
594
|
-
u = c < 0.5 ?
|
|
593
|
+
const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), p = N(t.startX, n, r, a, h), f = N(t.startY, s, i, o, h), M = N(t.startX, n, r, a, c), d = N(t.startY, s, i, o, c);
|
|
594
|
+
u = c < 0.5 ? p - M : M - p, l = c < 0.5 ? f - d : d - f;
|
|
595
595
|
}
|
|
596
596
|
return {
|
|
597
597
|
x: N(t.startX, n, r, a, c),
|
|
@@ -599,31 +599,31 @@ function Ue(t, e) {
|
|
|
599
599
|
angle: Math.atan2(l, u) * 180 / Math.PI
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Bt(t, e, n = 0, s = t.length) {
|
|
603
603
|
if (s <= n) return { x: 0, y: 0, angle: 0 };
|
|
604
604
|
let r = 0;
|
|
605
605
|
for (let i = n; i < s; i++) {
|
|
606
606
|
const a = t[i];
|
|
607
607
|
if (r + a.length >= e || i === s - 1)
|
|
608
|
-
return
|
|
608
|
+
return He(a, e - r);
|
|
609
609
|
r += a.length;
|
|
610
610
|
}
|
|
611
611
|
return { x: 0, y: 0, angle: 0 };
|
|
612
612
|
}
|
|
613
613
|
function ze(t, e) {
|
|
614
614
|
const { segments: n, totalLength: s } = q(t);
|
|
615
|
-
return
|
|
615
|
+
return Bt(n, Math.max(0, Math.min(1, e)) * s);
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function qn() {
|
|
618
618
|
z.clear();
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function Wn(t) {
|
|
621
621
|
return q(t).totalLength;
|
|
622
622
|
}
|
|
623
|
-
const qe = 24, We = 320, je = 2.5, Q = 72,
|
|
624
|
-
let st = 0,
|
|
625
|
-
const
|
|
626
|
-
function
|
|
623
|
+
const qe = 24, We = 320, je = 2.5, Q = 72, jn = 64, Ke = 0.2, Qe = 128, B = /* @__PURE__ */ new Map();
|
|
624
|
+
let st = 0, O;
|
|
625
|
+
const Rt = (t) => Math.round(t * 100) / 100;
|
|
626
|
+
function Dt(t, e) {
|
|
627
627
|
const { segments: n, subpaths: s, totalLength: r } = q(t);
|
|
628
628
|
if (n.length === 0) return [];
|
|
629
629
|
if (e) {
|
|
@@ -633,17 +633,17 @@ function It(t, e) {
|
|
|
633
633
|
return s.filter((i) => i.length > 0).map((i) => ({ segments: n, start: i.start, end: i.end, length: i.length, closed: i.closed }));
|
|
634
634
|
}
|
|
635
635
|
function bt(t, e) {
|
|
636
|
-
const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)), s =
|
|
636
|
+
const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)), s = Bt(t.segments, n * t.length, t.start, t.end);
|
|
637
637
|
return [s.x, s.y];
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function Ct(t) {
|
|
640
640
|
const e = [];
|
|
641
641
|
let n = 0;
|
|
642
642
|
for (let s = t.start; s < t.end; s++)
|
|
643
643
|
n += t.segments[s].length, t.length > 0 && e.push(n / t.length);
|
|
644
644
|
return e;
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function It(t, e) {
|
|
647
647
|
const n = [];
|
|
648
648
|
for (let s = 0; s < e; s++)
|
|
649
649
|
n.push(bt(t, t.closed ? s / e : s / (e - 1)));
|
|
@@ -655,44 +655,44 @@ function Et(t) {
|
|
|
655
655
|
e += s, n += r;
|
|
656
656
|
return e /= t.length, n /= t.length, t.map(([s, r]) => [s - e, r - n]);
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Ge(t, e, n) {
|
|
659
659
|
const s = t.closed && e.closed;
|
|
660
660
|
if (n !== void 0)
|
|
661
661
|
return { offset: s ? Math.abs(n) % Q / Q : 0, reversed: n < 0 };
|
|
662
|
-
const r = Et(
|
|
662
|
+
const r = Et(It(t, Q)), i = Et(It(e, Q)), a = Q;
|
|
663
663
|
let o = { offset: 0, reversed: !1 }, c = 1 / 0;
|
|
664
664
|
for (const u of [!1, !0]) {
|
|
665
665
|
const l = s ? a : 1;
|
|
666
666
|
for (let h = 0; h < l; h++) {
|
|
667
|
-
let
|
|
668
|
-
for (let f = 0; f < a &&
|
|
669
|
-
const M = s ? u ? (h - f + a) % a : (f + h) % a : u ? a - 1 - f : f,
|
|
670
|
-
|
|
667
|
+
let p = 0;
|
|
668
|
+
for (let f = 0; f < a && p < c; f++) {
|
|
669
|
+
const M = s ? u ? (h - f + a) % a : (f + h) % a : u ? a - 1 - f : f, d = r[f][0] - i[M][0], g = r[f][1] - i[M][1];
|
|
670
|
+
p += d * d + g * g;
|
|
671
671
|
}
|
|
672
|
-
|
|
672
|
+
p < c && (c = p, o = { offset: s ? h / a : 0, reversed: u });
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
675
|
return o;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function Be(t, e, n) {
|
|
678
678
|
return n ? ((e.reversed ? e.offset - t : t + e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
|
|
679
679
|
}
|
|
680
680
|
function Ze(t, e, n) {
|
|
681
681
|
return n ? ((e.reversed ? e.offset - t : t - e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
|
|
682
682
|
}
|
|
683
683
|
function Je(t, e, n) {
|
|
684
|
-
const s = t.closed && e.closed, r =
|
|
684
|
+
const s = t.closed && e.closed, r = Ge(t, e, n.shapeIndex), i = Math.max(
|
|
685
685
|
qe,
|
|
686
686
|
Math.min(We, Math.ceil(Math.max(t.length, e.length) / je))
|
|
687
687
|
), a = /* @__PURE__ */ new Set(), o = (h) => a.add(Math.round(h * 1e7) / 1e7);
|
|
688
688
|
for (let h = 0; h <= i; h++) o(h / i);
|
|
689
|
-
for (const h of
|
|
690
|
-
for (const h of
|
|
691
|
-
let c = [...a].sort((h,
|
|
689
|
+
for (const h of Ct(t)) o(h);
|
|
690
|
+
for (const h of Ct(e)) o(Ze(h, r, s));
|
|
691
|
+
let c = [...a].sort((h, p) => h - p);
|
|
692
692
|
s && (c = c.filter((h) => h < 1));
|
|
693
693
|
const u = [], l = [];
|
|
694
694
|
for (const h of c)
|
|
695
|
-
u.push(...bt(t, h)), l.push(...bt(e,
|
|
695
|
+
u.push(...bt(t, h)), l.push(...bt(e, Be(h, r, s)));
|
|
696
696
|
return tn({ from: u, to: l, closed: s });
|
|
697
697
|
}
|
|
698
698
|
function tn(t) {
|
|
@@ -721,18 +721,18 @@ function Lt(t, e, n, s) {
|
|
|
721
721
|
}
|
|
722
722
|
function en(t, e, n) {
|
|
723
723
|
const s = n.shapeIndex;
|
|
724
|
-
if (
|
|
725
|
-
const i =
|
|
724
|
+
if (O && O.from === t && O.to === e && O.shapeIndex === s) return O.plan;
|
|
725
|
+
const i = B.get(String(s ?? "auto"))?.get(t)?.get(e);
|
|
726
726
|
if (i)
|
|
727
|
-
return
|
|
728
|
-
const a = q(t).subpaths.filter((f) => f.length > 0).length === q(e).subpaths.filter((f) => f.length > 0).length, o =
|
|
727
|
+
return O = { from: t, to: e, shapeIndex: s, plan: i }, i;
|
|
728
|
+
const a = q(t).subpaths.filter((f) => f.length > 0).length === q(e).subpaths.filter((f) => f.length > 0).length, o = Dt(t, !a), c = Dt(e, !a), u = {
|
|
729
729
|
pairs: o.map((f, M) => Je(f, c[M], n))
|
|
730
730
|
};
|
|
731
|
-
st >= Qe && (
|
|
732
|
-
const l = String(s ?? "auto"), h =
|
|
733
|
-
|
|
734
|
-
const
|
|
735
|
-
return h.set(t,
|
|
731
|
+
st >= Qe && (B.clear(), st = 0);
|
|
732
|
+
const l = String(s ?? "auto"), h = B.get(l) ?? /* @__PURE__ */ new Map();
|
|
733
|
+
B.set(l, h);
|
|
734
|
+
const p = h.get(t) ?? /* @__PURE__ */ new Map();
|
|
735
|
+
return h.set(t, p), p.set(e, u), st++, O = { from: t, to: e, shapeIndex: s, plan: u }, u;
|
|
736
736
|
}
|
|
737
737
|
function nn(t, e, n, s = {}) {
|
|
738
738
|
if (!t) return e;
|
|
@@ -745,21 +745,21 @@ function nn(t, e, n, s = {}) {
|
|
|
745
745
|
let a = "";
|
|
746
746
|
for (const o of i.pairs) {
|
|
747
747
|
for (let c = 0; c < o.from.length; c += 2) {
|
|
748
|
-
const u =
|
|
748
|
+
const u = Rt(o.from[c] + (o.to[c] - o.from[c]) * r), l = Rt(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * r);
|
|
749
749
|
a += `${c === 0 ? a ? " M" : "M" : " L"}${u} ${l}`;
|
|
750
750
|
}
|
|
751
751
|
o.closed && (a += " Z");
|
|
752
752
|
}
|
|
753
753
|
return a;
|
|
754
754
|
}
|
|
755
|
-
function
|
|
756
|
-
|
|
755
|
+
function Kn() {
|
|
756
|
+
B.clear(), st = 0, O = void 0;
|
|
757
757
|
}
|
|
758
758
|
function sn(t) {
|
|
759
759
|
return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(t);
|
|
760
760
|
}
|
|
761
|
-
const
|
|
762
|
-
function
|
|
761
|
+
const F = (t, e, n) => t + (e - t) * n, Zt = 512, ft = /* @__PURE__ */ new Map(), pt = /* @__PURE__ */ new Map();
|
|
762
|
+
function Ft(t) {
|
|
763
763
|
const e = ft.get(t);
|
|
764
764
|
if (e) return e;
|
|
765
765
|
const n = t.replace("#", ""), s = [
|
|
@@ -769,7 +769,7 @@ function Ot(t) {
|
|
|
769
769
|
];
|
|
770
770
|
return ft.size < Zt && ft.set(t, s), s;
|
|
771
771
|
}
|
|
772
|
-
const
|
|
772
|
+
const Ot = (t) => t.charCodeAt(0) === 35, Nt = (t) => t.startsWith("rgb"), Xt = (t) => t.startsWith("rgba"), rn = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, dt = (t) => Math.round(t).toString(16).padStart(2, "0");
|
|
773
773
|
function an(t, e, n) {
|
|
774
774
|
return `#${dt(t)}${dt(e)}${dt(n)}`;
|
|
775
775
|
}
|
|
@@ -783,14 +783,14 @@ function Yt(t) {
|
|
|
783
783
|
return pt.size < Zt && pt.set(t, a), a;
|
|
784
784
|
}
|
|
785
785
|
const on = (t, e, n) => {
|
|
786
|
-
if (
|
|
787
|
-
const [s, r, i] =
|
|
786
|
+
if (Ot(t) && Ot(e)) {
|
|
787
|
+
const [s, r, i] = Ft(t), [a, o, c] = Ft(e), u = F(s, a, n), l = F(r, o, n), h = F(i, c, n);
|
|
788
788
|
return an(u, l, h);
|
|
789
789
|
}
|
|
790
790
|
if ((Nt(t) || Xt(t)) && (Nt(e) || Xt(e))) {
|
|
791
|
-
const s = Yt(t), r = Yt(e), i = Math.round(
|
|
791
|
+
const s = Yt(t), r = Yt(e), i = Math.round(F(s[0], r[0], n)), a = Math.round(F(s[1], r[1], n)), o = Math.round(F(s[2], r[2], n));
|
|
792
792
|
if (s.length === 4 || r.length === 4) {
|
|
793
|
-
const c = s[3] ?? 1, u = r[3] ?? 1, l =
|
|
793
|
+
const c = s[3] ?? 1, u = r[3] ?? 1, l = F(c, u, n);
|
|
794
794
|
return `rgba(${i}, ${a}, ${o}, ${l})`;
|
|
795
795
|
}
|
|
796
796
|
return `rgb(${i}, ${a}, ${o})`;
|
|
@@ -799,21 +799,21 @@ const on = (t, e, n) => {
|
|
|
799
799
|
}, cn = (t, e, n) => {
|
|
800
800
|
const s = Math.min(t.length, e.length), r = [];
|
|
801
801
|
for (let i = 0; i < s; i++)
|
|
802
|
-
r.push(
|
|
802
|
+
r.push(F(t[i], e[i], n));
|
|
803
803
|
return r;
|
|
804
|
-
},
|
|
804
|
+
}, Ut = (t, e, n) => n < 1 ? t : e, un = (t, e, n) => nn(t, e, n);
|
|
805
805
|
function Jt(t) {
|
|
806
|
-
return typeof t == "number" ?
|
|
806
|
+
return typeof t == "number" ? F : Array.isArray(t) ? cn : typeof t == "string" ? t.startsWith("#") || t.startsWith("rgb") ? on : sn(t) ? un : Ut : Ut;
|
|
807
807
|
}
|
|
808
808
|
const te = 1e3 / 60;
|
|
809
809
|
function ee(t, e = {}) {
|
|
810
|
-
if (!
|
|
810
|
+
if (!V(t))
|
|
811
811
|
throw new Error(`bakeSpringTrack: track "${t.id}" is not a spring track`);
|
|
812
812
|
const n = new it(t.spring);
|
|
813
813
|
return se(t, (s) => n.valueAt(s), n.settleTime(), t.spring.from, t.spring.to, e);
|
|
814
814
|
}
|
|
815
815
|
function ne(t, e = {}) {
|
|
816
|
-
if (!
|
|
816
|
+
if (!U(t))
|
|
817
817
|
throw new Error(`bakeInertiaTrack: track "${t.id}" is not an inertia track`);
|
|
818
818
|
const n = t.inertia;
|
|
819
819
|
return se(
|
|
@@ -840,7 +840,7 @@ function se(t, e, n, s, r, i) {
|
|
|
840
840
|
};
|
|
841
841
|
}
|
|
842
842
|
function ln(t, e, n, s = {}) {
|
|
843
|
-
const r = s.intervalMs ?? te, i = typeof n == "function" ? n :
|
|
843
|
+
const r = s.intervalMs ?? te, i = typeof n == "function" ? n : Gt(n), a = Jt(t.value), o = e.time - t.time;
|
|
844
844
|
if (o <= 0) return [e];
|
|
845
845
|
const c = [];
|
|
846
846
|
for (let l = r; l < o; l += r) {
|
|
@@ -854,8 +854,8 @@ function ln(t, e, n, s = {}) {
|
|
|
854
854
|
const u = i(1);
|
|
855
855
|
return c.push({ ...e, ...u !== 1 && { value: a(t.value, e.value, u) }, easing: "linear" }), c;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return
|
|
857
|
+
function Qn(t, e) {
|
|
858
|
+
return V(t) ? ee(t, e) : U(t) ? ne(t, e) : t;
|
|
859
859
|
}
|
|
860
860
|
function hn(t, e = {}) {
|
|
861
861
|
const n = t.keyframes;
|
|
@@ -867,10 +867,10 @@ function hn(t, e = {}) {
|
|
|
867
867
|
}
|
|
868
868
|
return { ...t, keyframes: s };
|
|
869
869
|
}
|
|
870
|
-
function
|
|
870
|
+
function Gn(t, e) {
|
|
871
871
|
return t.filter(ge).map((n) => hn(n, e)).concat(
|
|
872
|
-
t.filter(
|
|
873
|
-
t.filter(
|
|
872
|
+
t.filter(V).map((n) => ee(n, e)),
|
|
873
|
+
t.filter(U).map((n) => ne(n, e))
|
|
874
874
|
);
|
|
875
875
|
}
|
|
876
876
|
function fn(t, e) {
|
|
@@ -935,7 +935,7 @@ class gt {
|
|
|
935
935
|
const { keyframes: e } = this.track;
|
|
936
936
|
if (e.length === 0)
|
|
937
937
|
return 0;
|
|
938
|
-
const n = e[e.length - 1].time, s = this.track.stagger ?
|
|
938
|
+
const n = e[e.length - 1].time, s = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
|
|
939
939
|
return n + (this.track.delay ?? 0) + s + (this.track.endDelay ?? 0);
|
|
940
940
|
}
|
|
941
941
|
/**
|
|
@@ -958,7 +958,7 @@ class gt {
|
|
|
958
958
|
return;
|
|
959
959
|
if (s.time === e)
|
|
960
960
|
return s.value;
|
|
961
|
-
const i = r.time - s.time, a = (e - s.time) / i, c =
|
|
961
|
+
const i = r.time - s.time, a = (e - s.time) / i, c = Gt(r.easing)(a);
|
|
962
962
|
return Jt(s.value)(s.value, r.value, c);
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
@@ -992,7 +992,7 @@ class dn {
|
|
|
992
992
|
}
|
|
993
993
|
/** Settle time plus delay and the widest stagger offset. */
|
|
994
994
|
getDuration() {
|
|
995
|
-
const e = this.track.stagger ?
|
|
995
|
+
const e = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
|
|
996
996
|
return this.sampler.settleTime() + (this.track.delay ?? 0) + e;
|
|
997
997
|
}
|
|
998
998
|
getTrack() {
|
|
@@ -1019,7 +1019,7 @@ class gn {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
/** Settle time plus delay and the widest stagger offset. */
|
|
1021
1021
|
getDuration() {
|
|
1022
|
-
const e = this.track.stagger ?
|
|
1022
|
+
const e = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
|
|
1023
1023
|
return this.duration + (this.track.delay ?? 0) + e;
|
|
1024
1024
|
}
|
|
1025
1025
|
getTrack() {
|
|
@@ -1031,12 +1031,12 @@ function re(t, e) {
|
|
|
1031
1031
|
if (t.matrix) {
|
|
1032
1032
|
const [s, r, i, a, o, c] = t.matrix, { x: u, y: l } = n;
|
|
1033
1033
|
n.x = s * u + i * l + o, n.y = r * u + a * l + c;
|
|
1034
|
-
const h = n.angle * Math.PI / 180,
|
|
1035
|
-
n.angle = Math.atan2(r *
|
|
1034
|
+
const h = n.angle * Math.PI / 180, p = Math.cos(h), f = Math.sin(h);
|
|
1035
|
+
n.angle = Math.atan2(r * p + a * f, s * p + i * f) * 180 / Math.PI;
|
|
1036
1036
|
}
|
|
1037
1037
|
return t.autoRotate && t.rotateOffset && (n.angle += t.rotateOffset), n;
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function Bn(t, e, n, s) {
|
|
1040
1040
|
const r = e + (n - e) * s;
|
|
1041
1041
|
return re(t, r);
|
|
1042
1042
|
}
|
|
@@ -1063,12 +1063,12 @@ function Mn(t, e, n = 0) {
|
|
|
1063
1063
|
const _ = Math.round(i * Math.max(a.length, o.length));
|
|
1064
1064
|
return c ? a.slice(0, Math.max(0, a.length - _)).join("") + o.slice(Math.max(0, o.length - _)).join("") : o.slice(0, _).join("") + a.slice(_).join("");
|
|
1065
1065
|
}
|
|
1066
|
-
const u = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), l = Math.max(0, (i - u) / (1 - u)), h = Math.floor(l * o.length),
|
|
1066
|
+
const u = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), l = Math.max(0, (i - u) / (1 - u)), h = Math.floor(l * o.length), p = t.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * i), f = yn(t.chars), M = t.refreshRate ?? mn, d = M > 0 ? Math.floor(n * M / 1e3) : 0, g = t.seed ?? 1;
|
|
1067
1067
|
let y = "";
|
|
1068
|
-
for (let _ = 0; _ <
|
|
1069
|
-
const T = c ? _ >=
|
|
1070
|
-
T &&
|
|
1071
|
-
` ? y +=
|
|
1068
|
+
for (let _ = 0; _ < p; _++) {
|
|
1069
|
+
const T = c ? _ >= p - h : _ < h, k = c ? o[o.length - (p - _)] : o[_];
|
|
1070
|
+
T && k !== void 0 || k === " " || k === `
|
|
1071
|
+
` ? y += k : y += f[_n(g, _, d) % f.length];
|
|
1072
1072
|
}
|
|
1073
1073
|
return y;
|
|
1074
1074
|
}
|
|
@@ -1253,8 +1253,8 @@ class Tn {
|
|
|
1253
1253
|
for (const [r, i] of this._trackPlayers) {
|
|
1254
1254
|
const a = i.getTrack().property;
|
|
1255
1255
|
for (const { target: o, value: c, start: u } of i.getTargetValues(e)) {
|
|
1256
|
-
const l = `${o}\0${a}`, h = u <= e,
|
|
1257
|
-
(!
|
|
1256
|
+
const l = `${o}\0${a}`, h = u <= e, p = s.get(l);
|
|
1257
|
+
(!p || (h !== p.started ? h : h ? u >= p.start : u <= p.start)) && s.set(l, { trackId: r, target: o, property: a, value: c, start: u, started: h });
|
|
1258
1258
|
}
|
|
1259
1259
|
}
|
|
1260
1260
|
for (const { trackId: r, target: i, property: a, value: o, start: c } of s.values())
|
|
@@ -1303,17 +1303,17 @@ class Tn {
|
|
|
1303
1303
|
* Add a track to the timeline.
|
|
1304
1304
|
*/
|
|
1305
1305
|
addTrack(e) {
|
|
1306
|
-
if (this._tracks.push(e), this._sharedWrites = null,
|
|
1306
|
+
if (this._tracks.push(e), this._sharedWrites = null, U(e)) {
|
|
1307
1307
|
this._trackPlayers.set(e.id, new gn(e));
|
|
1308
1308
|
return;
|
|
1309
1309
|
}
|
|
1310
|
-
if (
|
|
1310
|
+
if (V(e)) {
|
|
1311
1311
|
this._trackPlayers.set(e.id, new dn(e)), this._springTracks.set(e.id, e);
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
|
-
if (
|
|
1314
|
+
if (kt(e))
|
|
1315
1315
|
this._trackPlayers.set(e.id, new gt(e)), this._textTracks.set(e.id, e);
|
|
1316
|
-
else if (
|
|
1316
|
+
else if (Ht(e)) {
|
|
1317
1317
|
const n = {
|
|
1318
1318
|
id: e.id,
|
|
1319
1319
|
target: e.target,
|
|
@@ -1377,7 +1377,7 @@ class Tn {
|
|
|
1377
1377
|
const n = this._trackPlayers.get(e);
|
|
1378
1378
|
if (!n) return;
|
|
1379
1379
|
const s = n.getTrack(), r = s.delay ?? 0;
|
|
1380
|
-
if (
|
|
1380
|
+
if (V(s) || U(s))
|
|
1381
1381
|
return { from: r, to: n.getDuration() };
|
|
1382
1382
|
const i = s.keyframes;
|
|
1383
1383
|
if (!(!i || i.length === 0))
|
|
@@ -1487,46 +1487,46 @@ class Tn {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
1489
|
const bn = 100;
|
|
1490
|
-
function
|
|
1491
|
-
const r = [], i = [], { duration: a, alternate: o } = s, c = (f, M,
|
|
1490
|
+
function Zn(t, e, n, s) {
|
|
1491
|
+
const r = [], i = [], { duration: a, alternate: o } = s, c = (f, M, d, g) => {
|
|
1492
1492
|
i.push([f, M]);
|
|
1493
1493
|
const y = [];
|
|
1494
1494
|
t.forEach((_, T) => {
|
|
1495
|
-
(
|
|
1496
|
-
}), y.sort((_, T) => (
|
|
1497
|
-
for (const _ of y) r.push({ kind: "event", index: _, direction:
|
|
1495
|
+
(d === "forward" ? (g ? _ >= f : _ > f) && _ <= M : (g ? _ <= f : _ < f) && _ >= M) && y.push(T);
|
|
1496
|
+
}), y.sort((_, T) => (d === "forward" ? t[_] - t[T] : t[T] - t[_]) || _ - T);
|
|
1497
|
+
for (const _ of y) r.push({ kind: "event", index: _, direction: d });
|
|
1498
1498
|
};
|
|
1499
1499
|
let u = e.time, l = e.direction, h = e.fresh === !0;
|
|
1500
|
-
const
|
|
1501
|
-
for (let f = 0; f <
|
|
1500
|
+
const p = Math.min(bn, Math.max(0, n.iteration - e.iteration));
|
|
1501
|
+
for (let f = 0; f < p; f++) {
|
|
1502
1502
|
const M = l === "forward" ? a : 0;
|
|
1503
1503
|
c(u, M, l, h), r.push({ kind: "repeat" }), o ? (l = l === "forward" ? "reverse" : "forward", u = M, h = !1) : (u = l === "forward" ? 0 : a, h = !0);
|
|
1504
1504
|
}
|
|
1505
|
-
return
|
|
1505
|
+
return p > 0 && s.holding && !o ? { crossings: r, passes: i } : (c(u, n.time, l, h), { crossings: r, passes: i });
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1508
|
-
return
|
|
1507
|
+
function kn(t) {
|
|
1508
|
+
return U(t) ? {
|
|
1509
1509
|
id: t.id,
|
|
1510
1510
|
target: t.target,
|
|
1511
1511
|
property: t.property,
|
|
1512
1512
|
kind: "inertia",
|
|
1513
1513
|
inertia: ie(t.inertia),
|
|
1514
1514
|
...E(t)
|
|
1515
|
-
} :
|
|
1515
|
+
} : V(t) ? {
|
|
1516
1516
|
id: t.id,
|
|
1517
1517
|
target: t.target,
|
|
1518
1518
|
property: t.property,
|
|
1519
1519
|
kind: "spring",
|
|
1520
1520
|
spring: { ...t.spring },
|
|
1521
1521
|
...E(t)
|
|
1522
|
-
} :
|
|
1522
|
+
} : kt(t) ? {
|
|
1523
1523
|
id: t.id,
|
|
1524
1524
|
target: t.target,
|
|
1525
1525
|
property: "text",
|
|
1526
1526
|
textConfig: { ...t.textConfig },
|
|
1527
1527
|
keyframes: t.keyframes.map(yt),
|
|
1528
1528
|
...E(t)
|
|
1529
|
-
} :
|
|
1529
|
+
} : Ht(t) ? {
|
|
1530
1530
|
id: t.id,
|
|
1531
1531
|
target: t.target,
|
|
1532
1532
|
property: "motionPath",
|
|
@@ -1560,8 +1560,8 @@ function E(t) {
|
|
|
1560
1560
|
...t.stagger !== void 0 && { stagger: { ...t.stagger } }
|
|
1561
1561
|
};
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1564
|
-
if (
|
|
1563
|
+
function xn(t) {
|
|
1564
|
+
if (U(t)) {
|
|
1565
1565
|
const e = t;
|
|
1566
1566
|
return {
|
|
1567
1567
|
id: e.id,
|
|
@@ -1572,7 +1572,7 @@ function kn(t) {
|
|
|
1572
1572
|
...E(e)
|
|
1573
1573
|
};
|
|
1574
1574
|
}
|
|
1575
|
-
if (
|
|
1575
|
+
if (V(t)) {
|
|
1576
1576
|
const e = t;
|
|
1577
1577
|
return {
|
|
1578
1578
|
id: e.id,
|
|
@@ -1583,7 +1583,7 @@ function kn(t) {
|
|
|
1583
1583
|
...E(e)
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
|
-
if (
|
|
1586
|
+
if (kt(t)) {
|
|
1587
1587
|
const e = t;
|
|
1588
1588
|
return {
|
|
1589
1589
|
id: e.id,
|
|
@@ -1627,7 +1627,7 @@ function vn(t) {
|
|
|
1627
1627
|
repeatDelay: t._config.repeatDelay,
|
|
1628
1628
|
...e && { markers: e.map((n) => ({ ...n })) }
|
|
1629
1629
|
},
|
|
1630
|
-
tracks: t.tracks.map(
|
|
1630
|
+
tracks: t.tracks.map(kn),
|
|
1631
1631
|
...t.captions && { captions: JSON.parse(JSON.stringify(t.captions)) }
|
|
1632
1632
|
};
|
|
1633
1633
|
}
|
|
@@ -1641,18 +1641,18 @@ function Sn(t) {
|
|
|
1641
1641
|
id: t.id,
|
|
1642
1642
|
name: t.name,
|
|
1643
1643
|
config: t.config,
|
|
1644
|
-
tracks: t.tracks.map(
|
|
1644
|
+
tracks: t.tracks.map(xn),
|
|
1645
1645
|
captions: t.captions
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function Jn(t) {
|
|
1649
1649
|
return JSON.stringify(vn(t));
|
|
1650
1650
|
}
|
|
1651
|
-
function
|
|
1651
|
+
function ts(t) {
|
|
1652
1652
|
const e = JSON.parse(t);
|
|
1653
1653
|
return Sn(e);
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function es(t) {
|
|
1656
1656
|
let e = 2166136261;
|
|
1657
1657
|
for (let n = 0; n < t.length; n++)
|
|
1658
1658
|
e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
|
|
@@ -1675,12 +1675,12 @@ function wn(t, e, n, s) {
|
|
|
1675
1675
|
const r = Math.floor((n - e) / s), i = Math.round(t.next() * r);
|
|
1676
1676
|
return e + i * s;
|
|
1677
1677
|
}
|
|
1678
|
-
function
|
|
1678
|
+
function ns(t, e) {
|
|
1679
1679
|
if (e.length !== 0)
|
|
1680
1680
|
return e[Math.floor(t.next() * e.length)];
|
|
1681
1681
|
}
|
|
1682
1682
|
const oe = /^([+\-*/])=\s*(-?[\d.]+)$/, ce = /^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;
|
|
1683
|
-
function
|
|
1683
|
+
function ss(t) {
|
|
1684
1684
|
return typeof t != "string" ? !1 : oe.test(t.trim()) || ce.test(t.trim());
|
|
1685
1685
|
}
|
|
1686
1686
|
function ue(t, e = {}) {
|
|
@@ -1719,7 +1719,7 @@ function Pn(t, e = 0, n) {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
return s;
|
|
1721
1721
|
}
|
|
1722
|
-
class
|
|
1722
|
+
class rs {
|
|
1723
1723
|
random;
|
|
1724
1724
|
constructor(e) {
|
|
1725
1725
|
this.random = An(e);
|
|
@@ -1735,30 +1735,30 @@ class es {
|
|
|
1735
1735
|
return Pn(e, n, this.random);
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
|
-
const
|
|
1739
|
-
function
|
|
1738
|
+
const $n = 600;
|
|
1739
|
+
function is(t) {
|
|
1740
1740
|
if (Array.isArray(t)) {
|
|
1741
|
-
const [
|
|
1742
|
-
return { fn:
|
|
1741
|
+
const [p, f, M, d] = t;
|
|
1742
|
+
return { fn: Vt(p, f, M, d), bezier: [p, f, M, d] };
|
|
1743
1743
|
}
|
|
1744
1744
|
const { segments: e } = q(t);
|
|
1745
1745
|
if (e.length === 0) throw new Error(`customEase: no curve in "${t}"`);
|
|
1746
1746
|
const n = e[0].startX, s = e[0].startY, r = e[e.length - 1], i = r.endX - n, a = r.endY - s;
|
|
1747
1747
|
if (i === 0 || a === 0) throw new Error(`customEase: "${t}" must move along both axes`);
|
|
1748
|
-
const o = (
|
|
1748
|
+
const o = (p) => (p - n) / i, c = (p) => (p - s) / a;
|
|
1749
1749
|
if (e.length === 1 && r.type === "C") {
|
|
1750
|
-
const [
|
|
1751
|
-
return { fn:
|
|
1750
|
+
const [p, f, M, d] = r.points, g = [o(p), c(f), o(M), c(d)];
|
|
1751
|
+
return { fn: Vt(...g), bezier: g };
|
|
1752
1752
|
}
|
|
1753
|
-
const u = [], l = [], h = Math.max(8, Math.ceil(
|
|
1754
|
-
for (const
|
|
1753
|
+
const u = [], l = [], h = Math.max(8, Math.ceil($n / e.length));
|
|
1754
|
+
for (const p of e)
|
|
1755
1755
|
for (let f = u.length === 0 ? 0 : 1; f <= h; f++) {
|
|
1756
|
-
const [M,
|
|
1757
|
-
u.push(o(M)), l.push(c(
|
|
1756
|
+
const [M, d] = Rn(p, f / h);
|
|
1757
|
+
u.push(o(M)), l.push(c(d));
|
|
1758
1758
|
}
|
|
1759
|
-
return { fn:
|
|
1759
|
+
return { fn: Dn(u, l) };
|
|
1760
1760
|
}
|
|
1761
|
-
function
|
|
1761
|
+
function as(t = {}) {
|
|
1762
1762
|
const n = 0.1 + Math.max(0, Math.min(1, t.strength ?? 0.7)) * 0.7, s = [1];
|
|
1763
1763
|
for (let i = n; i > 2e-3; i *= n) s.push(2 * Math.sqrt(i));
|
|
1764
1764
|
const r = s.reduce((i, a) => i + a, 0);
|
|
@@ -1777,11 +1777,11 @@ function ss(t = {}) {
|
|
|
1777
1777
|
return 1;
|
|
1778
1778
|
};
|
|
1779
1779
|
}
|
|
1780
|
-
function
|
|
1780
|
+
function os(t = {}) {
|
|
1781
1781
|
const e = Math.max(1, t.wiggles ?? 10), n = t.type ?? "easeOut", s = (r) => n === "uniform" ? 1 : n === "easeInOut" ? Math.sin(Math.PI * r) : (1 - r) ** 2;
|
|
1782
1782
|
return (r) => r <= 0 || r >= 1 ? 0 : Math.sin(r * e * Math.PI * 2) * s(r);
|
|
1783
1783
|
}
|
|
1784
|
-
function
|
|
1784
|
+
function Rn(t, e) {
|
|
1785
1785
|
if (t.type === "L") {
|
|
1786
1786
|
const [u, l] = t.points;
|
|
1787
1787
|
return [t.startX + (u - t.startX) * e, t.startY + (l - t.startY) * e];
|
|
@@ -1792,7 +1792,7 @@ function Cn(t, e) {
|
|
|
1792
1792
|
c * c * c * t.startY + 3 * c * c * e * s + 3 * c * e * e * i + e * e * e * o
|
|
1793
1793
|
];
|
|
1794
1794
|
}
|
|
1795
|
-
function
|
|
1795
|
+
function Dn(t, e) {
|
|
1796
1796
|
return (n) => {
|
|
1797
1797
|
if (n <= t[0]) return e[0];
|
|
1798
1798
|
if (n >= t[t.length - 1]) return e[e.length - 1];
|
|
@@ -1805,17 +1805,17 @@ function In(t, e) {
|
|
|
1805
1805
|
return i === 0 ? e[r] : e[s] + (n - t[s]) / i * (e[r] - e[s]);
|
|
1806
1806
|
};
|
|
1807
1807
|
}
|
|
1808
|
-
function
|
|
1808
|
+
function Vt(t, e, n, s) {
|
|
1809
1809
|
const r = (a, o, c) => 3 * (1 - a) * (1 - a) * a * o + 3 * (1 - a) * a * a * c + a * a * a, i = (a, o, c) => 3 * (1 - a) * (1 - a) * o + 6 * (1 - a) * a * (c - o) + 3 * a * a * (1 - c);
|
|
1810
1810
|
return (a) => {
|
|
1811
1811
|
if (a <= 0) return 0;
|
|
1812
1812
|
if (a >= 1) return 1;
|
|
1813
1813
|
let o = a;
|
|
1814
1814
|
for (let l = 0; l < 8; l++) {
|
|
1815
|
-
const h = r(o, t, n) - a,
|
|
1815
|
+
const h = r(o, t, n) - a, p = i(o, t, n);
|
|
1816
1816
|
if (Math.abs(h) < 1e-6) return r(o, e, s);
|
|
1817
|
-
if (Math.abs(
|
|
1818
|
-
o -= h /
|
|
1817
|
+
if (Math.abs(p) < 1e-6) break;
|
|
1818
|
+
o -= h / p;
|
|
1819
1819
|
}
|
|
1820
1820
|
let c = 0, u = 1;
|
|
1821
1821
|
o = a;
|
|
@@ -1824,21 +1824,54 @@ function Ht(t, e, n, s) {
|
|
|
1824
1824
|
return r(o, e, s);
|
|
1825
1825
|
};
|
|
1826
1826
|
}
|
|
1827
|
-
const
|
|
1828
|
-
function
|
|
1827
|
+
const Cn = 350, In = 300, En = 550;
|
|
1828
|
+
function cs(t, e = {}) {
|
|
1829
|
+
const n = e.lead ?? Cn, s = e.gap ?? In, r = e.tail ?? En, i = [];
|
|
1830
|
+
let a = 0;
|
|
1831
|
+
return t.forEach((o, c) => {
|
|
1832
|
+
const u = [];
|
|
1833
|
+
let l = a + n;
|
|
1834
|
+
o.lines.forEach((p, f) => {
|
|
1835
|
+
if (!(p.duration >= 0))
|
|
1836
|
+
throw new Error(`narration: scene ${c} line ${f} has an invalid duration (${p.duration})`);
|
|
1837
|
+
f > 0 && (l += s), u.push({
|
|
1838
|
+
id: p.id ?? `s${c}-l${f}`,
|
|
1839
|
+
scene: c,
|
|
1840
|
+
line: f,
|
|
1841
|
+
start: l,
|
|
1842
|
+
end: l + p.duration,
|
|
1843
|
+
text: p.text
|
|
1844
|
+
}), l += p.duration;
|
|
1845
|
+
});
|
|
1846
|
+
const h = l + r + (o.tail ?? 0);
|
|
1847
|
+
i.push({ id: o.id ?? `s${c}`, start: a, duration: h - a, cues: u }), a = h;
|
|
1848
|
+
}), { duration: a, scenes: i, cues: i.flatMap((o) => o.cues) };
|
|
1849
|
+
}
|
|
1850
|
+
function us(t) {
|
|
1851
|
+
return t.cues.map((e) => ({ id: e.id, time: e.start, label: e.text }));
|
|
1852
|
+
}
|
|
1853
|
+
function ls(t, e) {
|
|
1854
|
+
let n = t.scenes[0];
|
|
1855
|
+
for (const s of t.scenes)
|
|
1856
|
+
if (e >= s.start) n = s;
|
|
1857
|
+
else break;
|
|
1858
|
+
return n;
|
|
1859
|
+
}
|
|
1860
|
+
const I = (t) => Math.round(t * 1e3) / 1e3;
|
|
1861
|
+
function hs(t, e = {}) {
|
|
1829
1862
|
if (t.length === 0) return "";
|
|
1830
1863
|
const n = e.curviness ?? 1, s = e.closed ?? !1, r = t.length;
|
|
1831
|
-
let i = `M${
|
|
1864
|
+
let i = `M${I(t[0].x)} ${I(t[0].y)}`;
|
|
1832
1865
|
if (r === 1) return i;
|
|
1833
1866
|
const a = (c) => s ? t[(c % r + r) % r] : t[Math.max(0, Math.min(r - 1, c))], o = s ? r : r - 1;
|
|
1834
1867
|
for (let c = 0; c < o; c++) {
|
|
1835
|
-
const u = a(c - 1), l = a(c), h = a(c + 1),
|
|
1868
|
+
const u = a(c - 1), l = a(c), h = a(c + 1), p = a(c + 2);
|
|
1836
1869
|
if (n === 0) {
|
|
1837
|
-
i += ` L${
|
|
1870
|
+
i += ` L${I(h.x)} ${I(h.y)}`;
|
|
1838
1871
|
continue;
|
|
1839
1872
|
}
|
|
1840
|
-
const f = n / 6, M = l.x + (h.x - u.x) * f,
|
|
1841
|
-
i += ` C${
|
|
1873
|
+
const f = n / 6, M = l.x + (h.x - u.x) * f, d = l.y + (h.y - u.y) * f, g = h.x - (p.x - l.x) * f, y = h.y - (p.y - l.y) * f;
|
|
1874
|
+
i += ` C${I(M)} ${I(d)} ${I(g)} ${I(y)} ${I(h.x)} ${I(h.y)}`;
|
|
1842
1875
|
}
|
|
1843
1876
|
return s ? `${i} Z` : i;
|
|
1844
1877
|
}
|
|
@@ -1846,12 +1879,12 @@ const A = (t, e = 0) => {
|
|
|
1846
1879
|
const n = parseFloat(t ?? "");
|
|
1847
1880
|
return Number.isFinite(n) ? n : e;
|
|
1848
1881
|
};
|
|
1849
|
-
function
|
|
1882
|
+
function Ln(t) {
|
|
1850
1883
|
const e = (t ?? "").trim().split(/[\s,]+/).filter(Boolean).map(Number), n = [];
|
|
1851
1884
|
for (let s = 0; s + 1 < e.length; s += 2) n.push({ x: e[s], y: e[s + 1] });
|
|
1852
1885
|
return n;
|
|
1853
1886
|
}
|
|
1854
|
-
function
|
|
1887
|
+
function fs(t) {
|
|
1855
1888
|
const e = t.attributes;
|
|
1856
1889
|
switch (t.tag.toLowerCase()) {
|
|
1857
1890
|
case "path":
|
|
@@ -1870,7 +1903,7 @@ function as(t) {
|
|
|
1870
1903
|
return `M${A(e.x1)} ${A(e.y1)} L${A(e.x2)} ${A(e.y2)}`;
|
|
1871
1904
|
case "polyline":
|
|
1872
1905
|
case "polygon": {
|
|
1873
|
-
const n =
|
|
1906
|
+
const n = Ln(e.points);
|
|
1874
1907
|
if (n.length === 0) return null;
|
|
1875
1908
|
const s = n.map((r, i) => `${i === 0 ? "M" : "L"}${r.x} ${r.y}`).join(" ");
|
|
1876
1909
|
return t.tag.toLowerCase() === "polygon" ? `${s} Z` : s;
|
|
@@ -1880,107 +1913,110 @@ function as(t) {
|
|
|
1880
1913
|
}
|
|
1881
1914
|
}
|
|
1882
1915
|
export {
|
|
1883
|
-
|
|
1916
|
+
Nn as Clock,
|
|
1884
1917
|
te as DEFAULT_BAKE_INTERVAL_MS,
|
|
1885
1918
|
wt as DEFAULT_INERTIA_FRICTION,
|
|
1886
|
-
|
|
1919
|
+
C as DEFAULT_SPRING,
|
|
1887
1920
|
rt as FORMAT_VERSION,
|
|
1888
1921
|
Te as INERTIA_MAX_DURATION_MS,
|
|
1889
1922
|
gn as InertiaTrackPlayer,
|
|
1890
|
-
|
|
1891
|
-
|
|
1923
|
+
jn as MORPH_SAMPLES,
|
|
1924
|
+
On as ManualClock,
|
|
1892
1925
|
Wt as SPRING_MAX_DURATION_MS,
|
|
1893
|
-
|
|
1894
|
-
|
|
1926
|
+
Xn as SPRING_PRESETS,
|
|
1927
|
+
G as SPRING_STEP_MS,
|
|
1895
1928
|
it as SpringSampler,
|
|
1896
1929
|
dn as SpringTrackPlayer,
|
|
1897
1930
|
Tn as Timeline,
|
|
1898
1931
|
gt as TrackPlayer,
|
|
1899
|
-
|
|
1900
|
-
|
|
1932
|
+
rs as ValueResolver,
|
|
1933
|
+
Ie as backOut,
|
|
1901
1934
|
ln as bakeEasing,
|
|
1902
1935
|
ne as bakeInertiaTrack,
|
|
1903
1936
|
ee as bakeSpringTrack,
|
|
1904
|
-
|
|
1937
|
+
Ce as bounceOut,
|
|
1905
1938
|
yn as charactersFor,
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1939
|
+
Kn as clearMorphCache,
|
|
1940
|
+
qn as clearPathCache,
|
|
1941
|
+
Re as createCubicBezier,
|
|
1909
1942
|
An as createRandom,
|
|
1910
1943
|
pn as createTrack,
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1944
|
+
Hn as criticalDamping,
|
|
1945
|
+
as as customBounce,
|
|
1946
|
+
is as customEase,
|
|
1947
|
+
os as customWiggle,
|
|
1915
1948
|
Sn as deserializeTimeline,
|
|
1916
|
-
|
|
1949
|
+
xn as deserializeTrack,
|
|
1917
1950
|
Ae as easeIn,
|
|
1918
1951
|
jt as easeInCubic,
|
|
1919
1952
|
Pe as easeInOut,
|
|
1920
1953
|
Qt as easeInOutCubic,
|
|
1921
1954
|
Se as easeInOutQuad,
|
|
1922
|
-
|
|
1955
|
+
xe as easeInQuad,
|
|
1923
1956
|
we as easeOut,
|
|
1924
1957
|
Kt as easeOutCubic,
|
|
1925
1958
|
ve as easeOutQuad,
|
|
1926
|
-
|
|
1959
|
+
De as elasticOut,
|
|
1927
1960
|
hn as expandParametricEasings,
|
|
1928
|
-
|
|
1929
|
-
|
|
1961
|
+
ts as fromJSON,
|
|
1962
|
+
Gt as getEasingFunction,
|
|
1930
1963
|
Jt as getInterpolator,
|
|
1931
1964
|
re as getMotionPathPoint,
|
|
1932
|
-
|
|
1965
|
+
Wn as getPathLength,
|
|
1933
1966
|
ze as getPointAtProgress,
|
|
1934
1967
|
ge as hasKeyframes,
|
|
1935
|
-
|
|
1968
|
+
es as hashSeed,
|
|
1936
1969
|
ct as inertiaDuration,
|
|
1937
1970
|
ot as inertiaRest,
|
|
1938
1971
|
Mt as inertiaValueAt,
|
|
1939
|
-
|
|
1972
|
+
zn as inertiaVelocityAt,
|
|
1940
1973
|
cn as interpolateArray,
|
|
1941
1974
|
on as interpolateColor,
|
|
1942
|
-
|
|
1943
|
-
|
|
1975
|
+
Bn as interpolateMotionPath,
|
|
1976
|
+
F as interpolateNumber,
|
|
1944
1977
|
un as interpolatePathString,
|
|
1945
|
-
|
|
1978
|
+
Ut as interpolateString,
|
|
1946
1979
|
de as isCubicBezierEasing,
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1980
|
+
U as isInertiaTrack,
|
|
1981
|
+
Fn as isMotionPathPoint,
|
|
1982
|
+
Ht as isMotionPathTrack,
|
|
1950
1983
|
_t as isParametricEasing,
|
|
1951
1984
|
sn as isPathData,
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1985
|
+
V as isSpringTrack,
|
|
1986
|
+
kt as isTextTrack,
|
|
1987
|
+
Vn as isUnderdamped,
|
|
1988
|
+
ss as isUnresolved,
|
|
1956
1989
|
Tt as linear,
|
|
1957
1990
|
me as maxStaggerDistance,
|
|
1958
1991
|
nn as morphPath,
|
|
1992
|
+
us as narrationMarkers,
|
|
1993
|
+
ls as narrationSceneAt,
|
|
1959
1994
|
be as naturalRest,
|
|
1960
1995
|
Le as parametricEasing,
|
|
1961
1996
|
q as parsePath,
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1997
|
+
cs as planNarration,
|
|
1998
|
+
Zn as playheadCrossings,
|
|
1999
|
+
Bt as pointAtDistance,
|
|
2000
|
+
hs as pointsToPath,
|
|
1965
2001
|
ae as randomBetween,
|
|
1966
|
-
|
|
2002
|
+
ns as randomChoice,
|
|
1967
2003
|
wn as randomSnapped,
|
|
1968
2004
|
Pn as resolveSequence,
|
|
1969
2005
|
ue as resolveValue,
|
|
1970
2006
|
vn as serializeTimeline,
|
|
1971
|
-
|
|
1972
|
-
|
|
2007
|
+
kn as serializeTrack,
|
|
2008
|
+
fs as shapeToPathData,
|
|
1973
2009
|
fn as simplifyKeyframes,
|
|
1974
|
-
|
|
1975
|
-
|
|
2010
|
+
Un as springDuration,
|
|
2011
|
+
Yn as springValueAt,
|
|
1976
2012
|
zt as staggerDistance,
|
|
1977
2013
|
qt as staggerOffset,
|
|
1978
2014
|
ye as staggerOffsets,
|
|
1979
|
-
|
|
2015
|
+
xt as staggerSpan,
|
|
1980
2016
|
Ee as stepsEasing,
|
|
1981
2017
|
Mn as textAt,
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2018
|
+
Jn as toJSON,
|
|
2019
|
+
Qn as toKeyframedTrack,
|
|
2020
|
+
Gn as toKeyframedTracks,
|
|
1985
2021
|
Y as trackTargets
|
|
1986
2022
|
};
|