@algorisys/tinyfly 0.125.0 → 0.126.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 +4 -4
- package/docs/editor-guide.md +1 -1
- package/docs/examples.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/gsap-compat.md +1 -1
- package/docs/llm-guide.md +4 -0
- package/docs/maps.md +2 -2
- package/docs/math.md +1 -1
- package/docs/props.md +5 -1
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +798 -796
- package/lib/browser/tinyfly.iife.js +14 -14
- package/lib/browser/tinyfly.js +652 -650
- package/lib/browser/tinyfly.umd.js +14 -14
- package/lib/types/characters/props/families/environment.d.ts +7 -1
- package/llms-full.txt +19 -11
- package/llms.txt +32 -32
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +3 -0
package/lib/browser/tinyfly.js
CHANGED
|
@@ -300,21 +300,21 @@ const Na = (t) => t, Bp = (t) => t * t, Dp = (t) => 1 - (1 - t) * (1 - t), zp =
|
|
|
300
300
|
function Xp(t) {
|
|
301
301
|
const [e, n, s, o] = t, r = 3 * e, i = 3 * (s - e) - r, a = 1 - r - i, l = 3 * n, c = 3 * (o - n) - l, h = 1 - l - c, u = (g) => ((a * g + i) * g + r) * g, d = (g) => ((h * g + c) * g + l) * g, f = (g) => (3 * a * g + 2 * i) * g + r, p = (g) => {
|
|
302
302
|
let m = g;
|
|
303
|
-
for (let
|
|
304
|
-
const
|
|
305
|
-
if (Math.abs(
|
|
303
|
+
for (let b = 0; b < 8; b++) {
|
|
304
|
+
const w = u(m) - g;
|
|
305
|
+
if (Math.abs(w) < 1e-7)
|
|
306
306
|
return m;
|
|
307
307
|
const M = f(m);
|
|
308
308
|
if (Math.abs(M) < 1e-7)
|
|
309
309
|
break;
|
|
310
|
-
m -=
|
|
310
|
+
m -= w / M;
|
|
311
311
|
}
|
|
312
312
|
let y = 0, k = 1;
|
|
313
313
|
for (m = g; y < k; ) {
|
|
314
|
-
const
|
|
315
|
-
if (Math.abs(
|
|
314
|
+
const b = u(m);
|
|
315
|
+
if (Math.abs(b - g) < 1e-7)
|
|
316
316
|
return m;
|
|
317
|
-
g >
|
|
317
|
+
g > b ? y = m : k = m, m = (y + k) / 2;
|
|
318
318
|
}
|
|
319
319
|
return m;
|
|
320
320
|
};
|
|
@@ -436,7 +436,7 @@ function om(t, e, n, s, o, r, i, a, l) {
|
|
|
436
436
|
const R = Math.sqrt(k);
|
|
437
437
|
c *= R, h *= R;
|
|
438
438
|
}
|
|
439
|
-
const
|
|
439
|
+
const b = r === i ? -1 : 1, w = c * c * h * h - c * c * y * y - h * h * m * m, M = c * c * y * y + h * h * m * m, E = b * Math.sqrt(Math.max(0, w / M)), v = E * c * y / h, S = -E * h * m / c, x = d * v - f * S + (t + a) / 2, T = f * v + d * S + (e + l) / 2, A = (R, B, Y, _) => {
|
|
440
440
|
const j = R * Y + B * _, nt = Math.sqrt((R * R + B * B) * (Y * Y + _ * _)), $ = Math.acos(Math.max(-1, Math.min(1, j / nt)));
|
|
441
441
|
return R * _ - B * Y < 0 ? -$ : $;
|
|
442
442
|
}, P = A(1, 0, (m - v) / c, (y - S) / h);
|
|
@@ -503,17 +503,17 @@ function ys(t) {
|
|
|
503
503
|
c < 0 && (c = 0), g.subpath = c, n.push(g);
|
|
504
504
|
};
|
|
505
505
|
for (const { type: g, args: m } of sm(t)) {
|
|
506
|
-
const y = g.toUpperCase(), k = g !== y,
|
|
506
|
+
const y = g.toUpperCase(), k = g !== y, b = nm[y];
|
|
507
507
|
if (y === "Z") {
|
|
508
508
|
(s !== r || o !== i) && u(Ps(s, o, r, i)), c >= 0 && h.add(c), s = r, o = i, a = l = null;
|
|
509
509
|
continue;
|
|
510
510
|
}
|
|
511
|
-
for (let
|
|
512
|
-
const M = m.slice(
|
|
511
|
+
for (let w = 0; w + b <= m.length; w += b) {
|
|
512
|
+
const M = m.slice(w, w + b), E = k ? s : 0, v = k ? o : 0;
|
|
513
513
|
let S = null, x = null;
|
|
514
514
|
switch (y) {
|
|
515
515
|
case "M":
|
|
516
|
-
|
|
516
|
+
w === 0 ? (s = M[0] + E, o = M[1] + v, r = s, i = o, (c < 0 || n[n.length - 1]?.subpath === c) && c++) : (u(Ps(s, o, M[0] + E, M[1] + v)), s = M[0] + E, o = M[1] + v);
|
|
517
517
|
break;
|
|
518
518
|
case "L":
|
|
519
519
|
u(Ps(s, o, M[0] + E, M[1] + v)), s = M[0] + E, o = M[1] + v;
|
|
@@ -568,7 +568,7 @@ function ys(t) {
|
|
|
568
568
|
const m = n[g].subpath;
|
|
569
569
|
let y = g, k = 0;
|
|
570
570
|
for (; y < n.length && n[y].subpath === m; ) k += n[y++].length;
|
|
571
|
-
const
|
|
571
|
+
const b = n[g], w = n[y - 1], M = h.has(m) || Math.abs(w.endX - b.startX) < 1e-9 && Math.abs(w.endY - b.startY) < 1e-9;
|
|
572
572
|
f.push({ start: g, end: y, length: k, closed: M }), g = y;
|
|
573
573
|
}
|
|
574
574
|
const p = { segments: n, totalLength: d, subpaths: f };
|
|
@@ -1148,9 +1148,9 @@ function Lm(t, e, n = 0) {
|
|
|
1148
1148
|
const c = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), h = Math.max(0, (r - c) / (1 - c)), u = Math.floor(h * a.length), d = t.tweenLength === !1 ? a.length : Math.round(i.length + (a.length - i.length) * r), f = Fm(t.chars), p = t.refreshRate ?? Rm, g = p > 0 ? Math.floor(n * p / 1e3) : 0, m = t.seed ?? 1;
|
|
1149
1149
|
let y = "";
|
|
1150
1150
|
for (let k = 0; k < d; k++) {
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
` ? y +=
|
|
1151
|
+
const b = l ? k >= d - u : k < u, w = l ? a[a.length - (d - k)] : a[k];
|
|
1152
|
+
b && w !== void 0 || w === " " || w === `
|
|
1153
|
+
` ? y += w : y += f[Wm(m, k, g) % f.length];
|
|
1154
1154
|
}
|
|
1155
1155
|
return y;
|
|
1156
1156
|
}
|
|
@@ -1581,9 +1581,9 @@ function md(t, e, n, s) {
|
|
|
1581
1581
|
const o = [], r = [], { duration: i, alternate: a } = s, l = (f, p, g, m) => {
|
|
1582
1582
|
r.push([f, p]);
|
|
1583
1583
|
const y = [];
|
|
1584
|
-
t.forEach((k,
|
|
1585
|
-
(g === "forward" ? (m ? k >= f : k > f) && k <= p : (m ? k <= f : k < f) && k >= p) && y.push(
|
|
1586
|
-
}), y.sort((k,
|
|
1584
|
+
t.forEach((k, b) => {
|
|
1585
|
+
(g === "forward" ? (m ? k >= f : k > f) && k <= p : (m ? k <= f : k < f) && k >= p) && y.push(b);
|
|
1586
|
+
}), y.sort((k, b) => (g === "forward" ? t[k] - t[b] : t[b] - t[k]) || k - b);
|
|
1587
1587
|
for (const k of y) o.push({ kind: "event", index: k, direction: g });
|
|
1588
1588
|
};
|
|
1589
1589
|
let c = e.time, h = e.direction, u = e.fresh === !0;
|
|
@@ -2020,16 +2020,16 @@ function V4(t, e, n = {}) {
|
|
|
2020
2020
|
for (let P = T; P < a; P += x) A += y(P);
|
|
2021
2021
|
return A;
|
|
2022
2022
|
};
|
|
2023
|
-
let
|
|
2023
|
+
let b = g, w = 0, M = -1 / 0;
|
|
2024
2024
|
for (let x = g - 0.6; x <= g + 0.6 + 1e-9; x += 0.02) {
|
|
2025
2025
|
if (x < 1) continue;
|
|
2026
2026
|
const T = Math.max(1, Math.round(x * 4));
|
|
2027
2027
|
for (let A = 0; A < T; A++) {
|
|
2028
2028
|
const P = A / T * x, I = k(x, P);
|
|
2029
|
-
I > M && (M = I,
|
|
2029
|
+
I > M && (M = I, w = P, b = x);
|
|
2030
2030
|
}
|
|
2031
2031
|
}
|
|
2032
|
-
const E = 60 * Bn /
|
|
2032
|
+
const E = 60 * Bn / b, v = p > 0 ? Math.max(0, Math.min(1, f(g) / p)) : 0, S = (w + 0.5) * 1e3 / Bn;
|
|
2033
2033
|
return { bpm: Math.round(E * 100) / 100, offset: Math.round(S % (6e4 / E)), confidence: v };
|
|
2034
2034
|
}
|
|
2035
2035
|
const ty = 600, ey = 250, nh = 1;
|
|
@@ -2072,8 +2072,8 @@ function J4(t, e) {
|
|
|
2072
2072
|
rotate: l.rotate
|
|
2073
2073
|
});
|
|
2074
2074
|
for (const k of m) {
|
|
2075
|
-
const
|
|
2076
|
-
a(k + f, y(k), k === u.at ? "ease-in-out" :
|
|
2075
|
+
const b = d.x.find((w) => w.time === k)?.easing;
|
|
2076
|
+
a(k + f, y(k), k === u.at ? "ease-in-out" : b);
|
|
2077
2077
|
}
|
|
2078
2078
|
l = y(u.until);
|
|
2079
2079
|
}
|
|
@@ -2419,11 +2419,11 @@ function wT(t = {}) {
|
|
|
2419
2419
|
let u = [0, 0, 0], d = 0;
|
|
2420
2420
|
for (const y of c) {
|
|
2421
2421
|
for (let k = 0; k < y.count; k++) {
|
|
2422
|
-
const
|
|
2422
|
+
const b = d * l, w = [u[0] + y.dir[0] * k * n, u[1] + y.dir[1] * k * n, 0], M = [w[0] + y.dir[0] * n + y.across[0] * o, w[1] + y.dir[1] * n + y.across[1] * o, 0];
|
|
2423
2423
|
h.push({
|
|
2424
2424
|
tag: d,
|
|
2425
|
-
min: [Math.min(
|
|
2426
|
-
max: [Math.max(
|
|
2425
|
+
min: [Math.min(w[0], M[0]), Math.min(w[1], M[1]), 0],
|
|
2426
|
+
max: [Math.max(w[0], M[0]), Math.max(w[1], M[1]), b + r]
|
|
2427
2427
|
}), d++;
|
|
2428
2428
|
}
|
|
2429
2429
|
u = [u[0] + y.dir[0] * y.count * n, u[1] + y.dir[1] * y.count * n, 0];
|
|
@@ -2449,15 +2449,15 @@ function kT(t, e = {}) {
|
|
|
2449
2449
|
}, i = Math.max(2, Math.ceil(r.width / s) + 1), a = Math.max(2, Math.ceil(r.height / s) + 1), l = new Float64Array(i * a);
|
|
2450
2450
|
for (let f = 0; f < a; f++) for (let p = 0; p < i; p++) l[f * i + p] = fy(t, r.x + p * s, r.y + f * s) - n;
|
|
2451
2451
|
const c = (f, p) => l[p * i + f], h = (f, p, g, m, y, k) => {
|
|
2452
|
-
const
|
|
2453
|
-
return { x: f + (m - f) *
|
|
2452
|
+
const b = g === k ? 0.5 : g / (g - k);
|
|
2453
|
+
return { x: f + (m - f) * b, y: p + (y - p) * b };
|
|
2454
2454
|
}, u = [];
|
|
2455
2455
|
for (let f = 0; f + 1 < a; f++)
|
|
2456
2456
|
for (let p = 0; p + 1 < i; p++) {
|
|
2457
|
-
const g = r.x + p * s, m = r.y + f * s, y = g + s, k = m + s,
|
|
2458
|
-
if (
|
|
2459
|
-
const M = () => h(g, m,
|
|
2460
|
-
switch (
|
|
2457
|
+
const g = r.x + p * s, m = r.y + f * s, y = g + s, k = m + s, b = [c(p, f), c(p + 1, f), c(p + 1, f + 1), c(p, f + 1)], w = (b[0] > 0 ? 1 : 0) | (b[1] > 0 ? 2 : 0) | (b[2] > 0 ? 4 : 0) | (b[3] > 0 ? 8 : 0);
|
|
2458
|
+
if (w === 0 || w === 15) continue;
|
|
2459
|
+
const M = () => h(g, m, b[0], y, m, b[1]), E = () => h(y, m, b[1], y, k, b[2]), v = () => h(g, k, b[3], y, k, b[2]), S = () => h(g, m, b[0], g, k, b[3]), x = (b[0] + b[1] + b[2] + b[3]) / 4 > 0;
|
|
2460
|
+
switch (w) {
|
|
2461
2461
|
case 1:
|
|
2462
2462
|
case 14:
|
|
2463
2463
|
u.push([S(), M()]);
|
|
@@ -2532,13 +2532,13 @@ function vT(t) {
|
|
|
2532
2532
|
if (e <= 0) return [];
|
|
2533
2533
|
const n = t.width / 2, s = n * (0.55 + 0.75 * e), o = Math.max(t.length * e, s * 1.2), r = t.x, i = t.y + o - s, a = Math.max(0.1, n * (0.35 - 0.3 * e)), l = i - Math.sqrt(Math.max(0, s * s - a * a)), c = Math.max(0, l - t.y), h = 8, u = [], d = [];
|
|
2534
2534
|
for (let k = 0; k <= h; k++) {
|
|
2535
|
-
const
|
|
2536
|
-
u.push({ x: r -
|
|
2535
|
+
const b = k / h, w = a + (n - a) * Math.pow(1 - b, 1.6 + 1.4 * e);
|
|
2536
|
+
u.push({ x: r - w, y: t.y + c * b }), d.push({ x: r + w, y: t.y + c * b });
|
|
2537
2537
|
}
|
|
2538
2538
|
const f = Math.max(8, Math.round(t.segments ?? 12)), p = Math.acos(Math.min(1, a / s)), g = -p, m = Math.PI + p, y = [];
|
|
2539
2539
|
for (let k = 1; k < f; k++) {
|
|
2540
|
-
const
|
|
2541
|
-
y.push({ x: r + Math.cos(
|
|
2540
|
+
const b = g + (m - g) * k / f;
|
|
2541
|
+
y.push({ x: r + Math.cos(b) * s, y: i + Math.sin(b) * s });
|
|
2542
2542
|
}
|
|
2543
2543
|
return [...d, ...y, ...u.reverse()];
|
|
2544
2544
|
}
|
|
@@ -2665,26 +2665,26 @@ function my(t) {
|
|
|
2665
2665
|
return e;
|
|
2666
2666
|
}
|
|
2667
2667
|
function Dl(t) {
|
|
2668
|
-
const [e, n, s, o, r, i, a, l, c, h, u, d, f, p, g, m] = t, y = e * i - n * r, k = e * a - s * r,
|
|
2668
|
+
const [e, n, s, o, r, i, a, l, c, h, u, d, f, p, g, m] = t, y = e * i - n * r, k = e * a - s * r, b = e * l - o * r, w = n * a - s * i, M = n * l - o * i, E = s * l - o * a, v = c * p - h * f, S = c * g - u * f, x = c * m - d * f, T = h * g - u * p, A = h * m - d * p, P = u * m - d * g, I = y * P - k * A + b * T + w * x - M * S + E * v;
|
|
2669
2669
|
if (Math.abs(I) < 1e-12) return null;
|
|
2670
2670
|
const C = 1 / I;
|
|
2671
2671
|
return [
|
|
2672
2672
|
(i * P - a * A + l * T) * C,
|
|
2673
2673
|
(s * A - n * P - o * T) * C,
|
|
2674
|
-
(p * E - g * M + m *
|
|
2675
|
-
(u * M - h * E - d *
|
|
2674
|
+
(p * E - g * M + m * w) * C,
|
|
2675
|
+
(u * M - h * E - d * w) * C,
|
|
2676
2676
|
(a * x - r * P - l * S) * C,
|
|
2677
2677
|
(e * P - s * x + o * S) * C,
|
|
2678
|
-
(g *
|
|
2679
|
-
(c * E - u *
|
|
2678
|
+
(g * b - f * E - m * k) * C,
|
|
2679
|
+
(c * E - u * b + d * k) * C,
|
|
2680
2680
|
(r * A - i * x + l * v) * C,
|
|
2681
2681
|
(n * x - e * A - o * v) * C,
|
|
2682
|
-
(f * M - p *
|
|
2683
|
-
(h *
|
|
2682
|
+
(f * M - p * b + m * y) * C,
|
|
2683
|
+
(h * b - c * M - d * y) * C,
|
|
2684
2684
|
(i * S - r * T - a * v) * C,
|
|
2685
2685
|
(e * T - n * S + s * v) * C,
|
|
2686
|
-
(p * k - f *
|
|
2687
|
-
(c *
|
|
2686
|
+
(p * k - f * w - g * y) * C,
|
|
2687
|
+
(c * w - h * k + u * y) * C
|
|
2688
2688
|
];
|
|
2689
2689
|
}
|
|
2690
2690
|
function yy(t, e, n, s) {
|
|
@@ -2872,8 +2872,8 @@ function vy(t = 1) {
|
|
|
2872
2872
|
return l;
|
|
2873
2873
|
},
|
|
2874
2874
|
distribute: ({ base: l = 0, amount: c, each: h, from: u = "start", ease: d }) => (f, p, g) => {
|
|
2875
|
-
const m = g.length, k = Rl(f, m, { ...c !== void 0 ? { amount: c } : { each: h ?? 1 }, from: u }),
|
|
2876
|
-
return l +
|
|
2875
|
+
const m = g.length, k = Rl(f, m, { ...c !== void 0 ? { amount: c } : { each: h ?? 1 }, from: u }), b = c !== void 0 ? c : (h ?? 1) * ed(m, u), w = d && b > 0 ? d(k / b) * b : k;
|
|
2876
|
+
return l + w;
|
|
2877
2877
|
},
|
|
2878
2878
|
pipe: (...l) => (c) => l.reduce((h, u) => u(h), c),
|
|
2879
2879
|
splitColor: (l) => My(l),
|
|
@@ -3339,19 +3339,19 @@ class rs {
|
|
|
3339
3339
|
count: d.length,
|
|
3340
3340
|
columnsFromLayout: this.options.layoutColumns ? () => this.options.layoutColumns(d) : void 0,
|
|
3341
3341
|
random: this.options.random ?? this.fallbackRandom
|
|
3342
|
-
}), y = this.easingFor(r.ease), k = [],
|
|
3343
|
-
let
|
|
3342
|
+
}), y = this.easingFor(r.ease), k = [], b = r.spring;
|
|
3343
|
+
let w = 0, M = !1;
|
|
3344
3344
|
for (const [A, P] of Object.entries(u)) {
|
|
3345
3345
|
const I = P;
|
|
3346
3346
|
let C = n?.[A] !== void 0 ? n[A] : this.resolveStart(d[0], A);
|
|
3347
3347
|
if (typeof C != typeof I && (this.warn(
|
|
3348
3348
|
`no usable start value for "${A}" on "${d[0]}" — it will snap to ${String(I)}. Use fromTo() to animate it.`
|
|
3349
|
-
), C = I),
|
|
3349
|
+
), C = I), b !== void 0 && (typeof C != "number" || typeof I != "number") && this.warn(`spring works on numbers, so "${A}" on "${d[0]}" eases instead`), b !== void 0 && typeof C == "number" && typeof I == "number") {
|
|
3350
3350
|
const U = {
|
|
3351
|
-
...Ny(
|
|
3351
|
+
...Ny(b),
|
|
3352
3352
|
from: C,
|
|
3353
3353
|
to: I,
|
|
3354
|
-
velocity: By(
|
|
3354
|
+
velocity: By(b, A) ?? this.options.startVelocity?.(d[0], A) ?? 0
|
|
3355
3355
|
}, Q = this.nextTrackId(`${d[0]}-${A}-spring`), V = {
|
|
3356
3356
|
id: Q,
|
|
3357
3357
|
target: d[0],
|
|
@@ -3362,7 +3362,7 @@ class rs {
|
|
|
3362
3362
|
spring: U,
|
|
3363
3363
|
delay: f + p
|
|
3364
3364
|
};
|
|
3365
|
-
this.timeline.addTrack(V), k.push(Q),
|
|
3365
|
+
this.timeline.addTrack(V), k.push(Q), w = Math.max(w, Rp(U));
|
|
3366
3366
|
for (const R of d) this.lastValues.set(`${R}|${A}`, I);
|
|
3367
3367
|
continue;
|
|
3368
3368
|
}
|
|
@@ -3428,10 +3428,10 @@ class rs {
|
|
|
3428
3428
|
inertia: C,
|
|
3429
3429
|
delay: f + p
|
|
3430
3430
|
};
|
|
3431
|
-
this.timeline.addTrack(q), k.push(F),
|
|
3431
|
+
this.timeline.addTrack(q), k.push(F), w = Math.max(w, ko(C));
|
|
3432
3432
|
for (const U of d) this.lastValues.set(`${U}|${A}`, wo(C));
|
|
3433
3433
|
}
|
|
3434
|
-
const x = ((h !== void 0 ||
|
|
3434
|
+
const x = ((h !== void 0 || b !== void 0) && !M && !E && a === void 0 ? w : Math.max(g, w)) + (m && d.length > 1 ? Vr(d.length, m) : 0), T = f + p + x;
|
|
3435
3435
|
return this.previousStart = f + p, this.previousEnd = T, this.cursor = Math.max(this.cursor, T), {
|
|
3436
3436
|
trackIds: k,
|
|
3437
3437
|
start: f + p,
|
|
@@ -4099,15 +4099,15 @@ function l1(t, e) {
|
|
|
4099
4099
|
return s === !0 && e.warn("gsap-compat: motionPath align: true needs the path to be an element"), h;
|
|
4100
4100
|
const d = e.targets[0];
|
|
4101
4101
|
if (!d) return h;
|
|
4102
|
-
const [f, p, g, m, y, k] = a1(u),
|
|
4102
|
+
const [f, p, g, m, y, k] = a1(u), b = Tr(d), [w, M] = o ?? [0.5, 0.5];
|
|
4103
4103
|
for (const E of e.targets.slice(1)) {
|
|
4104
4104
|
const v = Tr(E);
|
|
4105
|
-
if (Math.abs(v.left -
|
|
4105
|
+
if (Math.abs(v.left - b.left) > 0.5 || Math.abs(v.top - b.top) > 0.5) {
|
|
4106
4106
|
e.warn("gsap-compat: motionPath align measures the first target; the others are laid out elsewhere");
|
|
4107
4107
|
break;
|
|
4108
4108
|
}
|
|
4109
4109
|
}
|
|
4110
|
-
return h.matrix = [f, p, g, m, y -
|
|
4110
|
+
return h.matrix = [f, p, g, m, y - b.left - w * b.width, k - b.top - M * b.height], h;
|
|
4111
4111
|
}
|
|
4112
4112
|
const Rd = (t) => typeof t == "object" && t !== null && t.nodeType === 1;
|
|
4113
4113
|
function Fd(t) {
|
|
@@ -4383,18 +4383,18 @@ function y1(t, e, n, s = {}) {
|
|
|
4383
4383
|
const d = () => {
|
|
4384
4384
|
u?.kill(), u = null;
|
|
4385
4385
|
}, f = (g) => {
|
|
4386
|
-
const m = s.inertia === !0 ? {} : s.inertia, y = m.friction ?? (m.resistance !== void 0 ? jl(m.resistance) : 4), k = a(),
|
|
4387
|
-
let
|
|
4386
|
+
const m = s.inertia === !0 ? {} : s.inertia, y = m.friction ?? (m.resistance !== void 0 ? jl(m.resistance) : 4), k = a(), b = h.bounds ?? {};
|
|
4387
|
+
let w, M;
|
|
4388
4388
|
const E = m.end;
|
|
4389
4389
|
if (Array.isArray(E)) {
|
|
4390
4390
|
const S = kr({ from: k.x, velocity: i === "y" ? 0 : g.x, friction: y }), x = kr({ from: k.y, velocity: i === "x" ? 0 : g.y, friction: y });
|
|
4391
4391
|
let T = E[0];
|
|
4392
4392
|
for (const A of E)
|
|
4393
4393
|
Math.hypot(A.x - S, A.y - x) < Math.hypot(T.x - S, T.y - x) && (T = A);
|
|
4394
|
-
T && (
|
|
4395
|
-
} else typeof E == "number" ? (
|
|
4394
|
+
T && (w = [T.x], M = [T.y]);
|
|
4395
|
+
} else typeof E == "number" ? (w = E, M = E) : E && (w = fh(E.x), M = fh(E.y));
|
|
4396
4396
|
const v = {};
|
|
4397
|
-
i !== "y" && (v.x = { velocity: g.x, friction: y, min:
|
|
4397
|
+
i !== "y" && (v.x = { velocity: g.x, friction: y, min: b.minX, max: b.maxX, end: w }), i !== "x" && (v.y = { velocity: g.y, friction: y, min: b.minY, max: b.maxY, end: M }), u = t.to(r, { inertia: v, onComplete: () => s.onThrowComplete?.() });
|
|
4398
4398
|
}, p = new Ld({
|
|
4399
4399
|
target: r,
|
|
4400
4400
|
axis: i,
|
|
@@ -4430,30 +4430,30 @@ function y1(t, e, n, s = {}) {
|
|
|
4430
4430
|
}
|
|
4431
4431
|
function b1(t, e, n, s, o) {
|
|
4432
4432
|
const r = typeof o.bounds == "object" && o.bounds !== null && !Ya(o.bounds) ? o.bounds : {}, i = () => {
|
|
4433
|
-
const
|
|
4434
|
-
return typeof
|
|
4435
|
-
}, a = (
|
|
4433
|
+
const b = e.appliedValue(n, "rotate");
|
|
4434
|
+
return typeof b == "number" ? b : 0;
|
|
4435
|
+
}, a = (b) => Math.min(r.maxRotation ?? 1 / 0, Math.max(r.minRotation ?? -1 / 0, b));
|
|
4436
4436
|
let l = null, c = !1, h, u = { x: 0, y: 0 }, d = 0, f = 0, p = [];
|
|
4437
|
-
const g = (
|
|
4437
|
+
const g = (b) => Math.atan2(b.clientY - u.y, b.clientX - u.x) * 180 / Math.PI, m = (b) => {
|
|
4438
4438
|
if (c) return;
|
|
4439
|
-
l?.kill(), l = null, c = !0, h =
|
|
4440
|
-
const
|
|
4441
|
-
u = { x:
|
|
4442
|
-
}, y = (
|
|
4443
|
-
if (!c ||
|
|
4444
|
-
const
|
|
4445
|
-
let M =
|
|
4446
|
-
M > 180 && (M -= 360), M < -180 && (M += 360), d =
|
|
4439
|
+
l?.kill(), l = null, c = !0, h = b.pointerId, s.setPointerCapture?.(b.pointerId);
|
|
4440
|
+
const w = s.getBoundingClientRect();
|
|
4441
|
+
u = { x: w.left + w.width / 2, y: w.top + w.height / 2 }, d = g(b), f = i(), p = [{ time: performance.now(), rotation: f }], o.onPress?.();
|
|
4442
|
+
}, y = (b) => {
|
|
4443
|
+
if (!c || b.pointerId !== h) return;
|
|
4444
|
+
const w = g(b);
|
|
4445
|
+
let M = w - d;
|
|
4446
|
+
M > 180 && (M -= 360), M < -180 && (M += 360), d = w, f += M;
|
|
4447
4447
|
let E = a(f);
|
|
4448
4448
|
o.snap && (E = a(Math.round(E / o.snap) * o.snap)), e.apply(n, { rotate: E });
|
|
4449
4449
|
const v = performance.now();
|
|
4450
4450
|
for (p.push({ time: v, rotation: E }); p.length > 2 && v - p[0].time > 100; ) p.shift();
|
|
4451
4451
|
const S = { x: 0, y: 0 };
|
|
4452
4452
|
o.onDrag?.(S);
|
|
4453
|
-
}, k = (
|
|
4454
|
-
if (!c ||
|
|
4453
|
+
}, k = (b) => {
|
|
4454
|
+
if (!c || b.pointerId !== h) return;
|
|
4455
4455
|
c = !1;
|
|
4456
|
-
const
|
|
4456
|
+
const w = p[0], M = p[p.length - 1], E = w && M ? (M.time - w.time) / 1e3 : 0, v = E > 0 ? (M.rotation - w.rotation) / E : 0;
|
|
4457
4457
|
if (o.onRelease?.({ x: v, y: 0 }), !o.inertia) return;
|
|
4458
4458
|
const S = o.inertia === !0 ? {} : o.inertia, x = S.friction ?? (S.resistance !== void 0 ? jl(S.resistance) : 4), T = typeof S.end == "number" || Array.isArray(S.end) ? S.end : void 0;
|
|
4459
4459
|
l = t.to(s, {
|
|
@@ -4517,18 +4517,18 @@ function Xa(t, e, n, s = {}) {
|
|
|
4517
4517
|
let g = n.boxes.get(f) ?? null, m;
|
|
4518
4518
|
const y = Nd(f), k = !g && y !== void 0 ? n.ids.get(y) : void 0;
|
|
4519
4519
|
k && k.element !== f && (g = k.box, m = k.element);
|
|
4520
|
-
const [
|
|
4521
|
-
_i.get(f)?.timeline.removeTracks({ target:
|
|
4522
|
-
const
|
|
4520
|
+
const [b] = t.resolveTargets(f);
|
|
4521
|
+
_i.get(f)?.timeline.removeTracks({ target: b });
|
|
4522
|
+
const w = d * i;
|
|
4523
4523
|
if (!g) {
|
|
4524
4524
|
if (l === !1) continue;
|
|
4525
|
-
u.fromTo(f, { x: 0, y: 0, scaleX: 1, scaleY: 1, ...l }, { ...Bd(l), x: 0, y: 0, scaleX: 1, scaleY: 1, duration: o, ease: r, delay:
|
|
4525
|
+
u.fromTo(f, { x: 0, y: 0, scaleX: 1, scaleY: 1, ...l }, { ...Bd(l), x: 0, y: 0, scaleX: 1, scaleY: 1, duration: o, ease: r, delay: w }, 0), _i.set(f, u), d++;
|
|
4526
4526
|
continue;
|
|
4527
4527
|
}
|
|
4528
4528
|
const M = g.cx - p.cx, E = g.cy - p.cy, v = a ? g.width / p.width : 1, S = a ? g.height / p.height : 1;
|
|
4529
4529
|
if (!(Math.abs(M) > 0.5 || Math.abs(E) > 0.5 || Math.abs(v - 1) > 1e-3 || Math.abs(S - 1) > 1e-3)) {
|
|
4530
4530
|
const A = (P, I) => {
|
|
4531
|
-
const C = t.appliedValue(
|
|
4531
|
+
const C = t.appliedValue(b, P);
|
|
4532
4532
|
return typeof C == "number" && Math.abs(C - I) > 1e-6;
|
|
4533
4533
|
};
|
|
4534
4534
|
(A("x", 0) || A("y", 0) || A("scaleX", 1) || A("scaleY", 1)) && u.set(f, { x: 0, y: 0, scaleX: 1, scaleY: 1 }, 0);
|
|
@@ -4538,9 +4538,9 @@ function Xa(t, e, n, s = {}) {
|
|
|
4538
4538
|
u.fromTo(
|
|
4539
4539
|
f,
|
|
4540
4540
|
{ x: M, y: E, scaleX: v, scaleY: S, ...T && { opacity: 0 } },
|
|
4541
|
-
{ x: 0, y: 0, scaleX: 1, scaleY: 1, ...T && { opacity: 1 }, duration: o, ease: r, delay:
|
|
4541
|
+
{ x: 0, y: 0, scaleX: 1, scaleY: 1, ...T && { opacity: 1 }, duration: o, ease: r, delay: w },
|
|
4542
4542
|
0
|
|
4543
|
-
), T && m && gh(m) && u.fromTo(m, { opacity: 1 }, { opacity: 0, duration: o, ease: r, delay:
|
|
4543
|
+
), T && m && gh(m) && u.fromTo(m, { opacity: 1 }, { opacity: 0, duration: o, ease: r, delay: w }, 0), _i.set(f, u), d++;
|
|
4544
4544
|
}
|
|
4545
4545
|
return u;
|
|
4546
4546
|
}
|
|
@@ -4572,15 +4572,15 @@ function v1(t, e = {}) {
|
|
|
4572
4572
|
}, d = () => {
|
|
4573
4573
|
const g = { chars: [], words: [], lines: [], masks: [] };
|
|
4574
4574
|
for (const { element: m } of r) {
|
|
4575
|
-
const y = (m.textContent ?? "").replace(/\s+/g, " ").trim(), k = M1(m, s.words),
|
|
4575
|
+
const y = (m.textContent ?? "").replace(/\s+/g, " ").trim(), k = M1(m, s.words), b = n.has("chars") ? k.flatMap((E) => x1(E, s.chars)) : [], w = n.has("lines") ? T1(m, k, s.lines) : [];
|
|
4576
4576
|
if (o) {
|
|
4577
4577
|
!m.hasAttribute("aria-label") && y && m.setAttribute("aria-label", y);
|
|
4578
4578
|
for (const E of k) E.setAttribute("aria-hidden", "true");
|
|
4579
4579
|
}
|
|
4580
4580
|
if (n.has("words")) g.words.push(...k);
|
|
4581
4581
|
else for (const E of k) E.removeAttribute("class");
|
|
4582
|
-
g.chars.push(...
|
|
4583
|
-
const M = e.mask === "lines" ?
|
|
4582
|
+
g.chars.push(...b), g.lines.push(...w);
|
|
4583
|
+
const M = e.mask === "lines" ? w : e.mask === "words" ? k : e.mask === "chars" ? b : [];
|
|
4584
4584
|
for (const E of M) g.masks.push(E1(E, `${s[e.mask]}-mask`));
|
|
4585
4585
|
}
|
|
4586
4586
|
i = g;
|
|
@@ -4612,21 +4612,21 @@ function v1(t, e = {}) {
|
|
|
4612
4612
|
const y = () => {
|
|
4613
4613
|
if (m) return;
|
|
4614
4614
|
m = !0;
|
|
4615
|
-
const
|
|
4615
|
+
const b = () => {
|
|
4616
4616
|
m = !1, f.split();
|
|
4617
4617
|
};
|
|
4618
|
-
typeof requestAnimationFrame == "function" ? requestAnimationFrame(
|
|
4618
|
+
typeof requestAnimationFrame == "function" ? requestAnimationFrame(b) : setTimeout(b, 0);
|
|
4619
4619
|
};
|
|
4620
4620
|
if (typeof ResizeObserver == "function") {
|
|
4621
|
-
l = new ResizeObserver((
|
|
4622
|
-
let
|
|
4623
|
-
for (const M of
|
|
4621
|
+
l = new ResizeObserver((b) => {
|
|
4622
|
+
let w = !1;
|
|
4623
|
+
for (const M of b) {
|
|
4624
4624
|
const E = Math.round(M.contentRect.width), v = g.get(M.target);
|
|
4625
|
-
g.set(M.target, E), v !== void 0 && v !== E && (
|
|
4625
|
+
g.set(M.target, E), v !== void 0 && v !== E && (w = !0);
|
|
4626
4626
|
}
|
|
4627
|
-
|
|
4627
|
+
w && y();
|
|
4628
4628
|
});
|
|
4629
|
-
for (const
|
|
4629
|
+
for (const b of t) l.observe(b);
|
|
4630
4630
|
}
|
|
4631
4631
|
const k = t[0]?.ownerDocument?.fonts;
|
|
4632
4632
|
k && k.status !== "loaded" && k.ready.then(() => y());
|
|
@@ -4686,14 +4686,14 @@ function T1(t, e, n) {
|
|
|
4686
4686
|
const g = o.get(p);
|
|
4687
4687
|
if (g && (!l || u || g.top > c + h) && (f(), c = g.top, h = g.height / 2, u = !1), !l) continue;
|
|
4688
4688
|
const m = [];
|
|
4689
|
-
for (let
|
|
4689
|
+
for (let b = p.parentNode; b && b !== t; b = b.parentNode) m.unshift(b);
|
|
4690
4690
|
let y = 0;
|
|
4691
4691
|
for (; y < d.length && y < m.length && d[y].original === m[y]; ) y++;
|
|
4692
4692
|
d.length = y;
|
|
4693
4693
|
let k = y === 0 ? l : d[y - 1].clone;
|
|
4694
|
-
for (const
|
|
4695
|
-
const
|
|
4696
|
-
k.appendChild(
|
|
4694
|
+
for (const b of m.slice(y)) {
|
|
4695
|
+
const w = b.cloneNode(!1);
|
|
4696
|
+
k.appendChild(w), d.push({ original: b, clone: w }), k = w;
|
|
4697
4697
|
}
|
|
4698
4698
|
k.appendChild(p);
|
|
4699
4699
|
}
|
|
@@ -5786,13 +5786,13 @@ function xh(t, e, n, s = {}) {
|
|
|
5786
5786
|
}, a = {
|
|
5787
5787
|
x: r ? r.scrollWidth - r.clientWidth : document.documentElement.scrollWidth - window.innerWidth,
|
|
5788
5788
|
y: r ? r.scrollHeight - r.clientHeight : document.documentElement.scrollHeight - window.innerHeight
|
|
5789
|
-
}, l = (k,
|
|
5790
|
-
if (
|
|
5791
|
-
if (typeof
|
|
5792
|
-
if (
|
|
5793
|
-
const
|
|
5794
|
-
if (!
|
|
5795
|
-
const M =
|
|
5789
|
+
}, l = (k, b) => {
|
|
5790
|
+
if (b === void 0) return i[k];
|
|
5791
|
+
if (typeof b == "number") return b;
|
|
5792
|
+
if (b === "max") return a[k];
|
|
5793
|
+
const w = typeof b == "string" ? o.querySelector(b) : b;
|
|
5794
|
+
if (!w) return i[k];
|
|
5795
|
+
const M = w.getBoundingClientRect(), E = r?.getBoundingClientRect(), v = (k === "x" ? s.offsetX : s.offsetY) ?? s.offset ?? 0;
|
|
5796
5796
|
return k === "x" ? M.left - (E?.left ?? 0) + i.x - v : M.top - (E?.top ?? 0) + i.y - v;
|
|
5797
5797
|
}, c = typeof n == "object" && n !== null && !("nodeType" in n) ? { x: l("x", n.x), y: l("y", n.y) } : { x: i.x, y: l("y", n) }, h = { x: Math.max(0, Math.min(a.x, c.x)), y: Math.max(0, Math.min(a.y, c.y)) }, u = { ...i }, d = () => {
|
|
5798
5798
|
r ? (r.scrollLeft = u.x, r.scrollTop = u.y) : window.scrollTo({ left: u.x, top: u.y, behavior: "instant" });
|
|
@@ -6167,9 +6167,9 @@ class De {
|
|
|
6167
6167
|
const i = o.length > 1 ? ja(n.stagger, this.staggerContext(o)) : void 0, a = o.map((m) => this.targetFor(m)).filter((m) => m !== void 0), l = i ? a.map((m) => [m]) : [a], c = i ? Wa(o.length, i).map((m) => m / 1e3) : [0], h = this.compat.timeOf(s) / 1e3 + Sr(n.delay, 0) / 1e3;
|
|
6168
6168
|
let u = 1 / 0, d = -1 / 0;
|
|
6169
6169
|
if (l.forEach((m, y) => {
|
|
6170
|
-
r.forEach((k,
|
|
6171
|
-
const
|
|
6172
|
-
this.tween(m, [k],
|
|
6170
|
+
r.forEach((k, b) => {
|
|
6171
|
+
const w = b === 0 ? h + c[y] : ">";
|
|
6172
|
+
this.tween(m, [k], w, ([M], E, v) => this.compat.to(E, M, v)), u = Math.min(u, this.compat.lastStart), d = Math.max(d, this.compat.lastEnd);
|
|
6173
6173
|
});
|
|
6174
6174
|
}), u === 1 / 0) return;
|
|
6175
6175
|
const { onStart: f, onUpdate: p, onComplete: g } = n;
|
|
@@ -6191,7 +6191,7 @@ class De {
|
|
|
6191
6191
|
}
|
|
6192
6192
|
const a = n.length - 1, { stagger: l, ...c } = n[a], h = ja(l, this.staggerContext(e)), u = h ? Wa(e.length, h).map((d) => d / 1e3) : e.map(() => 0);
|
|
6193
6193
|
e.forEach((d, f) => {
|
|
6194
|
-
const p = f === 0 ? Sr(c.delay, 0) / 1e3 + u[0] : 0, g = f === 0 ? 0 : u[f] - u[f - 1], m = f === 0 ? s : `<${g < 0 ? "-" : "+"}${Math.abs(g).toFixed(6)}`, k = n.map((
|
|
6194
|
+
const p = f === 0 ? Sr(c.delay, 0) / 1e3 + u[0] : 0, g = f === 0 ? 0 : u[f] - u[f - 1], m = f === 0 ? s : `<${g < 0 ? "-" : "+"}${Math.abs(g).toFixed(6)}`, k = n.map((b, w) => w === a ? { ...c, delay: p } : b).map((b) => this.prepare(Sh(b, f, this.targetFor(d), this.stage.utils, r), [d]));
|
|
6195
6195
|
o(k, [d], m);
|
|
6196
6196
|
});
|
|
6197
6197
|
}
|
|
@@ -6967,10 +6967,10 @@ function pb(t, e, n = {}) {
|
|
|
6967
6967
|
q.value = String(F), q.textContent = `${F}×`, F === 1 && (q.selected = !0), k.appendChild(q);
|
|
6968
6968
|
}
|
|
6969
6969
|
k.addEventListener("change", () => t.setSpeed(Number(k.value))), c.append(u, d, f, p, m, y), r.length > 0 && c.append(k), l.append(c);
|
|
6970
|
-
const
|
|
6971
|
-
|
|
6972
|
-
const
|
|
6973
|
-
|
|
6970
|
+
const b = n.fullscreen ? wb(e, s, o) : void 0;
|
|
6971
|
+
b && c.append(b.button);
|
|
6972
|
+
const w = s.createElement("p");
|
|
6973
|
+
w.className = "tf-ctl-caption", w.setAttribute("aria-live", "polite"), n.captions !== !1 && l.append(w);
|
|
6974
6974
|
const M = s.createElement("div");
|
|
6975
6975
|
M.className = "tf-ctl-question", M.hidden = !0;
|
|
6976
6976
|
const E = s.createElement("span"), v = h(o.reveal, o.reveal, () => t.play(), "tf-ctl-primary");
|
|
@@ -6989,11 +6989,11 @@ function pb(t, e, n = {}) {
|
|
|
6989
6989
|
const Q = t.currentMarker, V = Q ? U.indexOf(Q) + 1 : 0;
|
|
6990
6990
|
y.textContent = o.stepFormat.replace("{index}", String(V)).replace("{total}", String(U.length)), y.setAttribute("aria-label", `${o.step} ${V} ${o.of} ${U.length}`), d.disabled = t.currentTime <= 0.5, p.disabled = t.currentTime >= q - 0.5;
|
|
6991
6991
|
const R = t.caption() ?? "";
|
|
6992
|
-
|
|
6992
|
+
w.textContent !== R && (w.textContent = R), w.hidden = !a();
|
|
6993
6993
|
const B = !F && Q?.question !== void 0 && Math.abs(t.currentTime - Q.time) < 1;
|
|
6994
6994
|
M.hidden = !B, B && E.textContent !== Q.question && (E.textContent = Q.question);
|
|
6995
6995
|
} else
|
|
6996
|
-
M.hidden = !0,
|
|
6996
|
+
M.hidden = !0, w.hidden = !0;
|
|
6997
6997
|
S?.update();
|
|
6998
6998
|
}, A = t.subscribe(T);
|
|
6999
6999
|
T();
|
|
@@ -7020,22 +7020,22 @@ function pb(t, e, n = {}) {
|
|
|
7020
7020
|
break;
|
|
7021
7021
|
case "f":
|
|
7022
7022
|
case "F":
|
|
7023
|
-
if (!
|
|
7024
|
-
F.preventDefault(),
|
|
7023
|
+
if (!b) return;
|
|
7024
|
+
F.preventDefault(), b.active ? b.exit() : b.enter();
|
|
7025
7025
|
break;
|
|
7026
7026
|
}
|
|
7027
7027
|
};
|
|
7028
7028
|
return P.addEventListener("keydown", C), l.addEventListener("keydown", C), {
|
|
7029
7029
|
element: l,
|
|
7030
|
-
fullscreen:
|
|
7030
|
+
fullscreen: b && {
|
|
7031
7031
|
get active() {
|
|
7032
|
-
return
|
|
7032
|
+
return b.active;
|
|
7033
7033
|
},
|
|
7034
|
-
enter:
|
|
7035
|
-
exit:
|
|
7034
|
+
enter: b.enter,
|
|
7035
|
+
exit: b.exit
|
|
7036
7036
|
},
|
|
7037
7037
|
destroy() {
|
|
7038
|
-
|
|
7038
|
+
b?.destroy(), A(), P.removeEventListener("keydown", C), l.removeEventListener("keydown", C), l.remove();
|
|
7039
7039
|
}
|
|
7040
7040
|
};
|
|
7041
7041
|
}
|
|
@@ -7648,18 +7648,18 @@ function Ua(t, e, n) {
|
|
|
7648
7648
|
const p = d.slice(1).map((m, y) => Math.hypot(m.x - d[y].x, m.y - d[y].y)), g = p.reduce((m, y) => m + y, 0) * Math.min(1, Math.max(0, f));
|
|
7649
7649
|
c((m) => {
|
|
7650
7650
|
const y = [], k = [];
|
|
7651
|
-
if (d.forEach((
|
|
7652
|
-
y.push({ x:
|
|
7651
|
+
if (d.forEach((w, M) => {
|
|
7652
|
+
y.push({ x: w.x + l(m, s * 0.5), y: w.y + l(m, s * 0.5) }), M > 0 && k.push([m.next() * 2 - 1, m.next() * 2 - 1]);
|
|
7653
7653
|
}), g <= 0) return;
|
|
7654
7654
|
t.beginPath(), t.moveTo(y[0].x, y[0].y);
|
|
7655
|
-
let
|
|
7656
|
-
for (let
|
|
7657
|
-
const M = _b(y[
|
|
7658
|
-
if (
|
|
7659
|
-
t.bezierCurveTo(M[1].x, M[1].y, M[2].x, M[2].y, M[3].x, M[3].y),
|
|
7655
|
+
let b = 0;
|
|
7656
|
+
for (let w = 1; w < y.length; w++) {
|
|
7657
|
+
const M = _b(y[w - 1], y[w], s, k[w - 1]), E = p[w - 1];
|
|
7658
|
+
if (b + E <= g) {
|
|
7659
|
+
t.bezierCurveTo(M[1].x, M[1].y, M[2].x, M[2].y, M[3].x, M[3].y), b += E;
|
|
7660
7660
|
continue;
|
|
7661
7661
|
}
|
|
7662
|
-
const v = Hb(M, E === 0 ? 1 : (g -
|
|
7662
|
+
const v = Hb(M, E === 0 ? 1 : (g - b) / E);
|
|
7663
7663
|
t.bezierCurveTo(v[1].x, v[1].y, v[2].x, v[2].y, v[3].x, v[3].y);
|
|
7664
7664
|
break;
|
|
7665
7665
|
}
|
|
@@ -7667,9 +7667,9 @@ function Ua(t, e, n) {
|
|
|
7667
7667
|
});
|
|
7668
7668
|
}, u = (d, f, p, g, m = 1) => {
|
|
7669
7669
|
c((y) => {
|
|
7670
|
-
const
|
|
7670
|
+
const b = y.next() * Math.PI * 2, w = Math.PI * 2 + 0.15 + y.next() * 0.3, M = [];
|
|
7671
7671
|
for (let v = 0; v <= 14; v++) {
|
|
7672
|
-
const S =
|
|
7672
|
+
const S = b + w * v / 14, x = l(y, s * 0.6);
|
|
7673
7673
|
M.push({ x: d + Math.cos(S) * (p + x), y: f + Math.sin(S) * (g + x) });
|
|
7674
7674
|
}
|
|
7675
7675
|
const E = On(M, m);
|
|
@@ -7681,12 +7681,12 @@ function Ua(t, e, n) {
|
|
|
7681
7681
|
curve(d, f = 1) {
|
|
7682
7682
|
if (d.length < 2) return;
|
|
7683
7683
|
const p = d[0], g = d[d.length - 1], m = Math.hypot(g.x - p.x, g.y - p.y) || 1, y = -(g.y - p.y) / m, k = (g.x - p.x) / m;
|
|
7684
|
-
c((
|
|
7685
|
-
const
|
|
7684
|
+
c((b) => {
|
|
7685
|
+
const w = { x: l(b, s * 0.5), y: l(b, s * 0.5) }, M = { x: l(b, s * 0.5), y: l(b, s * 0.5) }, E = l(b, s * Math.min(1.5, Math.max(0.3, m / 80))), v = d.map((x, T) => {
|
|
7686
7686
|
const A = T / (d.length - 1), P = Math.sin(Math.PI * A) * E;
|
|
7687
7687
|
return {
|
|
7688
|
-
x: x.x +
|
|
7689
|
-
y: x.y +
|
|
7688
|
+
x: x.x + w.x + (M.x - w.x) * A + y * P,
|
|
7689
|
+
y: x.y + w.y + (M.y - w.y) * A + k * P
|
|
7690
7690
|
};
|
|
7691
7691
|
}), S = On(v, f);
|
|
7692
7692
|
S.length < 2 || (Ih(t, S), t.stroke());
|
|
@@ -7892,10 +7892,10 @@ function Bb(t, e, n, s) {
|
|
|
7892
7892
|
}, l = (u, d) => {
|
|
7893
7893
|
const f = nf(d), p = Nb(u);
|
|
7894
7894
|
if (!f || p < n * 1.5) return;
|
|
7895
|
-
const g = qi(u, Math.max(2, p * 0.25), !0), m = ji(g, !0), y = Ch(g, m), k = m.map((v) => ({ x: v.x * y, y: v.y * y })),
|
|
7895
|
+
const g = qi(u, Math.max(2, p * 0.25), !0), m = ji(g, !0), y = Ch(g, m), k = m.map((v) => ({ x: v.x * y, y: v.y * y })), b = k.map((v) => v.x * o + v.y * r), w = t.globalAlpha, M = (v, S, x, T) => {
|
|
7896
7896
|
if (T <= 0) return;
|
|
7897
|
-
const A = g.map((I, C) => ({ x: I.x - k[C].x * v(
|
|
7898
|
-
Fo(t, [...A, ...P.reverse()]), t.globalAlpha =
|
|
7897
|
+
const A = g.map((I, C) => ({ x: I.x - k[C].x * v(b[C]), y: I.y - k[C].y * v(b[C]) })), P = g.map((I, C) => ({ x: I.x - k[C].x * S(b[C]), y: I.y - k[C].y * S(b[C]) }));
|
|
7898
|
+
Fo(t, [...A, ...P.reverse()]), t.globalAlpha = w * T, t.fillStyle = x, t.fill();
|
|
7899
7899
|
};
|
|
7900
7900
|
t.save(), Fo(t, u), t.clip();
|
|
7901
7901
|
const E = (v, S, x, T = () => -n) => {
|
|
@@ -7916,8 +7916,8 @@ function Bb(t, e, n, s) {
|
|
|
7916
7916
|
},
|
|
7917
7917
|
line(u, d, f) {
|
|
7918
7918
|
if (u.length < 2 || d <= 0) return;
|
|
7919
|
-
const p = qi(u, Math.max(1.5, d * 1.5), !1), g = ji(p, !1), m = p.length, y = p.map((k,
|
|
7920
|
-
const
|
|
7919
|
+
const p = qi(u, Math.max(1.5, d * 1.5), !1), g = ji(p, !1), m = p.length, y = p.map((k, b) => {
|
|
7920
|
+
const w = b / (m - 1), M = 1 - s.taper * 0.6 * (1 - Math.sqrt(Math.sin(Math.PI * w))), E = f ? i({ x: g[b].x * f, y: g[b].y * f }) : 1;
|
|
7921
7921
|
return d * M * E;
|
|
7922
7922
|
});
|
|
7923
7923
|
a(p, g, y, !1);
|
|
@@ -8020,13 +8020,13 @@ function _h(t) {
|
|
|
8020
8020
|
function qb(t, e) {
|
|
8021
8021
|
const n = e.pencil ?? {}, s = e.ink, o = n.roughness ?? Math.max(1, e.lineWidth * 0.12), r = Math.max(1, Math.round(n.passes ?? 2)), i = Math.min(1, Math.max(0, n.pressure ?? 0.25)), a = Math.min(1, Math.max(0, n.rubbedOut ?? 0.15)), l = Zd(e.time, n.boil ?? 8);
|
|
8022
8022
|
let c = 0;
|
|
8023
|
-
const h = (p, g, m = !1) => He(be(`${e.seed}:${m ? "paper" : l}:${p}:${g}`)), u = (p, g, m, y, k,
|
|
8023
|
+
const h = (p, g, m = !1) => He(be(`${e.seed}:${m ? "paper" : l}:${p}:${g}`)), u = (p, g, m, y, k, b = 0) => {
|
|
8024
8024
|
if (p.length < 2) return;
|
|
8025
|
-
const
|
|
8026
|
-
let M = Db(p, Math.max(1.5, Math.min(e.lineWidth * 0.8,
|
|
8027
|
-
if (
|
|
8025
|
+
const w = p.slice(1).reduce((A, P, I) => A + Math.hypot(P.x - p[I].x, P.y - p[I].y), 0);
|
|
8026
|
+
let M = Db(p, Math.max(1.5, Math.min(e.lineWidth * 0.8, w / 24)));
|
|
8027
|
+
if (b > 0 && M.length >= 2) {
|
|
8028
8028
|
const [A, P] = [M[M.length - 2], M[M.length - 1]], I = Math.hypot(P.x - A.x, P.y - A.y) || 1;
|
|
8029
|
-
M = [...M, { x: P.x + (P.x - A.x) / I *
|
|
8029
|
+
M = [...M, { x: P.x + (P.x - A.x) / I * b, y: P.y + (P.y - A.y) / I * b }];
|
|
8030
8030
|
}
|
|
8031
8031
|
const E = _h(m), v = _h(m), S = M.length, x = [], T = [];
|
|
8032
8032
|
M.forEach((A, P) => {
|
|
@@ -8039,17 +8039,17 @@ function qb(t, e) {
|
|
|
8039
8039
|
const M = (y.next() * 2 - 1) * e.lineWidth * 1.4, E = (y.next() * 2 - 1) * e.lineWidth * 1.4, v = p.map((S) => ({ x: S.x + M, y: S.y + E }));
|
|
8040
8040
|
u(v, (S) => g(S) * 1.8, h(m, 98, !0), 0.035, o), u(v, (S) => g(S) * 0.45, h(m, 97, !0), 0.12, o * 1.5);
|
|
8041
8041
|
}
|
|
8042
|
-
const k = p.slice(1).reduce((M, E, v) => M + Math.hypot(E.x - p[v].x, E.y - p[v].y), 0),
|
|
8042
|
+
const k = p.slice(1).reduce((M, E, v) => M + Math.hypot(E.x - p[v].x, E.y - p[v].y), 0), b = g(0.5) > 4 && k > g(0.5) * 6, w = b ? [-0.3, 0.3, 0] : [0];
|
|
8043
8043
|
for (let M = 0; M < r; M++) {
|
|
8044
8044
|
const E = M === 0;
|
|
8045
|
-
|
|
8045
|
+
w.forEach((v, S) => {
|
|
8046
8046
|
const x = h(m, M * 10 + S), T = v === 0 ? p : zb(p, (P) => g(P) * v * Math.sqrt(Math.sin(Math.PI * P))), A = !E && v === 0 ? e.lineWidth * (0.3 + x.next() * 0.8) : 0;
|
|
8047
|
-
u(T, (P) => g(P) * (
|
|
8047
|
+
u(T, (P) => g(P) * (b ? 0.5 : 1) * (E ? 1 : 0.6), x, E ? 0.85 : 0.45, o * (E ? 0.6 : 1), A);
|
|
8048
8048
|
});
|
|
8049
8049
|
}
|
|
8050
|
-
}, f = (p, g, m, y, k,
|
|
8050
|
+
}, f = (p, g, m, y, k, b) => {
|
|
8051
8051
|
const M = h(c, 50).next() * Math.PI * 2;
|
|
8052
|
-
d(Ar(p, g, m, y, k, M, 1.08, 48), () =>
|
|
8052
|
+
d(Ar(p, g, m, y, k, M, 1.08, 48), () => b);
|
|
8053
8053
|
};
|
|
8054
8054
|
return {
|
|
8055
8055
|
look: "pencil",
|
|
@@ -8063,8 +8063,8 @@ function qb(t, e) {
|
|
|
8063
8063
|
shape(p, g, m) {
|
|
8064
8064
|
g !== null && (t.save(), t.globalAlpha *= 0.88, t.fillStyle = g, $r(t, p, !0), t.fill(), t.restore()), m > 0 && d([...p, p[0]], () => m);
|
|
8065
8065
|
},
|
|
8066
|
-
ellipse(p, g, m, y, k,
|
|
8067
|
-
|
|
8066
|
+
ellipse(p, g, m, y, k, b, w) {
|
|
8067
|
+
b !== null && (t.save(), t.globalAlpha *= 0.9, t.fillStyle = b, t.beginPath(), t.ellipse(p, g, m, y, k, 0, Math.PI * 2), t.fill(), t.restore()), f(p, g, m, y, k, w);
|
|
8068
8068
|
},
|
|
8069
8069
|
dot(p, g, m) {
|
|
8070
8070
|
t.save(), t.globalAlpha *= 0.9, t.fillStyle = s, t.beginPath(), t.arc(p, g, m, 0, Math.PI * 2), t.fill(), t.restore();
|
|
@@ -8076,8 +8076,8 @@ function qb(t, e) {
|
|
|
8076
8076
|
},
|
|
8077
8077
|
guideEllipse(p, g, m, y, k) {
|
|
8078
8078
|
if (n.construction === !1) return;
|
|
8079
|
-
const
|
|
8080
|
-
u(M, () => Math.max(0.6, e.lineWidth * 0.18),
|
|
8079
|
+
const b = c++, w = h(b, 0), M = Ar(p, g, m, y, k, w.next() * Math.PI * 2, 1.12, 48);
|
|
8080
|
+
u(M, () => Math.max(0.6, e.lineWidth * 0.18), w, 0.28, o * 1.5);
|
|
8081
8081
|
}
|
|
8082
8082
|
};
|
|
8083
8083
|
}
|
|
@@ -8195,11 +8195,11 @@ function Za(t, e = {}) {
|
|
|
8195
8195
|
...P,
|
|
8196
8196
|
knuckle: [P.knuckle[0] * c, P.knuckle[1], P.knuckle[2]],
|
|
8197
8197
|
width: P.width * l
|
|
8198
|
-
}), u = Qe(n.bend ?? 0), d = Qe(n.tilt ?? 0), f = Qe(90 * (n.turn ?? 0)), p = (P) => En(En(En(P, Hh, -u), Us, -d), Rh, f), g = Math.cos(i), m = Math.sin(i), y = Qe(n.roll ?? 0), k = Math.cos(y),
|
|
8199
|
-
const I = P[0] * s, C = -P[1] * s, F = (I * k - C *
|
|
8198
|
+
}), u = Qe(n.bend ?? 0), d = Qe(n.tilt ?? 0), f = Qe(90 * (n.turn ?? 0)), p = (P) => En(En(En(P, Hh, -u), Us, -d), Rh, f), g = Math.cos(i), m = Math.sin(i), y = Qe(n.roll ?? 0), k = Math.cos(y), b = Math.sin(y), w = (P) => {
|
|
8199
|
+
const I = P[0] * s, C = -P[1] * s, F = (I * k - C * b) * r, q = I * b + C * k;
|
|
8200
8200
|
return { x: F * g - q * m, y: F * m + q * g };
|
|
8201
8201
|
}, M = (P) => {
|
|
8202
|
-
const I =
|
|
8202
|
+
const I = w(P), C = Math.hypot(I.x, I.y);
|
|
8203
8203
|
return C > 1e-6 * s ? { x: I.x / C, y: I.y / C } : { x: 0, y: 0 };
|
|
8204
8204
|
}, E = {
|
|
8205
8205
|
thumb: ew(n["thumb.curl"] ?? 0, n["thumb.across"] ?? 0, l, c)
|
|
@@ -8212,14 +8212,14 @@ function Za(t, e = {}) {
|
|
|
8212
8212
|
for (const [P, I] of Object.entries(E)) {
|
|
8213
8213
|
const C = I.joints.map(p), F = p(I.back);
|
|
8214
8214
|
S[P] = {
|
|
8215
|
-
points: C.map(
|
|
8215
|
+
points: C.map(w),
|
|
8216
8216
|
depths: C.map((q) => q[2] * s),
|
|
8217
8217
|
widths: I.widths.map((q) => q * s),
|
|
8218
8218
|
nail: F[2],
|
|
8219
8219
|
back: M(F)
|
|
8220
8220
|
};
|
|
8221
8221
|
}
|
|
8222
|
-
const x = Qb.flatMap(([P, I]) => [p([P * c, I, Jb]), p([P * c, I, Zb])]), T = sw(x.map(
|
|
8222
|
+
const x = Qb.flatMap(([P, I]) => [p([P * c, I, Jb]), p([P * c, I, Zb])]), T = sw(x.map(w)), A = x.reduce((P, I) => P + I[2], 0) / x.length * s;
|
|
8223
8223
|
return {
|
|
8224
8224
|
size: s,
|
|
8225
8225
|
side: o,
|
|
@@ -8341,8 +8341,8 @@ function aw(t, e, n, s, o, r) {
|
|
|
8341
8341
|
t.moveTo(l.x + g, l.y), t.arc(l.x, l.y, g, 0, Math.PI * 2), t.clip("evenodd");
|
|
8342
8342
|
}
|
|
8343
8343
|
if (s === "none") {
|
|
8344
|
-
const g = Yt(a, h, u), m = a[a.length - 2], y = Math.atan2(c.y - m.y, c.x - m.x), k = Array.from({ length: 13 }, (
|
|
8345
|
-
const M = y + Math.PI / 2 -
|
|
8344
|
+
const g = Yt(a, h, u), m = a[a.length - 2], y = Math.atan2(c.y - m.y, c.x - m.x), k = Array.from({ length: 13 }, (b, w) => {
|
|
8345
|
+
const M = y + Math.PI / 2 - w * Math.PI / 12;
|
|
8346
8346
|
return { x: c.x + Math.cos(M) * u / 2, y: c.y + Math.sin(M) * u / 2 };
|
|
8347
8347
|
});
|
|
8348
8348
|
e.shape([...g.slice(0, a.length), ...k.slice(1), ...g.slice(a.length)], null, o);
|
|
@@ -8397,7 +8397,7 @@ function li(t) {
|
|
|
8397
8397
|
function uw(t, e, n = ht, s = 1) {
|
|
8398
8398
|
const o = li(t);
|
|
8399
8399
|
if (o === ee.walk) return fw(e, n, s);
|
|
8400
|
-
const r = e * Math.PI * 2, i = Math.sin(r) * s, a = Math.cos(r) * s, l = (
|
|
8400
|
+
const r = e * Math.PI * 2, i = Math.sin(r) * s, a = Math.cos(r) * s, l = (w) => Math.abs(w) <= hw, c = n.lean + o.lean * s, h = (n.bend ?? 0) + (o.bend ?? 0), u = c + h, d = (o.shoulder ?? 0) + u, f = (w, M) => l(w) ? M * d + o.arm * i : w, p = o.forearm ?? 0, g = l(n.leftShoulder) ? n.leftElbow - p - o.elbow * Math.max(0, -i) : n.leftElbow, m = l(n.rightShoulder) ? n.rightElbow + p + o.elbow * Math.max(0, i) : n.rightElbow, y = rf(o, r), k = o.crouch ?? 0, b = af(o, a);
|
|
8401
8401
|
return {
|
|
8402
8402
|
...n,
|
|
8403
8403
|
lean: c + (o.sway ?? 0) * Math.sin(r) * (1 - (n.turn ?? 0)),
|
|
@@ -8406,12 +8406,12 @@ function uw(t, e, n = ht, s = 1) {
|
|
|
8406
8406
|
leftElbow: g,
|
|
8407
8407
|
rightElbow: m,
|
|
8408
8408
|
// A crouch brings both thighs forward and folds both shins back.
|
|
8409
|
-
leftHip: -o.swing * i - k * 0.5 -
|
|
8410
|
-
rightHip: -o.swing * i + k * 0.5 +
|
|
8409
|
+
leftHip: -o.swing * i - k * 0.5 - b.left * 0.5,
|
|
8410
|
+
rightHip: -o.swing * i + k * 0.5 + b.right * 0.5,
|
|
8411
8411
|
// The leg swinging forward lifts its knee; a crouch keeps both bent. A positive
|
|
8412
8412
|
// knee folds toward the centre, which is backward only for the right leg.
|
|
8413
|
-
leftKnee: -o.knee * Math.max(0, a) - k -
|
|
8414
|
-
rightKnee: o.knee * Math.max(0, -a) + k +
|
|
8413
|
+
leftKnee: -o.knee * Math.max(0, a) - k - b.left,
|
|
8414
|
+
rightKnee: o.knee * Math.max(0, -a) + k + b.right,
|
|
8415
8415
|
leftAnkle: (n.leftAnkle ?? 0) + (o.tiptoe ?? 0),
|
|
8416
8416
|
rightAnkle: (n.rightAnkle ?? 0) + (o.tiptoe ?? 0),
|
|
8417
8417
|
leftShoulder: f(n.leftShoulder, -1),
|
|
@@ -8582,8 +8582,8 @@ function Rw(t, e, n, s, o, r) {
|
|
|
8582
8582
|
const E = k > 1.2 ? 0.075 * n : 0.1 * n;
|
|
8583
8583
|
t.beginPath(), t.ellipse(y.x + h, c + u, E, E * 1.1 * Math.min(k, 1), 0, 0, Math.PI * 2), t.fill();
|
|
8584
8584
|
}
|
|
8585
|
-
const
|
|
8586
|
-
t.beginPath(), t.moveTo(M,
|
|
8585
|
+
const b = yf(c, n, y.brow, k), w = y.x + l - y.side * 0.13 * n * y.squeeze, M = y.x + l + y.side * 0.13 * n * y.squeeze;
|
|
8586
|
+
t.beginPath(), t.moveTo(M, b), t.lineTo(w, b - e.browTilt * 0.1 * n), t.stroke();
|
|
8587
8587
|
}
|
|
8588
8588
|
const f = s + pf * n, p = 0.25 * n * Math.max(0.3, e.mouthWidth) * (1 - vw * a), g = Math.min(1, Math.max(0, e.mouth));
|
|
8589
8589
|
if (t.beginPath(), g <= 0.05) {
|
|
@@ -8600,30 +8600,30 @@ function bf(t, e) {
|
|
|
8600
8600
|
const j = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, Math.abs(fe(R - B) / 2) + fe(Y))), nt = Math.max(-1, Math.min(1, Tw + _)), $ = g + (1 - g) * V * nt;
|
|
8601
8601
|
return p ? { x: 0, y: 0 } : { x: Math.cos(j) * Dh * $, y: Math.sin(j) * Dh };
|
|
8602
8602
|
}, y = { left: t.leftAnkle ?? 0, right: t.rightAnkle ?? 0 }, k = { left: t.leftFootOut ?? 0, right: t.rightFootOut ?? 0 };
|
|
8603
|
-
let
|
|
8603
|
+
let b = 0;
|
|
8604
8604
|
if (c > 0 || !p) {
|
|
8605
8605
|
const V = (_, j, nt, $, O) => el * Math.cos(fe(j)) + Pr * Math.cos(fe(j - nt)) + Math.max(0, m(_, j, nt, $, O).y), R = Math.max(
|
|
8606
8606
|
V(-1, h, u, y.left, k.left),
|
|
8607
8607
|
V(1, d, f, y.right, k.right)
|
|
8608
8608
|
), B = 1 - yn((t.rise ?? 0) / _w), Y = (p ? Math.min(1, c / Cw) : 1) * B;
|
|
8609
|
-
|
|
8609
|
+
b = (Wh - R) * Y * n * s;
|
|
8610
8610
|
}
|
|
8611
|
-
const
|
|
8611
|
+
const w = -Wh * n * s + b, M = -a * n * s + b, E = p ? 0 : ($w * yn(t.turn) + Pw * c) * n * s, v = fe(t.bend ?? 0), S = { end: qh(w, M, v, 1), bend: v };
|
|
8612
8612
|
let x;
|
|
8613
8613
|
if (v !== 0) {
|
|
8614
8614
|
x = [];
|
|
8615
8615
|
for (let V = 0; V <= zh; V++) {
|
|
8616
|
-
const R = V / zh, B = qh(
|
|
8616
|
+
const R = V / zh, B = qh(w, M, v, R);
|
|
8617
8617
|
x.push({ x: B.x - E * Math.sin(Math.PI * R), y: B.y });
|
|
8618
8618
|
}
|
|
8619
8619
|
} else
|
|
8620
|
-
x = E === 0 ? [{ x: 0, y:
|
|
8620
|
+
x = E === 0 ? [{ x: 0, y: w }, { x: 0, y: M }] : vs({ x: 0, y: w }, { x: -E, y: (w + M) / 2 }, { x: 0, y: M }, 1, 8);
|
|
8621
8621
|
const T = M + yw * n * s, A = (e.shoulderWidth ?? 0) * n * Math.cos(g * Math.PI / 2), P = (V, R, B, Y, _) => {
|
|
8622
8622
|
const j = Hw(B, Y);
|
|
8623
8623
|
return { x: V + j.x * _ * n, y: R + j.y * _ * n };
|
|
8624
8624
|
}, I = (V, R, B) => {
|
|
8625
|
-
const Y = P(0,
|
|
8626
|
-
return { root: { x: 0, y:
|
|
8625
|
+
const Y = P(0, w, R, V, el * s);
|
|
8626
|
+
return { root: { x: 0, y: w }, joint: Y, end: P(Y.x, Y.y, R - B, V, Pr * s) };
|
|
8627
8627
|
}, C = (V, R, B) => {
|
|
8628
8628
|
const Y = { x: V * A, y: T }, _ = P(Y.x, Y.y, R, V, bw * o * r);
|
|
8629
8629
|
return { root: Y, joint: _, end: P(_.x, _.y, R + B, V, ww * o * r) };
|
|
@@ -8644,9 +8644,9 @@ function bf(t, e) {
|
|
|
8644
8644
|
// The head keeps its area: taller and narrower when stretched.
|
|
8645
8645
|
headRx: l / Math.sqrt(s),
|
|
8646
8646
|
headRy: l * Math.sqrt(s),
|
|
8647
|
-
hipY:
|
|
8647
|
+
hipY: w,
|
|
8648
8648
|
neckY: M,
|
|
8649
|
-
drop:
|
|
8649
|
+
drop: b,
|
|
8650
8650
|
lean: p ? t.lean : t.lean + Iw * Math.sin(Math.PI * c),
|
|
8651
8651
|
classic: p,
|
|
8652
8652
|
legs: F,
|
|
@@ -8717,19 +8717,19 @@ function Ww(t, e, n, s) {
|
|
|
8717
8717
|
};
|
|
8718
8718
|
}
|
|
8719
8719
|
function Lw(t, e) {
|
|
8720
|
-
const n = fe(t.lean), s = fe(e.headTilt), o = { x: 0, y: t.hipY }, r = (
|
|
8721
|
-
const [E, v] =
|
|
8720
|
+
const n = fe(t.lean), s = fe(e.headTilt), o = { x: 0, y: t.hipY }, r = (w) => ({ x: t.facing * w.x, y: w.y }), i = (w) => r(lo(w, o, n)), a = (w) => i(Fw(t, w)), l = (w) => a(lo({ x: w.x, y: w.y + t.neckY }, { x: 0, y: t.neckY }, s)), c = Ys(t.arms.left, t.rubber).map(a), h = Ys(t.arms.right, t.rubber).map(a), u = (w, M) => Math.atan2(M.y - w.y, M.x - w.x), d = { left: a(t.handTips.left), right: a(t.handTips.right) }, f = (w, M) => {
|
|
8721
|
+
const [E, v] = w.slice(-2), S = t.arms[M], x = u(a(S.end), d[M]) - u(a(S.joint), a(S.end));
|
|
8722
8722
|
return u(E, v) + x;
|
|
8723
8723
|
};
|
|
8724
8724
|
let p = 1 / 0;
|
|
8725
|
-
for (const [
|
|
8725
|
+
for (const [w, M] of [
|
|
8726
8726
|
[e.leftBrow, e.leftEye],
|
|
8727
8727
|
[e.rightBrow, e.rightEye]
|
|
8728
8728
|
]) {
|
|
8729
|
-
const E = yf(nl, 1,
|
|
8729
|
+
const E = yf(nl, 1, w, mf(M, e.blink));
|
|
8730
8730
|
p = Math.min(p, E, E - e.browTilt * 0.1);
|
|
8731
8731
|
}
|
|
8732
|
-
const g = { left: r(t.legs.left.end), right: r(t.legs.right.end) }, m = { left: r(t.toes.left), right: r(t.toes.right) }, y = { left: Math.max(g.left.y, m.left.y), right: Math.max(g.right.y, m.right.y) }, k = Math.max(y.left, y.right),
|
|
8732
|
+
const g = { left: r(t.legs.left.end), right: r(t.legs.right.end) }, m = { left: r(t.toes.left), right: r(t.toes.right) }, y = { left: Math.max(g.left.y, m.left.y), right: Math.max(g.right.y, m.right.y) }, k = Math.max(y.left, y.right), b = gf * t.height;
|
|
8733
8733
|
return {
|
|
8734
8734
|
facing: t.facing,
|
|
8735
8735
|
height: t.height,
|
|
@@ -8744,7 +8744,7 @@ function Lw(t, e) {
|
|
|
8744
8744
|
feet: g,
|
|
8745
8745
|
toes: m,
|
|
8746
8746
|
feetY: k,
|
|
8747
|
-
grounded: { left: y.left >= k -
|
|
8747
|
+
grounded: { left: y.left >= k - b, right: y.right >= k - b },
|
|
8748
8748
|
fingertips: d,
|
|
8749
8749
|
handAngle: { left: f(c, "left"), right: f(h, "right") },
|
|
8750
8750
|
limbs: {
|
|
@@ -8820,15 +8820,15 @@ function Bw(t, e, n = {}, s = 0) {
|
|
|
8820
8820
|
}, m = (v, S) => g(Ys(v, o.rubber), o.rubber > 0, S), y = (v) => {
|
|
8821
8821
|
o.classic || g([o.legs[v].end, o.toes[v]], !1, Sw);
|
|
8822
8822
|
}, k = (v) => {
|
|
8823
|
-
if (n.hands && !o.classic) return
|
|
8823
|
+
if (n.hands && !o.classic) return w(v);
|
|
8824
8824
|
if (o.classic || l) return;
|
|
8825
8825
|
const S = o.arms[v].end;
|
|
8826
8826
|
t.beginPath(), t.arc(S.x, S.y, Ew * o.lineWidth, 0, Math.PI * 2), t.fill();
|
|
8827
8827
|
};
|
|
8828
8828
|
t.save(), t.strokeStyle = r, t.fillStyle = r, t.lineWidth = o.lineWidth, t.lineCap = "round", t.lineJoin = "round";
|
|
8829
|
-
const
|
|
8830
|
-
(
|
|
8831
|
-
function
|
|
8829
|
+
const b = kf(o, e.spin ?? 0, e.rise ?? 0);
|
|
8830
|
+
(b.angle !== 0 || b.lift !== 0) && (t.translate(0, -b.lift), t.translate(b.pivot.x, b.pivot.y), t.rotate(b.angle), t.translate(-b.pivot.x, -b.pivot.y));
|
|
8831
|
+
function w(v) {
|
|
8832
8832
|
const S = n.hands ?? {}, x = o.arms[v].end, T = o.handTips[v], A = n.headFill ?? "#ffffff";
|
|
8833
8833
|
Gl(t, x, S[v] ?? Ft, {
|
|
8834
8834
|
side: v,
|
|
@@ -9153,9 +9153,9 @@ function e2(t, e, n) {
|
|
|
9153
9153
|
let f = 0;
|
|
9154
9154
|
const p = d.map((y, k) => {
|
|
9155
9155
|
if (k > 0) {
|
|
9156
|
-
const
|
|
9157
|
-
for (let M = 0; M <
|
|
9158
|
-
const E =
|
|
9156
|
+
const b = d[k - 1], w = Math.max(1, Math.ceil((y - b) * 16));
|
|
9157
|
+
for (let M = 0; M < w; M++) {
|
|
9158
|
+
const E = b + (y - b) * M / w, v = b + (y - b) * (M + 1) / w;
|
|
9159
9159
|
f += (Gi(s, v, n) - Gi(s, E, n)) * c((E + v) / 2);
|
|
9160
9160
|
}
|
|
9161
9161
|
}
|
|
@@ -10013,10 +10013,10 @@ function $f(t = {}) {
|
|
|
10013
10013
|
],
|
|
10014
10014
|
angles(u, d) {
|
|
10015
10015
|
if (d.id === "spine") {
|
|
10016
|
-
const k = -h(u, "lean") / 2,
|
|
10016
|
+
const k = -h(u, "lean") / 2, b = h(u, "side") / 2, w = -h(u, "bend");
|
|
10017
10017
|
return [
|
|
10018
|
-
{ swing: k +
|
|
10019
|
-
{ swing: k +
|
|
10018
|
+
{ swing: k + w * b2, spread: b },
|
|
10019
|
+
{ swing: k + w * w2, spread: b }
|
|
10020
10020
|
];
|
|
10021
10021
|
}
|
|
10022
10022
|
if (d.id === "neck") return [{ swing: -h(u, "bend") * k2, spread: 0 }];
|
|
@@ -10207,8 +10207,8 @@ function To(t, e, n) {
|
|
|
10207
10207
|
for (const g of t.chains) {
|
|
10208
10208
|
const m = g.parent ? i[g.parent] : void 0;
|
|
10209
10209
|
if (g.parent && !m) throw new Error(`body plan ${t.id}: chain ${g.id} comes before its parent ${g.parent}`);
|
|
10210
|
-
const y = g.at ?? (m ? m.joints3.length - 1 : 0), k = m ? m.joints3[y] : r,
|
|
10211
|
-
let T =
|
|
10210
|
+
const y = g.at ?? (m ? m.joints3.length - 1 : 0), k = m ? m.joints3[y] : r, b = m ? m.frames[Math.max(0, y - 1)] : Ql, w = g.offset ? qe(k, Js(Cr(g.offset, s), b)) : k, M = g.side ?? 1, E = t.boneScale?.(e, g) ?? 1, v = t.angles(e, g), S = [w], x = [];
|
|
10211
|
+
let T = b;
|
|
10212
10212
|
g.bones.forEach((A, P) => {
|
|
10213
10213
|
const I = v[P] ?? { swing: 0, spread: 0 };
|
|
10214
10214
|
T = Of(T, de(I.swing), de(I.spread) * M), x.push(T);
|
|
@@ -10236,17 +10236,17 @@ function tc(t, e, n) {
|
|
|
10236
10236
|
return { x: g.x + T * Math.cos(m) - A * Math.sin(m), y: g.y + T * Math.sin(m) + A * Math.cos(m) };
|
|
10237
10237
|
}, k = ([x, T, A]) => [x * Math.cos(m) + T * Math.sin(m), -x * Math.sin(m) + T * Math.cos(m), A];
|
|
10238
10238
|
for (const x of Object.values(d)) x.points = x.points.map(y);
|
|
10239
|
-
const
|
|
10239
|
+
const b = {
|
|
10240
10240
|
center: y(f.point),
|
|
10241
10241
|
depth: f.depth,
|
|
10242
10242
|
rx: l,
|
|
10243
10243
|
ry: c,
|
|
10244
10244
|
angle: 0,
|
|
10245
10245
|
axes: p.map(k)
|
|
10246
|
-
},
|
|
10247
|
-
|
|
10246
|
+
}, w = b.axes[1];
|
|
10247
|
+
b.angle = Math.atan2(w[0], w[1]);
|
|
10248
10248
|
const M = (x) => {
|
|
10249
|
-
if ("head" in x) return { x:
|
|
10249
|
+
if ("head" in x) return { x: b.center.x + w[0] * c, y: b.center.y - w[1] * c };
|
|
10250
10250
|
const T = d[x.chain];
|
|
10251
10251
|
return T.points[Math.min(x.joint, T.points.length - 1)];
|
|
10252
10252
|
};
|
|
@@ -10254,13 +10254,13 @@ function tc(t, e, n) {
|
|
|
10254
10254
|
(n.contact ?? "ground") === "ground" && (E = -Math.max(...t.contacts.map((x) => M(x).y))), E -= (e.lift ?? 0) * s;
|
|
10255
10255
|
const v = (x) => ({ x: x.x, y: x.y + E });
|
|
10256
10256
|
for (const x of Object.values(d)) x.points = x.points.map(v);
|
|
10257
|
-
|
|
10257
|
+
b.center = v(b.center);
|
|
10258
10258
|
const S = t.contacts.map((x) => ({ spec: x, point: M(x) }));
|
|
10259
10259
|
return {
|
|
10260
10260
|
height: s,
|
|
10261
10261
|
view: o,
|
|
10262
10262
|
chains: d,
|
|
10263
|
-
head:
|
|
10263
|
+
head: b,
|
|
10264
10264
|
hip: v(y(g)),
|
|
10265
10265
|
hipDepth: Lo(i, o).depth,
|
|
10266
10266
|
contacts: S,
|
|
@@ -10297,10 +10297,10 @@ function ec(t, e, n, s) {
|
|
|
10297
10297
|
}, d = s.toView(l), f = So(Qt([0, 0, 1], r), -de(e.roll ?? 0)), p = il(_r(s.toView(qe(l, f)), d)), g = s.toScreen(d), m = s.toScreen([d[0] + 1, d[1], d[2]]), y = Math.hypot(m.x - g.x, m.y - g.y), k = (A) => {
|
|
10298
10298
|
const P = s.toView(A);
|
|
10299
10299
|
return { point: s.toScreen(P), depth: P[2] * y };
|
|
10300
|
-
},
|
|
10300
|
+
}, b = {};
|
|
10301
10301
|
for (const A of t.chains) {
|
|
10302
10302
|
const P = c[A.id].map(k);
|
|
10303
|
-
|
|
10303
|
+
b[A.id] = {
|
|
10304
10304
|
id: A.id,
|
|
10305
10305
|
joints3: i.chains[A.id].joints3,
|
|
10306
10306
|
frames: i.chains[A.id].frames,
|
|
@@ -10308,9 +10308,9 @@ function ec(t, e, n, s) {
|
|
|
10308
10308
|
depths: P.map((I) => I.depth)
|
|
10309
10309
|
};
|
|
10310
10310
|
}
|
|
10311
|
-
const
|
|
10311
|
+
const w = s.toView(h), M = s.toScreen(w), E = s.toScreen([w[0] + 1, w[1], w[2]]), v = Math.hypot(E.x - M.x, E.y - M.y), S = a.head.axes.map((A) => il(_r(s.toView(qe(h, A)), w))), x = {
|
|
10312
10312
|
center: M,
|
|
10313
|
-
depth:
|
|
10313
|
+
depth: w[2] * y,
|
|
10314
10314
|
rx: i.head.rx * v,
|
|
10315
10315
|
ry: i.head.ry * v,
|
|
10316
10316
|
angle: Math.atan2(S[1][0], S[1][1]),
|
|
@@ -10320,7 +10320,7 @@ function ec(t, e, n, s) {
|
|
|
10320
10320
|
height: o * y,
|
|
10321
10321
|
view: r,
|
|
10322
10322
|
bodyForward: p,
|
|
10323
|
-
chains:
|
|
10323
|
+
chains: b,
|
|
10324
10324
|
head: x,
|
|
10325
10325
|
hip: g,
|
|
10326
10326
|
hipDepth: d[2] * y,
|
|
@@ -10348,17 +10348,17 @@ function co(t, e, n, s, o) {
|
|
|
10348
10348
|
const i = tc(t, { ...e, turn: 0, roll: 0, lift: 0 }, { height: o.height, contact: "none" }), a = i.chains[n];
|
|
10349
10349
|
if (es(ln(s, a.joints3[2])) < o.height * 1e-12) return e;
|
|
10350
10350
|
const l = a.joints3[0], c = es(ln(a.joints3[1], a.joints3[0])), h = es(ln(a.joints3[2], a.joints3[1])), u = r.parent ? i.chains[r.parent].frames[Math.max(0, (r.at ?? i.chains[r.parent].joints3.length - 1) - 1)] : Ql, d = ln(s, l), f = t.angles(e, r), p = (F) => (f[F]?.yaw ?? 0) * Math.PI / 180, g = Math.min(c + h - 1e-6, Math.max(Math.abs(c - h) + 1e-6, es(d))), m = Vh(d), y = r.parent !== null, k = Qt(Js(r.pole ?? (y ? [0, -0.35, -1] : [0, 0, 1]), u), p(0));
|
|
10351
|
-
let
|
|
10352
|
-
es(
|
|
10353
|
-
const
|
|
10354
|
-
const q = P2(m,
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10351
|
+
let b = ln(k, [m[0] * Ji(k, m), m[1] * Ji(k, m), m[2] * Ji(k, m)]);
|
|
10352
|
+
es(b) < 1e-6 && (b = Qt([1, 0, 0], p(0))), b = Vh(b);
|
|
10353
|
+
const w = (c * c + g * g - h * h) / (2 * c * g), M = Math.sqrt(Math.max(0, 1 - w * w)), E = [l[0] + m[0] * g, l[1] + m[1] * g, l[2] + m[2] * g], v = r.side ?? 1, S = (F) => ({ swing: Uh(f[F]?.swing ?? 0), spread: Uh(f[F]?.spread ?? 0) * v }), x = (F) => {
|
|
10354
|
+
const q = P2(m, b), U = [
|
|
10355
|
+
b[0] * Math.cos(F) + q[0] * Math.sin(F),
|
|
10356
|
+
b[1] * Math.cos(F) + q[1] * Math.sin(F),
|
|
10357
|
+
b[2] * Math.cos(F) + q[2] * Math.sin(F)
|
|
10358
10358
|
], Q = [
|
|
10359
|
-
l[0] + c * (
|
|
10360
|
-
l[1] + c * (
|
|
10361
|
-
l[2] + c * (
|
|
10359
|
+
l[0] + c * (w * m[0] + M * U[0]),
|
|
10360
|
+
l[1] + c * (w * m[1] + M * U[1]),
|
|
10361
|
+
l[2] + c * (w * m[2] + M * U[2])
|
|
10362
10362
|
], V = Gh(Xh(Qt(ln(Q, l), -p(0)), u), S(0)), R = Of(u, V.swing, V.spread), B = Gh(Xh(Qt(ln(E, Q), -p(1)), R), S(1));
|
|
10363
10363
|
return { upper: V, lower: B };
|
|
10364
10364
|
};
|
|
@@ -10429,8 +10429,8 @@ function Hr(t, e, n = at) {
|
|
|
10429
10429
|
const i = s.keys[r], a = s.keys[(r + 1) % s.keys.length], l = i.beat > o ? i.beat - s.beats : i.beat, c = a.beat <= i.beat ? a.beat + s.beats : a.beat, h = Jh((o - l) / (c - i.beat)), u = { ...at, ...n };
|
|
10430
10430
|
for (const m of new Set(s.keys.flatMap((y) => Object.keys(y.pose)))) {
|
|
10431
10431
|
if (m === "turn" || m === "roll") continue;
|
|
10432
|
-
const y = m.match(/^hand\.(?:left|right)\.(.+)$/)?.[1], k = n[m] ?? at[m] ?? (y ? Ft[y] : void 0) ?? 0,
|
|
10433
|
-
u[m] =
|
|
10432
|
+
const y = m.match(/^hand\.(?:left|right)\.(.+)$/)?.[1], k = n[m] ?? at[m] ?? (y ? Ft[y] : void 0) ?? 0, b = i.pose[m] ?? k;
|
|
10433
|
+
u[m] = b + ((a.pose[m] ?? k) - b) * h;
|
|
10434
10434
|
}
|
|
10435
10435
|
const d = Math.floor(e), f = e - d, p = f <= 0.6 ? 1 : 1 - Jh((f - 0.6) / 0.4), g = Math.max(0, ...s.strikes.map((m) => 1 - Math.min(is(o - m, s.beats), is(m - o, s.beats)) / 0.25));
|
|
10436
10436
|
return { pose: u, contact: { side: is(d, 2) === 0 ? "left" : "right", start: d, weight: p }, strike: g };
|
|
@@ -10618,8 +10618,8 @@ function zo(t, e, n = 1) {
|
|
|
10618
10618
|
const h = t[Math.max(0, c - 1)], u = t[Math.min(t.length - 1, c + 1)];
|
|
10619
10619
|
let d = un(h, u);
|
|
10620
10620
|
Math.hypot(d.x, d.y) < 1e-6 && (d = { x: 0, y: 1 });
|
|
10621
|
-
const f = { x: -d.y, y: d.x }, p = c / Math.max(1, t.length - 1), { left: g, right: m } = e(p), y = un(h, l), k = un(l, u),
|
|
10622
|
-
return { center: l, width: (g + m) / 2, at: p, left: Zs(l, f,
|
|
10621
|
+
const f = { x: -d.y, y: d.x }, p = c / Math.max(1, t.length - 1), { left: g, right: m } = e(p), y = un(h, l), k = un(l, u), b = y.x * k.y - y.y * k.x, w = Math.acos(Math.min(1, Math.max(-1, y.x * k.x + y.y * k.y))), M = (Math.hypot(l.x - h.x, l.y - h.y) + Math.hypot(u.x - l.x, u.y - l.y)) / (2 * Math.max(1e-6, w)), E = (v) => Math.min(v, Math.max(v * 0.2, M * 0.8));
|
|
10622
|
+
return { center: l, width: (g + m) / 2, at: p, left: Zs(l, f, b > 0 ? E(g) : g), right: Zs(l, f, b < 0 ? -E(m) : -m) };
|
|
10623
10623
|
}), o = [], r = [], i = (l, c) => {
|
|
10624
10624
|
o.push(l), r.push(c);
|
|
10625
10625
|
};
|
|
@@ -10627,10 +10627,10 @@ function zo(t, e, n = 1) {
|
|
|
10627
10627
|
const a = (l, c, h) => {
|
|
10628
10628
|
const u = { x: -c.y, y: c.x }, { left: d, right: f } = e(l.at), p = Zs(l.center, u, (d - f) / 2), g = (d + f) / 2;
|
|
10629
10629
|
for (let m = 1; m < n0; m++) {
|
|
10630
|
-
const y = m * Math.PI / n0, k = (h ? 1 : -1) * Math.cos(y),
|
|
10630
|
+
const y = m * Math.PI / n0, k = (h ? 1 : -1) * Math.cos(y), b = (h ? 1 : -n) * Math.sin(y);
|
|
10631
10631
|
i({
|
|
10632
|
-
x: p.x + g * (u.x * k + c.x *
|
|
10633
|
-
y: p.y + g * (u.y * k + c.y *
|
|
10632
|
+
x: p.x + g * (u.x * k + c.x * b),
|
|
10633
|
+
y: p.y + g * (u.y * k + c.y * b)
|
|
10634
10634
|
}, l.at);
|
|
10635
10635
|
}
|
|
10636
10636
|
};
|
|
@@ -10767,10 +10767,10 @@ function Nf(t, e) {
|
|
|
10767
10767
|
return !Number.isFinite(h) || h === 0 ? n : n.flatMap((u, d) => {
|
|
10768
10768
|
const f = n[(d + 1) % n.length], p = r(u), g = r(f), m = Math.max(1, Math.ceil(Math.hypot(g.x - p.x, g.y - p.y) / 0.025));
|
|
10769
10769
|
return Array.from({ length: m }, (y, k) => {
|
|
10770
|
-
const
|
|
10771
|
-
if (M.x * a < 0.5 || E <= 0 || E >= 1) return
|
|
10770
|
+
const b = k / m, w = { x: u.x + (f.x - u.x) * b, y: u.y + (f.y - u.y) * b }, M = r(w), E = (M.y - l + 0.115) / 0.23;
|
|
10771
|
+
if (M.x * a < 0.5 || E <= 0 || E >= 1) return w;
|
|
10772
10772
|
const v = Math.sin(E * Math.PI) ** 2 * h * t.rx * a;
|
|
10773
|
-
return { x:
|
|
10773
|
+
return { x: w.x + v * s, y: w.y + v * o };
|
|
10774
10774
|
});
|
|
10775
10775
|
});
|
|
10776
10776
|
}
|
|
@@ -10889,27 +10889,27 @@ function Z2(t, e, n, s, o = {}, r) {
|
|
|
10889
10889
|
const k = { x: 0, y: zt };
|
|
10890
10890
|
if (l(0, zt) < -Pe) return;
|
|
10891
10891
|
o.nose && l(0, Kt - 0.15) >= Pe && (o.projection === "volume" ? t.line(Lf(e), i) : t.line(a([{ x: 0.01, y: Kt - 0.1 }, { x: 0.03, y: zt + 0.2 }, { x: -0.05, y: zt + 0.17 }], { x: 0, y: zt + 0.22 }), i));
|
|
10892
|
-
const
|
|
10893
|
-
if (
|
|
10894
|
-
y && sk(t,
|
|
10892
|
+
const b = 0.25 * Math.max(0.3, vt(n, "mouthWidth", 1)), w = Math.min(1, Math.max(0, vt(n, "mouth", 0)));
|
|
10893
|
+
if (w <= 0.05) {
|
|
10894
|
+
y && sk(t, b, c, a), t.line(a(le({ x: -b, y: zt }, { x: 0, y: zt - c * 0.25 }, { x: b, y: zt }), k), i);
|
|
10895
10895
|
return;
|
|
10896
10896
|
}
|
|
10897
|
-
const M = 0.3 *
|
|
10897
|
+
const M = 0.3 * w;
|
|
10898
10898
|
let E, v, S, x;
|
|
10899
10899
|
if (c > 0.3) {
|
|
10900
10900
|
const I = zt + 0.05, C = { x: 0, y: zt - M * 2 };
|
|
10901
|
-
E = [...le({ x:
|
|
10901
|
+
E = [...le({ x: b, y: I }, C, { x: -b, y: I })], v = () => I, S = (F) => Qs({ x: b, y: I }, C, { x: -b, y: I }, F), x = 0.85;
|
|
10902
10902
|
} else if (c < -0.3) {
|
|
10903
10903
|
const I = zt - M * 0.6, C = { x: 0, y: zt + M * 1.4 };
|
|
10904
|
-
E = [...le({ x:
|
|
10904
|
+
E = [...le({ x: b, y: I }, C, { x: -b, y: I })], v = (F) => Qs({ x: b, y: I }, C, { x: -b, y: I }, F), S = () => I, x = 0.5;
|
|
10905
10905
|
} else {
|
|
10906
|
-
const I =
|
|
10906
|
+
const I = b * 0.8;
|
|
10907
10907
|
E = ie(0, zt, I, M);
|
|
10908
10908
|
const C = (F) => M * Math.sqrt(Math.max(0, 1 - (F / I) ** 2));
|
|
10909
10909
|
v = (F) => zt + C(F), S = (F) => zt - C(F), x = 0.5;
|
|
10910
10910
|
}
|
|
10911
|
-
if (t.shape(a(E, k), t.ink, 0, !0),
|
|
10912
|
-
const T = v(0) - S(0), A =
|
|
10911
|
+
if (t.shape(a(E, k), t.ink, 0, !0), w < V2) return;
|
|
10912
|
+
const T = v(0) - S(0), A = b * x, P = (I, C, F = 8) => Array.from({ length: F + 1 }, (q, U) => I + (C - I) * U / F);
|
|
10913
10913
|
if (o.tongue) {
|
|
10914
10914
|
const I = A * 0.55, C = P(I, -I).map((q) => ({ x: q, y: S(q) })), F = le({ x: -I, y: S(-I) }, { x: 0, y: S(0) + T * 0.8 }, { x: I, y: S(I) }, 8);
|
|
10915
10915
|
t.shape(a([...C, ...F.slice(1, -1)], k), J2, 0, !0);
|
|
@@ -10924,9 +10924,9 @@ function Z2(t, e, n, s, o = {}, r) {
|
|
|
10924
10924
|
}
|
|
10925
10925
|
}
|
|
10926
10926
|
function Q2(t, e, n, s, o, r, i, a, l, c, h, u, d) {
|
|
10927
|
-
const { x: f, y: p } = n, g = Math.min(1.2, Math.max(0.5, u.eyeScale ?? 1)), m = Math.min(1.2, Math.max(0.45, u.eyeAspect ?? 1)), y = 0.21 * g * (1 + i * 0.15), k = 0.25 * g * m * Math.min(o, 1.6) * (1 - r) * (1 + i * 0.3),
|
|
10928
|
-
const B = Math.min(
|
|
10929
|
-
return { x: B, y: Math.min(Qs(
|
|
10927
|
+
const { x: f, y: p } = n, g = Math.min(1.2, Math.max(0.5, u.eyeScale ?? 1)), m = Math.min(1.2, Math.max(0.45, u.eyeAspect ?? 1)), y = 0.21 * g * (1 + i * 0.15), k = 0.25 * g * m * Math.min(o, 1.6) * (1 - r) * (1 + i * 0.3), b = { x: f - y, y: p }, w = { x: f + y, y: p }, M = { x: f, y: p + k * 1.9 }, E = { x: f, y: p - k * 1.35 }, v = le(b, M, w), S = le(w, E, b), x = (V) => wt(e, V, n, u.projection).points, T = (V) => V.map((R) => {
|
|
10928
|
+
const B = Math.min(w.x, Math.max(b.x, R.x));
|
|
10929
|
+
return { x: B, y: Math.min(Qs(b, M, w, B), Math.max(Qs(w, E, b, B), R.y)) };
|
|
10930
10930
|
});
|
|
10931
10931
|
t.shape(x([...v, ...S.slice(1, -1)]), "#ffffff", h * 0.5, !0);
|
|
10932
10932
|
const A = f + Math.max(-1, Math.min(1, l)) * 0.07 * g, P = p - Math.max(-1, Math.min(1, c)) * 0.055 * g, I = 0.115 * g, C = 0.185 * g;
|
|
@@ -10939,7 +10939,7 @@ function Q2(t, e, n, s, o, r, i, a, l, c, h, u, d) {
|
|
|
10939
10939
|
R > 0.5 && (d.save(), d.beginPath(), d.arc(V.x, V.y, R, 0, Math.PI * 2), d.clip(), u.inPupil(d, { ...V, r: R, side: s === 1 ? "left" : "right" }), d.restore());
|
|
10940
10940
|
}
|
|
10941
10941
|
if (t.shape(x(T(ie(A - 0.038 * g, P + 0.075 * g, 0.035 * g, 0.045 * g))), "#ffffff", 0, !0), t.shape(x(T(ie(A + 0.04 * g, P - 0.04 * g, 0.014 * g, 0.02 * g))), "#ffffff", 0, !0), F) {
|
|
10942
|
-
const V = le(
|
|
10942
|
+
const V = le(b, { x: f, y: p + k * 1.2 }, w);
|
|
10943
10943
|
t.shape(x([...v, ...V.slice(1, -1).reverse()]), "rgba(70, 35, 30, 0.22)", 0, !0);
|
|
10944
10944
|
const R = le({ x: f - y * 0.7, y: p + k * 0.55 + 0.03 }, { x: f, y: p + k * 1.4 + 0.09 }, { x: f + y * 0.85, y: p + k * 0.5 + 0.03 });
|
|
10945
10945
|
t.line(x(R), h * 0.45);
|
|
@@ -10948,7 +10948,7 @@ function Q2(t, e, n, s, o, r, i, a, l, c, h, u, d) {
|
|
|
10948
10948
|
}
|
|
10949
10949
|
if (t.line(x(v), h * (F ? 1.9 : 1.1)), u.lashes !== !1)
|
|
10950
10950
|
for (const V of [0, 0.035]) {
|
|
10951
|
-
const R = f + s * (y - V), B = Qs(
|
|
10951
|
+
const R = f + s * (y - V), B = Qs(b, M, w, R);
|
|
10952
10952
|
t.line(x([{ x: R, y: B }, { x: R + s * 0.055, y: B + 0.07 }]), h * 0.75);
|
|
10953
10953
|
}
|
|
10954
10954
|
}
|
|
@@ -10978,11 +10978,11 @@ function ek(t, e, n) {
|
|
|
10978
10978
|
}
|
|
10979
10979
|
}
|
|
10980
10980
|
function nk(t, e, n, s, o) {
|
|
10981
|
-
const r = n === 1 ? "left" : "right", { x: i, y: a } = { x: ge.x * n, y: ge.y }, l = { x: i, y: a }, c = (S) => wt(e, S, l, o.projection).points, h = Math.max(1, 0.055 * e.rx), u = Math.max(1.5, 0.095 * e.rx), d = Math.min(1, Math.max(0, vt(s, "blink", 0))), f = Math.max(0, vt(s, `eye.${r}`, 1)), p = zf(f, d), g = Math.min(1, Math.max(0, vt(s, "bulge", 0))), m = 1 + 0.12 * Math.min(1, Math.max(0, f - 1)) + 0.25 * g, y = ge.rx * m, k = ge.ry * m,
|
|
10981
|
+
const r = n === 1 ? "left" : "right", { x: i, y: a } = { x: ge.x * n, y: ge.y }, l = { x: i, y: a }, c = (S) => wt(e, S, l, o.projection).points, h = Math.max(1, 0.055 * e.rx), u = Math.max(1.5, 0.095 * e.rx), d = Math.min(1, Math.max(0, vt(s, "blink", 0))), f = Math.max(0, vt(s, `eye.${r}`, 1)), p = zf(f, d), g = Math.min(1, Math.max(0, vt(s, "bulge", 0))), m = 1 + 0.12 * Math.min(1, Math.max(0, f - 1)) + 0.25 * g, y = ge.rx * m, k = ge.ry * m, b = vt(s, "smile", 0);
|
|
10982
10982
|
if (o.shades)
|
|
10983
10983
|
tk(t, c, i, a, n, h);
|
|
10984
10984
|
else if (p < 0.2) {
|
|
10985
|
-
const S =
|
|
10985
|
+
const S = b > 0.5 ? 0.14 : -0.08;
|
|
10986
10986
|
t.line(c(le({ x: i - y * 0.85, y: a }, { x: i, y: a + S }, { x: i + y * 0.85, y: a })), h * 1.4);
|
|
10987
10987
|
} else {
|
|
10988
10988
|
const S = ie(i, a, y, k, 32);
|
|
@@ -10996,8 +10996,8 @@ function nk(t, e, n, s, o) {
|
|
|
10996
10996
|
t.shape(c(Q), o.skin ?? "#ffffff", 0, !0), t.line(c([Q[0], Q[Q.length - 1]]), h), t.shape(c(S), null, h, !0);
|
|
10997
10997
|
}
|
|
10998
10998
|
}
|
|
10999
|
-
const
|
|
11000
|
-
t.line(wt(e, [v, E], { x: i, y:
|
|
10999
|
+
const w = a + (o.shades ? sc.ry + 0.1 : k + 0.12) + 0.08 * vt(s, `brow.${r}`, 0), M = vt(s, "browTilt", 0) * 0.06, E = { x: i + n * y * 1, y: w }, v = { x: i - n * y * 0.8, y: w + M };
|
|
11000
|
+
t.line(wt(e, [v, E], { x: i, y: w }, o.projection).points, u);
|
|
11001
11001
|
}
|
|
11002
11002
|
function sk(t, e, n, s) {
|
|
11003
11003
|
const o = zt - n * 0.125, r = e * 0.5, i = 0.045, a = ie(0, o - i * 0.9, r, i, 24);
|
|
@@ -11087,8 +11087,8 @@ function ci(t, e, n = 64) {
|
|
|
11087
11087
|
h[k] = -1;
|
|
11088
11088
|
continue;
|
|
11089
11089
|
}
|
|
11090
|
-
const
|
|
11091
|
-
h[k] = e.inside(
|
|
11090
|
+
const b = a(y);
|
|
11091
|
+
h[k] = e.inside(b, m), u[k] = h[k] > -0.35 ? ne(t, l(b, m)) : 0;
|
|
11092
11092
|
}
|
|
11093
11093
|
}
|
|
11094
11094
|
const d = (p) => (p % n + n) % n, f = (p) => {
|
|
@@ -11101,11 +11101,11 @@ function ci(t, e, n = 64) {
|
|
|
11101
11101
|
const y = (P, I) => m[I * g + P], k = (P, I, C, F) => {
|
|
11102
11102
|
const q = y(P, I), U = y(C, F), Q = q === U ? 0.5 : Math.min(1, Math.max(0, q / (q - U)));
|
|
11103
11103
|
return Ct(t, e.position(a(P + (C - P) * Q), i(I + (F - I) * Q)));
|
|
11104
|
-
},
|
|
11104
|
+
}, b = n * c * 2, w = new Int32Array(b).fill(-1), M = new Int32Array(b).fill(-1), E = /* @__PURE__ */ new Map(), v = (P, I, C) => {
|
|
11105
11105
|
const F = (C * n + d(I)) * 2 + (P ? 1 : 0);
|
|
11106
11106
|
return E.has(F) || E.set(F, P ? k(d(I), C, d(I), C + 1) : k(I, C, I + 1, C)), F;
|
|
11107
11107
|
}, S = (P, I) => {
|
|
11108
|
-
|
|
11108
|
+
w[P] === -1 ? w[P] = I : M[P] = I;
|
|
11109
11109
|
}, x = (P, I) => {
|
|
11110
11110
|
S(P, I), S(I, P);
|
|
11111
11111
|
};
|
|
@@ -11147,14 +11147,14 @@ function ci(t, e, n = 64) {
|
|
|
11147
11147
|
}
|
|
11148
11148
|
}
|
|
11149
11149
|
}
|
|
11150
|
-
const T = [], A = new Uint8Array(
|
|
11150
|
+
const T = [], A = new Uint8Array(b);
|
|
11151
11151
|
for (const P of E.keys()) {
|
|
11152
11152
|
if (A[P]) continue;
|
|
11153
11153
|
const I = [];
|
|
11154
11154
|
let C = -1, F = P;
|
|
11155
11155
|
for (; F !== -1 && !A[F]; ) {
|
|
11156
11156
|
A[F] = 1, I.push(E.get(F));
|
|
11157
|
-
const q =
|
|
11157
|
+
const q = w[F], U = M[F], Q = q !== -1 && q !== C && !A[q] ? q : U !== -1 && U !== C && !A[U] ? U : -1;
|
|
11158
11158
|
C = F, F = Q;
|
|
11159
11159
|
}
|
|
11160
11160
|
I.length >= 3 && T.push(I);
|
|
@@ -11211,7 +11211,7 @@ function hk(t) {
|
|
|
11211
11211
|
function uk(t, e, n, s) {
|
|
11212
11212
|
const o = (t.path.length - 1) / 3, r = o * 20, i = [], a = [], l = s.trail !== 0 || s.lift !== 0, c = Math.max(0, e + n);
|
|
11213
11213
|
for (let h = 0; h <= r; h++) {
|
|
11214
|
-
const u = h / r, d = Math.min(o - 1, Math.floor(u * o)), f = u * o - d, p = 1 - f, g = [p ** 3, 3 * p * p * f, 3 * p * f * f, f ** 3], m = t.path.slice(d * 3, d * 3 + 4), y = h0(m.reduce((C, F, q) => C + F.around * g[q], 0)), k = m.reduce((C, F, q) => C + F.up * g[q], 0),
|
|
11214
|
+
const u = h / r, d = Math.min(o - 1, Math.floor(u * o)), f = u * o - d, p = 1 - f, g = [p ** 3, 3 * p * p * f, 3 * p * f * f, f ** 3], m = t.path.slice(d * 3, d * 3 + 4), y = h0(m.reduce((C, F, q) => C + F.around * g[q], 0)), k = m.reduce((C, F, q) => C + F.up * g[q], 0), b = m.reduce((C, F, q) => C + (F.lift ?? 0) * g[q], 0), w = 1 + e + n + b, M = k >= 0 ? Math.sqrt(Math.max(0, 1 - k * k)) : 1, E = u * u * (t.follow ?? 1), v = h0(s.swing) * E, S = y - v, x = [Math.sin(S) * M * w, k * (k >= 0 ? w : 1), Math.cos(S) * M * w], T = [x[0], x[1] + s.lift * E, x[2] - s.trail * E], A = [Math.sin(S) * M, Math.max(0, k), Math.cos(S) * M], P = cl(x), I = l && E > 0 ? sa(T, c, P) : T;
|
|
11215
11215
|
a.push(P), i.push({ center: I, normal: A, left: I, right: I, t: u });
|
|
11216
11216
|
}
|
|
11217
11217
|
return i.forEach((h, u) => {
|
|
@@ -11252,9 +11252,9 @@ function jf(t, e, n, s, o, r, i) {
|
|
|
11252
11252
|
if (t.shape([...d, ...f.slice().reverse()], n.color, 0), (t.look === "clean" || t.look === "illustrated") && (n.shine ?? 0) > 0) {
|
|
11253
11253
|
const g = u.filter((m) => m.t >= 0.2 && m.t <= 0.75);
|
|
11254
11254
|
if (g.length >= 3) {
|
|
11255
|
-
const m = g.map((k,
|
|
11256
|
-
const
|
|
11257
|
-
return Ct(e, ls(k.center, k.left, 0.16 +
|
|
11255
|
+
const m = g.map((k, b) => {
|
|
11256
|
+
const w = 0.16 * Math.sin(Math.PI * b / (g.length - 1));
|
|
11257
|
+
return Ct(e, ls(k.center, k.left, 0.16 + w));
|
|
11258
11258
|
}), y = g.map((k) => Ct(e, ls(k.center, k.left, 0.16)));
|
|
11259
11259
|
t.shape([...m, ...y.reverse()], `rgba(255,255,255,${n.shine})`, 0);
|
|
11260
11260
|
}
|
|
@@ -11483,15 +11483,15 @@ function Xf(t, e, n = ho) {
|
|
|
11483
11483
|
},
|
|
11484
11484
|
position(h, u) {
|
|
11485
11485
|
if (s && u < 0) {
|
|
11486
|
-
const
|
|
11486
|
+
const b = t.length < 1.5 ? 0.14 * cs(-t.length + 0.45, -t.length - 0.1, u) : 0, w = (t.fall?.taper ?? 0) * cs(0, -Math.max(0.1, a(h)), u), M = 1 + e + t.volume * (1 - b * 2.5) + p0(t, h, u) - b - w;
|
|
11487
11487
|
return [M * Math.sin(h), u, M * Math.cos(h)];
|
|
11488
11488
|
}
|
|
11489
11489
|
const d = 0.4 + 0.6 * cs(0, 0.3, u - Wr(t, h)), f = 1 + e + (t.volume + p0(t, h, u)) * d, p = l(h, u, f);
|
|
11490
11490
|
if (p) return p;
|
|
11491
11491
|
const [g, m, y] = Ce(h, u), k = [g * f, m * f, y * f];
|
|
11492
11492
|
if (t.quiff > 0) {
|
|
11493
|
-
const
|
|
11494
|
-
k[1] +=
|
|
11493
|
+
const b = t.quiff * Math.exp(-((h / 0.7) ** 2)) * cs(0.15, 0.85, u);
|
|
11494
|
+
k[1] += b * 0.7, k[2] += b * 0.45;
|
|
11495
11495
|
}
|
|
11496
11496
|
return k;
|
|
11497
11497
|
},
|
|
@@ -11566,9 +11566,9 @@ function Jf(t, e, n, s, o, r) {
|
|
|
11566
11566
|
t.ellipse(m.x, m.y, g * e.rx, g * e.ry, e.angle, n.color, h);
|
|
11567
11567
|
const y = g * e.rx * 0.55;
|
|
11568
11568
|
t.line(
|
|
11569
|
-
Array.from({ length: 9 }, (k,
|
|
11570
|
-
const
|
|
11571
|
-
return { x: m.x + Math.cos(
|
|
11569
|
+
Array.from({ length: 9 }, (k, b) => {
|
|
11570
|
+
const w = -0.4 + b / 8 * Math.PI * 1.3;
|
|
11571
|
+
return { x: m.x + Math.cos(w) * y, y: m.y + Math.sin(w) * y * 0.8 };
|
|
11572
11572
|
}),
|
|
11573
11573
|
u
|
|
11574
11574
|
);
|
|
@@ -11579,8 +11579,8 @@ function Jf(t, e, n, s, o, r) {
|
|
|
11579
11579
|
t.shape(Yt(d, f, f * 0.15), n.color, h), t.line(d.slice(3, d.length - 3), u);
|
|
11580
11580
|
else {
|
|
11581
11581
|
const m = d.slice(0, d.length - 3);
|
|
11582
|
-
for (let
|
|
11583
|
-
const
|
|
11582
|
+
for (let b = 0; b < 7; b++) {
|
|
11583
|
+
const w = m[Math.floor(b / 7 * (m.length - 1))], M = m[Math.floor((b + 1) / 7 * (m.length - 1))], E = Math.atan2(M.y - w.y, M.x - w.x), v = Math.hypot(M.x - w.x, M.y - w.y), S = f * (1 - b / (7 * 2.2)), x = (b % 2 === 0 ? 1 : -1) * 0.35, T = { x: (w.x + M.x) / 2, y: (w.y + M.y) / 2 };
|
|
11584
11584
|
t.ellipse(T.x, T.y, v * 0.62, S * 0.5, E + x, n.color, h * 0.8);
|
|
11585
11585
|
}
|
|
11586
11586
|
const y = m[m.length - 1], k = d[d.length - 1];
|
|
@@ -11680,8 +11680,8 @@ function eg(t, e, n, s, o) {
|
|
|
11680
11680
|
const u = Ct(e, r), d = e.rx * (0.12 + 0.08 * a);
|
|
11681
11681
|
t.ellipse(u.x, u.y, d, h, e.angle, c, l);
|
|
11682
11682
|
const f = Math.cos(e.angle), p = Math.sin(e.angle), g = Array.from({ length: 9 }, (m, y) => {
|
|
11683
|
-
const k = -Math.PI * 0.55 + y / 8 * Math.PI * 1.1,
|
|
11684
|
-
return { x: u.x +
|
|
11683
|
+
const k = -Math.PI * 0.55 + y / 8 * Math.PI * 1.1, b = Math.cos(k) * d * 0.45 * -n, w = Math.sin(k) * h * 0.55;
|
|
11684
|
+
return { x: u.x + b * f - w * p, y: u.y + b * p + w * f };
|
|
11685
11685
|
});
|
|
11686
11686
|
t.line(g, Math.max(0.8, l * 0.7));
|
|
11687
11687
|
}
|
|
@@ -11947,8 +11947,8 @@ function rg(t, e, n, s) {
|
|
|
11947
11947
|
const d = Math.max(0.8, a * 0.7);
|
|
11948
11948
|
for (const f of zk(o)) {
|
|
11949
11949
|
const p = f.map(([m, y]) => {
|
|
11950
|
-
const [k,
|
|
11951
|
-
return [k * 0.99,
|
|
11950
|
+
const [k, b, w] = c.position(m, y);
|
|
11951
|
+
return [k * 0.99, b * 0.99, w * 0.99];
|
|
11952
11952
|
}), g = f.map(([m, y]) => Ce(m, y));
|
|
11953
11953
|
for (const m of qf(e, p, g, 0.1)) t.line(m, d);
|
|
11954
11954
|
}
|
|
@@ -12238,15 +12238,15 @@ function t5(t = {}) {
|
|
|
12238
12238
|
O.shape(Yt(L, $.height * 0.075, $.height * 0.07), g, m($));
|
|
12239
12239
|
const W = L[0], N = L[1], X = N.x - W.x, z = N.y - W.y, J = Math.hypot(X, z) || 1, tt = $.height * 0.04;
|
|
12240
12240
|
O.line([{ x: W.x - z / J * tt, y: W.y + X / J * tt }, { x: W.x + z / J * tt, y: W.y - X / J * tt }], m($) * 0.9);
|
|
12241
|
-
},
|
|
12241
|
+
}, b = ($) => {
|
|
12242
12242
|
const O = $.chains.spine, D = O[0], K = O[O.length - 1], L = { x: D.x - (K.x - D.x) * 0.25, y: D.y - (K.y - D.y) * 0.25 };
|
|
12243
12243
|
return { hip: D, top: K, below: L, line: [L, ...$.parts.spine.points] };
|
|
12244
|
-
},
|
|
12244
|
+
}, w = ($) => {
|
|
12245
12245
|
if ($.bodyContours?.spine) return na($.bodyContours.spine, 0, 0.97, $.height * (c ? 0.014 : 6e-3));
|
|
12246
12246
|
const O = c ? 1.14 : 1, D = Math.hypot($.points["hip.left"].x - $.points["hip.right"].x, $.points["hip.left"].y - $.points["hip.right"].y), K = Math.max($.height * 0.15 * O, D + Math.max($.height * 0.08, $.lineWidth * 1.45) + m($));
|
|
12247
|
-
return Yt(
|
|
12247
|
+
return Yt(b($).line, K, $.height * 0.14 * O);
|
|
12248
12248
|
}, M = ($, O) => {
|
|
12249
|
-
const D = [
|
|
12249
|
+
const D = [w(O)], { top: K, hip: L } = b(O);
|
|
12250
12250
|
h && D.push(Yt([K, mt(K, L, 0.5), mt(K, L, 1.08)], O.height * 0.155, O.height * 0.15)), l && D.push(Yt([K, mt(K, L, 0.5), L], O.height * 0.14, O.height * 0.15));
|
|
12251
12251
|
const W = Object.values(O.points), N = Math.min(...W.map((tt) => tt.x)) - O.height, X = Math.min(...W.map((tt) => tt.y)) - O.height, z = Math.max(...W.map((tt) => tt.x)) + O.height, J = Math.max(...W.map((tt) => tt.y)) + O.height;
|
|
12252
12252
|
for (const tt of D) {
|
|
@@ -12256,12 +12256,12 @@ function t5(t = {}) {
|
|
|
12256
12256
|
}
|
|
12257
12257
|
}, E = ($, O) => {
|
|
12258
12258
|
const D = c ? f : o;
|
|
12259
|
-
O.shape(
|
|
12259
|
+
O.shape(w($), D, m($));
|
|
12260
12260
|
}, v = ($, O, D) => {
|
|
12261
12261
|
const K = Vt(O);
|
|
12262
12262
|
if (!e || K < 0.2 || c) return;
|
|
12263
|
-
const { top: L, hip: W } =
|
|
12264
|
-
x0($,
|
|
12263
|
+
const { top: L, hip: W } = b(O), N = Fe(O) * O.height * 0.025, X = [L, W], z = (J, tt = 0) => S0(X, J, N + tt * O.height * K);
|
|
12264
|
+
x0($, w(O), () => {
|
|
12265
12265
|
if (e === "shirt") {
|
|
12266
12266
|
D.line([z(0.12), z(0.92)], m(O) * 0.65);
|
|
12267
12267
|
for (const J of [0.24, 0.4, 0.56, 0.72, 0.88]) {
|
|
@@ -12275,7 +12275,7 @@ function t5(t = {}) {
|
|
|
12275
12275
|
} else e === "dress" ? D.line([z(0.04, -0.035), z(0.17, -0.028), z(0.17, 0.028), z(0.04, 0.035)], m(O) * 0.75) : D.line([z(0.025, -0.035), z(0.1, -0.02), z(0.12), z(0.1, 0.02), z(0.025, 0.035)], m(O) * 0.65);
|
|
12276
12276
|
});
|
|
12277
12277
|
}, S = ($, O) => {
|
|
12278
|
-
const D = Vt($), { top: K, hip: L } =
|
|
12278
|
+
const D = Vt($), { top: K, hip: L } = b($), W = $.height * 0.07, N = { x: (K.x - L.x) * 0.16, y: (K.y - L.y) * 0.16 };
|
|
12279
12279
|
if (D >= 0) {
|
|
12280
12280
|
O.shape(
|
|
12281
12281
|
[
|
|
@@ -12305,12 +12305,12 @@ function t5(t = {}) {
|
|
|
12305
12305
|
}, x = ($, O) => {
|
|
12306
12306
|
const D = Vt($);
|
|
12307
12307
|
if (D < 0.2) return;
|
|
12308
|
-
const { top: K, hip: L } =
|
|
12308
|
+
const { top: K, hip: L } = b($), W = Fe($) * $.height * 0.03, N = $.height * 0.06 * D, X = mt(K, L, 0.62), z = mt(K, L, 0.9);
|
|
12309
12309
|
O.line([{ x: X.x + W - N, y: X.y }, { x: z.x + W - N * 1.1, y: z.y }], m($) * 0.7), O.line([{ x: X.x + W + N, y: X.y }, { x: z.x + W + N * 1.1, y: z.y }], m($) * 0.7);
|
|
12310
12310
|
const J = mt(K, L, 0.1);
|
|
12311
12311
|
for (const tt of [-1, 1]) O.line([{ x: J.x + W + tt * N * 0.2, y: J.y }, { x: J.x + W + tt * N * 0.35, y: J.y + $.height * 0.07 }], m($) * 0.6);
|
|
12312
12312
|
}, T = ($, O) => {
|
|
12313
|
-
const { top: D, hip: K } =
|
|
12313
|
+
const { top: D, hip: K } = b($), L = Vt($);
|
|
12314
12314
|
if (O.shape(Yt([D, mt(D, K, 0.5), mt(D, K, 1.08)], $.height * 0.155, $.height * 0.15), f, m($)), L < 0.2) return;
|
|
12315
12315
|
const W = Fe($) * $.height * 0.03, N = $.height * 0.02 * L, X = mt(D, K, 0.12), z = mt(D, K, 1.05);
|
|
12316
12316
|
O.shape([{ x: X.x + W - N, y: X.y }, { x: X.x + W + N, y: X.y }, { x: z.x + W + N * 1.3, y: z.y }, { x: z.x + W - N * 1.3, y: z.y }], o, m($) * 0.7);
|
|
@@ -12319,7 +12319,7 @@ function t5(t = {}) {
|
|
|
12319
12319
|
O.dot(tt.x + W + N * 1.6, tt.y, m($) * 1.2);
|
|
12320
12320
|
}
|
|
12321
12321
|
}, A = ($, O) => {
|
|
12322
|
-
const D = Vt($), { top: K, hip: L } =
|
|
12322
|
+
const D = Vt($), { top: K, hip: L } = b($), W = Fe($) * $.height * 0.04, N = mt(L, K, 0.12), X = mt(L, K, 0.74);
|
|
12323
12323
|
if (D < 0.15) {
|
|
12324
12324
|
if (D < -0.3) {
|
|
12325
12325
|
const H = $.points["shoulder.left"], G = $.points["shoulder.right"];
|
|
@@ -12345,7 +12345,7 @@ function t5(t = {}) {
|
|
|
12345
12345
|
const J = mt(X, N, 0.3), tt = z * 0.4;
|
|
12346
12346
|
O.line([{ x: J.x + W - tt, y: J.y }, { x: J.x + W - tt, y: J.y + tt * 1.4 }, { x: J.x + W + tt, y: J.y + tt * 1.4 }, { x: J.x + W + tt, y: J.y }], m($) * 0.6);
|
|
12347
12347
|
}, P = ($, O) => {
|
|
12348
|
-
const { hip: D, top: K } =
|
|
12348
|
+
const { hip: D, top: K } = b($), L = mt(D, K, 0.2), W = [$.points["ankle.left"], $.points["ankle.right"]], N = mt(D, { x: (W[0].x + W[1].x) / 2, y: (W[0].y + W[1].y) / 2 }, 0.98), X = $.height * 0.075, z = Math.max($.height * 0.12, Math.abs(W[0].x - W[1].x) / 2 + $.height * 0.07), J = N.x - L.x, tt = N.y - L.y, H = Math.hypot(J, tt) || 1, G = { x: -tt / H, y: J / H };
|
|
12349
12349
|
if (O.shape(
|
|
12350
12350
|
[
|
|
12351
12351
|
{ x: L.x + G.x * X, y: L.y + G.y * X },
|
|
@@ -12363,7 +12363,7 @@ function t5(t = {}) {
|
|
|
12363
12363
|
}
|
|
12364
12364
|
}
|
|
12365
12365
|
}, I = ($, O) => {
|
|
12366
|
-
const D = Vt($), { top: K, hip: L } =
|
|
12366
|
+
const D = Vt($), { top: K, hip: L } = b($), W = Fe($), N = W >= 0 ? "left" : "right", X = N === "left" ? "right" : "left", z = $.points[`shoulder.${N}`], J = $.height * 0.035;
|
|
12367
12367
|
if (D < 0.15) {
|
|
12368
12368
|
const G = mt(K, L, 0.9);
|
|
12369
12369
|
O.shape(Yt([z, { x: G.x + (z.x - K.x) * 0.5, y: G.y }], J * 2.2, J * 2.6), f, m($));
|
|
@@ -12378,7 +12378,7 @@ function t5(t = {}) {
|
|
|
12378
12378
|
O.shape(dg($, { top: !1, length: 0.45 }).skirt, r, m($));
|
|
12379
12379
|
return;
|
|
12380
12380
|
}
|
|
12381
|
-
const { hip: D, top: K } =
|
|
12381
|
+
const { hip: D, top: K } = b($), L = mt(D, K, 0.18), W = [$.points["knee.left"], $.points["knee.right"]], N = mt(D, { x: (W[0].x + W[1].x) / 2, y: (W[0].y + W[1].y) / 2 }, 1.05), X = $.height * 0.075, z = Math.max($.height * 0.13, Math.abs(W[0].x - W[1].x) / 2 + $.height * 0.08), J = N.x - L.x, tt = N.y - L.y, H = Math.hypot(J, tt) || 1, G = { x: -tt / H, y: J / H };
|
|
12382
12382
|
O.shape(
|
|
12383
12383
|
[
|
|
12384
12384
|
{ x: L.x + G.x * X, y: L.y + G.y * X },
|
|
@@ -12392,7 +12392,7 @@ function t5(t = {}) {
|
|
|
12392
12392
|
}, F = ($, O) => {
|
|
12393
12393
|
const D = Vt($);
|
|
12394
12394
|
if (D < 0.2) return;
|
|
12395
|
-
const { top: K, hip: L } =
|
|
12395
|
+
const { top: K, hip: L } = b($), W = { x: (L.x - K.x) * 0.12, y: (L.y - K.y) * 0.12 }, N = $.height * 0.045 * D;
|
|
12396
12396
|
for (const X of [-1, 1])
|
|
12397
12397
|
O.shape(
|
|
12398
12398
|
[
|
|
@@ -12406,10 +12406,10 @@ function t5(t = {}) {
|
|
|
12406
12406
|
}, q = ($, O, D) => {
|
|
12407
12407
|
const K = Vt($);
|
|
12408
12408
|
if (K < 0.25) return;
|
|
12409
|
-
const { top: L, hip: W } =
|
|
12409
|
+
const { top: L, hip: W } = b($), N = Fe($) * $.height * 0.03, X = (H) => ({ x: mt(L, W, H).x + N, y: mt(L, W, H).y }), z = $.height * 0.022 * K, J = X(0.08), tt = X(0.62);
|
|
12410
12410
|
O.shape([{ x: J.x - z, y: J.y - z }, { x: J.x + z, y: J.y - z }, { x: J.x + z * 0.6, y: J.y + z }, { x: J.x - z * 0.6, y: J.y + z }], D, m($) * 0.7), O.shape([{ x: J.x - z * 0.6, y: J.y + z }, { x: J.x + z * 0.6, y: J.y + z }, { x: tt.x + z * 1.4, y: tt.y - z * 2 }, tt, { x: tt.x - z * 1.4, y: tt.y - z * 2 }], D, m($) * 0.7);
|
|
12411
12411
|
}, U = ($, O) => {
|
|
12412
|
-
const D = Vt($), { top: K, hip: L } =
|
|
12412
|
+
const D = Vt($), { top: K, hip: L } = b($), W = mt(L, K, 0.72), N = [$.points["knee.left"], $.points["knee.right"]], X = mt(L, { x: (N[0].x + N[1].x) / 2, y: (N[0].y + N[1].y) / 2 }, 0.9), z = Fe($) * $.height * 0.04;
|
|
12413
12413
|
if (D < 0.15) {
|
|
12414
12414
|
const H = mt(L, K, 0.2);
|
|
12415
12415
|
D < -0.3 && O.line([{ x: H.x - $.height * 0.05, y: H.y }, { x: H.x + $.height * 0.05, y: H.y }], m($));
|
|
@@ -12429,7 +12429,7 @@ function t5(t = {}) {
|
|
|
12429
12429
|
m($)
|
|
12430
12430
|
), O.line([{ x: W.x + z - J * 0.6, y: W.y }, { x: K.x - J * 0.2, y: K.y }, { x: W.x + z + J * 0.6, y: W.y }], m($) * 0.8);
|
|
12431
12431
|
}, Q = ($, O, D) => {
|
|
12432
|
-
const { top: K, hip: L } =
|
|
12432
|
+
const { top: K, hip: L } = b($), W = [$.points["knee.left"], $.points["knee.right"]], N = mt(L, { x: (W[0].x + W[1].x) / 2, y: (W[0].y + W[1].y) / 2 }, 0.95);
|
|
12433
12433
|
D ? O.shape(Yt([mt(K, L, 0.8), L, N], $.height * 0.145, $.height * 0.17), f, m($)) : O.shape(Yt([K, mt(K, L, 0.5), L], $.height * 0.14, $.height * 0.15), f, m($));
|
|
12434
12434
|
const X = Vt($);
|
|
12435
12435
|
if (X > 0.2) {
|
|
@@ -12444,7 +12444,7 @@ function t5(t = {}) {
|
|
|
12444
12444
|
if (W) {
|
|
12445
12445
|
const Z = na(W, 0, L, $.height * 6e-3);
|
|
12446
12446
|
O.shape(Z, K, 0);
|
|
12447
|
-
const rt =
|
|
12447
|
+
const rt = w($);
|
|
12448
12448
|
for (let ct = 0; ct < Z.length; ct++) {
|
|
12449
12449
|
const dt = Z[ct], yt = Z[(ct + 1) % Z.length];
|
|
12450
12450
|
Wf({ x: (dt.x + yt.x) / 2, y: (dt.y + yt.y) / 2 }, rt) || O.line([dt, yt], m($));
|
|
@@ -12783,17 +12783,17 @@ function b5(t) {
|
|
|
12783
12783
|
function w5(t, e, n, s, o, r) {
|
|
12784
12784
|
const i = e.height, a = s * 3.1, l = b5(e), c = e.points, h = Math.hypot(c["knee.left"].x - c["hip.left"].x, c["knee.left"].y - c["hip.left"].y) + Math.hypot(c["ankle.left"].x - c["knee.left"].x, c["ankle.left"].y - c["knee.left"].y), u = Math.min(0.93, n.length, l ? 1 : 1 - (a / 2 + o) / Math.max(h, 1)), d = [0, 0.25, 0.5, 0.75, 1].map((k) => k * u), f = d.map((k) => P0(e, "left", k)), p = d.map((k) => P0(e, "right", k));
|
|
12785
12785
|
if (t.save(), t.lineCap = "round", t.lineJoin = "round", l) {
|
|
12786
|
-
const k = i * 0.035 * u,
|
|
12786
|
+
const k = i * 0.035 * u, b = d.map((M, E) => {
|
|
12787
12787
|
const v = E / (d.length - 1);
|
|
12788
12788
|
return { a: Math.min(f[E].x, p[E].x) - a / 2 - k * v, b: Math.max(f[E].x, p[E].x) + a / 2 + k * v, y: (f[E].y + p[E].y) / 2 };
|
|
12789
|
-
}),
|
|
12790
|
-
t.beginPath(), t.moveTo(
|
|
12791
|
-
for (const M of
|
|
12792
|
-
t.quadraticCurveTo((
|
|
12793
|
-
for (const M of [...
|
|
12794
|
-
t.lineTo(
|
|
12789
|
+
}), w = b[b.length - 1];
|
|
12790
|
+
t.beginPath(), t.moveTo(b[0].a + a * 0.2, b[0].y - i * 0.02);
|
|
12791
|
+
for (const M of b.slice(1)) t.lineTo(M.a, M.y);
|
|
12792
|
+
t.quadraticCurveTo((w.a + w.b) / 2, w.y + i * 0.012, w.b, w.y);
|
|
12793
|
+
for (const M of [...b].reverse().slice(1)) t.lineTo(M.b, M.y);
|
|
12794
|
+
t.lineTo(b[0].b - a * 0.2, b[0].y - i * 0.02), t.closePath(), t.fillStyle = n.color, t.fill(), t.lineWidth = o, t.strokeStyle = r, t.stroke(), t.strokeStyle = "rgba(0,0,0,0.2)", t.lineWidth = o * 0.6;
|
|
12795
12795
|
for (const M of [0.38, 0.62])
|
|
12796
|
-
t.beginPath(), t.moveTo(
|
|
12796
|
+
t.beginPath(), t.moveTo(b[1].a + (b[1].b - b[1].a) * M, b[1].y), t.lineTo(w.a + (w.b - w.a) * (M * 1.2 - 0.1), w.y), t.stroke();
|
|
12797
12797
|
t.restore();
|
|
12798
12798
|
return;
|
|
12799
12799
|
}
|
|
@@ -12838,19 +12838,19 @@ function x5(t, e, n, s, o) {
|
|
|
12838
12838
|
qo(n, s) ? Yo(t, d, f, d.length * 0.25, g) : g(), Xt(t, p, c * 0.9, e.fill);
|
|
12839
12839
|
}
|
|
12840
12840
|
} else if (s.startsWith("arm.")) {
|
|
12841
|
-
const f = s.slice(4), p = i[`elbow.${f}`], g = u5(i[`shoulder.${f}`], d, (u ? h : c) / 2 + l), m = i[`hand.${f}`], y = jo(g, p, m), k = !u && qo(n, s),
|
|
12841
|
+
const f = s.slice(4), p = i[`elbow.${f}`], g = u5(i[`shoulder.${f}`], d, (u ? h : c) / 2 + l), m = i[`hand.${f}`], y = jo(g, p, m), k = !u && qo(n, s), b = e.coat ? jo(g, p, pe(p, m, 0.8)) : null, w = c * 1.7, M = e.shirt, E = !!M && e.sleeves === "long", v = M && e.sleeves === "short" ? jo(g, pe(g, p, 0.25), pe(g, p, 0.5), 4) : null, S = c * 1.55, x = (b ? w : v ? S : c) / 2 + l * 2, T = () => {
|
|
12842
12842
|
u || Xt(t, y, c + 2 * l, a), v && Xt(t, v, S + 2 * l, a);
|
|
12843
12843
|
};
|
|
12844
|
-
if (u && !E && la(t, y, h, a, e.halo), u && E && Xt(t, y, c + 2 * l, a), k ? Yo(t, d, g, x, T) : T(), (!u || E) && Xt(t, y, c, E ? M : e.fill), v && Xt(t, v, S, M),
|
|
12845
|
-
const A = () => Xt(t,
|
|
12846
|
-
qo(n, s) ? Yo(t, d, g, x, A) : A(), Xt(t,
|
|
12844
|
+
if (u && !E && la(t, y, h, a, e.halo), u && E && Xt(t, y, c + 2 * l, a), k ? Yo(t, d, g, x, T) : T(), (!u || E) && Xt(t, y, c, E ? M : e.fill), v && Xt(t, v, S, M), b) {
|
|
12845
|
+
const A = () => Xt(t, b, w + 2 * l, a);
|
|
12846
|
+
qo(n, s) ? Yo(t, d, g, x, A) : A(), Xt(t, b, w, e.coat);
|
|
12847
12847
|
}
|
|
12848
12848
|
if (e.bangles && M5(t, p, m, r, e.bangles, a, l), o.hands === "mitten") {
|
|
12849
12849
|
const A = mg(p, m, r);
|
|
12850
12850
|
pg(t, A.x, A.y, A.rx, A.ry, A.angle, e.fill, a, l);
|
|
12851
12851
|
} else o.hands === "dot" && u && (t.beginPath(), t.arc(m.x, m.y, h * 0.9, 0, Math.PI * 2), t.fillStyle = a, t.fill());
|
|
12852
12852
|
} else if (s.startsWith("leg.")) {
|
|
12853
|
-
const f = s.slice(4), p = i[`hip.${f}`], g = i[`ankle.${f}`], m = e.trousers ? c * 1.35 : u ? h : c, y = i[`knee.${f}`], k = Math.hypot(y.x - g.x, y.y - g.y) || 1,
|
|
12853
|
+
const f = s.slice(4), p = i[`hip.${f}`], g = i[`ankle.${f}`], m = e.trousers ? c * 1.35 : u ? h : c, y = i[`knee.${f}`], k = Math.hypot(y.x - g.x, y.y - g.y) || 1, b = Math.min(k * 0.4, m / 2 + l + r * 0.012), w = { x: g.x + (y.x - g.x) / k * b, y: g.y + (y.y - g.y) / k * b }, M = jo(p, y, w), E = qo(n, s);
|
|
12854
12854
|
if (u && !e.trousers) la(t, M, h, a, e.halo);
|
|
12855
12855
|
else {
|
|
12856
12856
|
const T = () => Xt(t, M, m + 2 * l, a);
|
|
@@ -12884,8 +12884,8 @@ function Eo(t = {}) {
|
|
|
12884
12884
|
}) : void 0, h = t.shoulderWidth ?? e.shoulderWidth ?? (i ? 0.07 : a ? 0.04 : 0.06), u = i && t.body?.measurements !== void 0 ? W2(t.body.measurements) : void 0, d = t.hipWidth ?? u ?? e.hipWidth ?? (i ? 0.045 : a ? 0.02 : 0.022), f = c ? c.outlineWidth * o : t.lineWidth ?? o * (i ? 5e-3 : n ? 0.045 : 0.022), p = t.ink ?? (i ? "#53362d" : a ? "#111111" : l === "pencil" ? "#2f2f33" : "#1e293b"), g = t.skin ?? (i ? "#f1bf98" : l === "pencil" ? "none" : "#ffffff"), m = i ? L2(t.body ?? {}, { skin: g, ink: p, lineWidth: f, shoulderWidth: h, hipWidth: d }) : void 0;
|
|
12885
12885
|
if (t.leafOutfit && !i) throw new Error("character: leafOutfit requires figure: 'organic'");
|
|
12886
12886
|
const y = t.outfit && !a ? t5(t.outfit) : null, k = t.holding ? e5(t.holding) : {};
|
|
12887
|
-
let
|
|
12888
|
-
return t.leafOutfit && (
|
|
12887
|
+
let b = y ? ca(y, t.layers ?? {}) : t.layers ?? {};
|
|
12888
|
+
return t.leafOutfit && (b = ca(Jk(t.leafOutfit), b)), Object.keys(k).length > 0 && (b = ca(b, n5(k))), {
|
|
12889
12889
|
plan: t.plan ?? $f({
|
|
12890
12890
|
headSize: t.headSize ?? e.headSize ?? (i ? 0.27 : n ? 0.3 : 0.24),
|
|
12891
12891
|
shoulderWidth: r ? 0 : h,
|
|
@@ -12905,7 +12905,7 @@ function Eo(t = {}) {
|
|
|
12905
12905
|
skin: m?.fill ?? g,
|
|
12906
12906
|
seed: t.seed ?? 1,
|
|
12907
12907
|
pencil: i ? { construction: !1, ...t.pencil } : t.pencil ?? {},
|
|
12908
|
-
layers:
|
|
12908
|
+
layers: b,
|
|
12909
12909
|
holding: k,
|
|
12910
12910
|
contact: t.contact ?? "ground",
|
|
12911
12911
|
hands: t.hands ?? (i ? "cartoon" : a ? "mitten" : "dot"),
|
|
@@ -12938,7 +12938,7 @@ function ui(t, e, n) {
|
|
|
12938
12938
|
t.plan.chains.forEach((f) => {
|
|
12939
12939
|
const p = n.chains[f.id];
|
|
12940
12940
|
s[f.id] = p.points;
|
|
12941
|
-
const g = p.depths.reduce((
|
|
12941
|
+
const g = p.depths.reduce((b, w) => b + w, 0) / p.depths.length, m = f.parent ? n.chains[f.parent] : void 0, y = m ? m.depths[f.at ?? m.depths.length - 1] : n.hipDepth, k = g - y;
|
|
12942
12942
|
r[f.id] = Math.abs(k) < i ? 0 : k, o[f.id] = { points: T5(t, f, p.points), depth: g, order: 0 };
|
|
12943
12943
|
}), o.head = { points: [n.head.center], depth: n.head.depth, order: 0 }, r.head = 0;
|
|
12944
12944
|
const a = [...t.plan.chains.map((f) => f.id), "head"], l = (f) => t.body && f.startsWith("arm.") && r[f] >= 0 ? 1 : 0;
|
|
@@ -13098,12 +13098,12 @@ function $5(t, e, n, s) {
|
|
|
13098
13098
|
depth: h[g],
|
|
13099
13099
|
...i.body ? { sortDepth: p.startsWith("arm.") && g > f ? Math.max(h[g], d) : h[g] } : {},
|
|
13100
13100
|
draw(m, y = 0) {
|
|
13101
|
-
const k = ai(m, { look: i.look, ink: i.ink, lineWidth: i.lineWidth, seed: be(`${i.seed}:${p}`), time: y, pencil: i.pencil, illustrated: i.illustrated }),
|
|
13101
|
+
const k = ai(m, { look: i.look, ink: i.ink, lineWidth: i.lineWidth, seed: be(`${i.seed}:${p}`), time: y, pencil: i.pencil, illustrated: i.illustrated }), b = (M) => {
|
|
13102
13102
|
M && (m.save(), M(m, a, k, y, o), m.restore());
|
|
13103
13103
|
};
|
|
13104
|
-
m.save(), m.lineCap = "round", m.lineJoin = "round", g === 0 && (i.look === "pencil" && i.pencil.construction !== !1 && yg(k, i, a),
|
|
13105
|
-
const
|
|
13106
|
-
w
|
|
13104
|
+
m.save(), m.lineCap = "round", m.lineJoin = "round", g === 0 && (i.look === "pencil" && i.pencil.construction !== !1 && yg(k, i, a), b(i.layers.behind), cg(m, i.body && i.skin === "none" ? xo(m, k) : k, i.head, a.head, o, { lineWidth: i.lineWidth, skin: i.skin, face: i.face }));
|
|
13105
|
+
const w = i.layers.parts?.[p];
|
|
13106
|
+
b(w?.under), m.save(), w?.clip?.(m, a, k, y, o), bg(m, k, i, a, p, o), m.restore(), b(w?.over), p === "head" && hg(m, k, i.head, a.head, o, { lineWidth: i.lineWidth, skin: i.skin, face: i.face }), g === l.length - 1 && b(i.layers.front), m.restore();
|
|
13107
13107
|
}
|
|
13108
13108
|
}));
|
|
13109
13109
|
}
|
|
@@ -13849,22 +13849,22 @@ function nv(t) {
|
|
|
13849
13849
|
return Me(Jt(n, Math.acos(e) * 180 / Math.PI));
|
|
13850
13850
|
}
|
|
13851
13851
|
function sv(t, e, n, s, o) {
|
|
13852
|
-
const r = t.solid ?? {}, i = r.outline === !1 ? void 0 : r.outline ?? { width: 2, color: "#0f172a" }, a = { color: r.color ?? "#475569", shading: r.shading ?? "toon", outline: i }, l = { color: r.skin ?? "#f2c49b", shading: r.shading ?? "toon", outline: i }, c = { color: "#0f172a", shading: "unlit" }, h = s.height * 0.034, u = [], d = (
|
|
13853
|
-
for (const
|
|
13854
|
-
const
|
|
13855
|
-
|
|
13856
|
-
const S =
|
|
13852
|
+
const r = t.solid ?? {}, i = r.outline === !1 ? void 0 : r.outline ?? { width: 2, color: "#0f172a" }, a = { color: r.color ?? "#475569", shading: r.shading ?? "toon", outline: i }, l = { color: r.skin ?? "#f2c49b", shading: r.shading ?? "toon", outline: i }, c = { color: "#0f172a", shading: "unlit" }, h = s.height * 0.034, u = [], d = (b, w, M) => u.push({ mesh: b, world: Rt(o, w), material: M }), f = (b, w, M) => d(e.sphere, Bl(b, [0, 0, 0, 1], [w, w, w]), M);
|
|
13853
|
+
for (const b of n.chains) {
|
|
13854
|
+
const w = s.chains[b.id], M = b.id === "spine" ? 1.9 : 1;
|
|
13855
|
+
b.bones.forEach((E, v) => {
|
|
13856
|
+
const S = w[v], x = w[v + 1], T = Mo(S, x), [A, P] = E.width ?? [1, 1], I = h * M * (A + P) / 2;
|
|
13857
13857
|
if (T > 1e-6) {
|
|
13858
13858
|
const C = gn(S, x, 0.5), F = nv(te(ce(x, S)));
|
|
13859
13859
|
d(e.cylinder, Rt(pn(C), Rt(F, Sn([I, T, I]))), a);
|
|
13860
13860
|
}
|
|
13861
13861
|
f(S, h * M * A, a), f(x, h * M * P, a);
|
|
13862
|
-
}),
|
|
13862
|
+
}), b.id.startsWith("arm.") && f(w[w.length - 1], h * 1.5, l);
|
|
13863
13863
|
}
|
|
13864
13864
|
const { center: p, rx: g, ry: m, axes: y } = s.head, k = [...y[0], 0, ...y[1], 0, ...y[2], 0, ...p, 1];
|
|
13865
13865
|
d(e.sphere, Rt(k, Sn([g, m, g])), l);
|
|
13866
|
-
for (const
|
|
13867
|
-
const
|
|
13866
|
+
for (const b of [-1, 1]) {
|
|
13867
|
+
const w = te([b * 0.36, 0.15, 0.92]), M = Gs(p, Gs(Gs(xn(y[0], w[0] * g * 1.04), xn(y[1], w[1] * m * 1.04)), xn(y[2], w[2] * g * 1.04))), E = [...y[0], 0, ...y[1], 0, ...y[2], 0, ...M, 1];
|
|
13868
13868
|
d(e.sphere, Rt(E, Sn([g * 0.11, m * 0.14, g * 0.03])), c);
|
|
13869
13869
|
}
|
|
13870
13870
|
return u;
|
|
@@ -13903,10 +13903,10 @@ const a6 = {
|
|
|
13903
13903
|
const S = Fn(h.plan, u, { height: f, contact: h.contact });
|
|
13904
13904
|
return { meshes: sv(l, c, h.plan, S, s), drawables: k };
|
|
13905
13905
|
}
|
|
13906
|
-
const
|
|
13906
|
+
const b = ae(s, [0, f * 0.6, 0]), w = te(ce(o.position, b)), M = tf(b, w, r).map((S) => Math.min(1, S));
|
|
13907
13907
|
let E = h;
|
|
13908
13908
|
if (r.length > 0 && h.skin !== "none") {
|
|
13909
|
-
const S = Ig(h.skin, M, ef(i, Mo(
|
|
13909
|
+
const S = Ig(h.skin, M, ef(i, Mo(b, o.position)), i?.color);
|
|
13910
13910
|
E = { ...h, skin: S, ...h.body ? { body: { ...h.body, fill: S } } : {} };
|
|
13911
13911
|
}
|
|
13912
13912
|
const v = $5(E, u, g, { height: f });
|
|
@@ -14312,10 +14312,10 @@ ${s.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
|
|
|
14312
14312
|
if (j("x", B, Y[0]), j("z", B, Y[1]), j("rotateY", B, V), j("walk", B, Q + R / F), R >= P) break;
|
|
14313
14313
|
}
|
|
14314
14314
|
return h = Q + P / F, [a, l] = T[T.length - 1].point, c = V, A + C;
|
|
14315
|
-
}, k = [],
|
|
14316
|
-
let
|
|
14315
|
+
}, k = [], b = [];
|
|
14316
|
+
let w = 0;
|
|
14317
14317
|
for (const v of e) {
|
|
14318
|
-
const S = v.at ??
|
|
14318
|
+
const S = v.at ?? w;
|
|
14319
14319
|
let x = S;
|
|
14320
14320
|
if (ml.includes(v.do)) x = y(v.do, v, S);
|
|
14321
14321
|
else if (v.do === "face") x = g(S, typeof v.toward == "number" ? v.toward : fs([a, l], v.toward), v.for);
|
|
@@ -14346,7 +14346,7 @@ ${s.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
|
|
|
14346
14346
|
m(A.time, P.time, Object.fromEntries(Object.entries(P.pose).filter(([I, C]) => r[I] !== C)), P.easing ?? "ease-in-out"), A = P;
|
|
14347
14347
|
x = A.time;
|
|
14348
14348
|
} else if (v.do === "say") {
|
|
14349
|
-
x = S + (v.for ?? yv(v.say)),
|
|
14349
|
+
x = S + (v.for ?? yv(v.say)), b.push({ text: v.say, start: S, end: x });
|
|
14350
14350
|
const T = { tilt: r["head.tilt"] ?? 0, left: r["brow.left"] ?? 0, right: r["brow.right"] ?? 0 };
|
|
14351
14351
|
let A = 0;
|
|
14352
14352
|
for (let P = S + Ws; P < x - Ws / 2; P += Ws, A++) {
|
|
@@ -14358,11 +14358,11 @@ ${s.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
|
|
|
14358
14358
|
const T = v.look ?? v.toward, A = o * 0.9, P = T === "camera" ? n.camera ?? [0, 1.6, 8] : T.length === 3 ? T : [T[0], A, T[1]];
|
|
14359
14359
|
x = S + (v.for ?? 500), m(S, x, Lg({ x: a, z: l, heading: c, eyeHeight: A }, P), "ease-out");
|
|
14360
14360
|
}
|
|
14361
|
-
k.push({ do: v.do, start: S, end: x }),
|
|
14361
|
+
k.push({ do: v.do, start: S, end: x }), w = x;
|
|
14362
14362
|
}
|
|
14363
14363
|
const M = `${n.scene}/${t}`;
|
|
14364
14364
|
let E = [...u].map(([v, S]) => ({ id: `${t}-${v}`, target: M, property: v, keyframes: Hg(S) }));
|
|
14365
|
-
return d.length > 0 && E.push({ id: `${t}-gait`, target: M, property: "gait", keyframes: d }),
|
|
14365
|
+
return d.length > 0 && E.push({ id: `${t}-gait`, target: M, property: "gait", keyframes: d }), b.length > 0 && (E = kc(M, E, b, { rest: { mouth: n.pose?.mouth ?? at.mouth ?? 0, mouthWidth: n.pose?.mouthWidth ?? at.mouthWidth ?? 1 } })), { tracks: E, duration: w, beats: k, end: { position: [a, l], heading: c, pose: { ...r } } };
|
|
14366
14366
|
}
|
|
14367
14367
|
function G0(t, e, n = [0, 0, 0]) {
|
|
14368
14368
|
const s = t.filter((r) => r.target === e), o = new Wt({ id: `${e}-position`, tracks: s });
|
|
@@ -14410,8 +14410,8 @@ function u6(t) {
|
|
|
14410
14410
|
for (let f = 0; f < e; f++) {
|
|
14411
14411
|
let p = [n, s], g = -1 / 0;
|
|
14412
14412
|
for (let m = 0; m < 24; m++) {
|
|
14413
|
-
const y = Math.sqrt(u()) * o * Math.max(1, Math.sqrt(e) * 0.9), k = u() * Math.PI * 2,
|
|
14414
|
-
if (
|
|
14413
|
+
const y = Math.sqrt(u()) * o * Math.max(1, Math.sqrt(e) * 0.9), k = u() * Math.PI * 2, b = [n + Math.cos(k) * y, s + Math.sin(k) * y], w = d.length === 0 ? 1 / 0 : Math.min(...d.map((M) => Math.hypot(M[0] - b[0], M[1] - b[1])));
|
|
14414
|
+
if (w > g && (g = w, p = b), w >= o) break;
|
|
14415
14415
|
}
|
|
14416
14416
|
d.push(p), i.push({ position: p, heading: 0 });
|
|
14417
14417
|
}
|
|
@@ -14496,7 +14496,7 @@ function Dg(t, e, n = {}, s) {
|
|
|
14496
14496
|
const d = { x: e.x + h.x + 6 * l * a, y: e.y + h.y - 18 * l * a }, f = Et.pencilGrip, p = (v) => {
|
|
14497
14497
|
const S = v.fingers.thumb, x = v.fingers.index, T = v.fingers.middle, A = U0([S.points[3], x.points[3], T.points[3]]), P = U0([S.points[1], x.points[0]]), I = (S.depths[3] + x.depths[3] + T.depths[3]) / 3;
|
|
14498
14498
|
return { pinch: A, direction: Math.atan2(P.y - A.y, P.x - A.x), depth: I };
|
|
14499
|
-
}, g = Za(f, { size: u }), m = c - p(g).direction, y = Za(f, { size: u, angle: m * 180 / Math.PI }), k = p(y),
|
|
14499
|
+
}, g = Za(f, { size: u }), m = c - p(g).direction, y = Za(f, { size: u, angle: m * 180 / Math.PI }), k = p(y), b = Ev[o] * a, w = { x: k.pinch.x - Math.cos(c) * b, y: k.pinch.y - Math.sin(c) * b }, M = { x: d.x - w.x, y: d.y - w.y }, E = y.axes.up;
|
|
14500
14500
|
Av(t, M, { x: -E.x, y: -E.y }, u, n.arm ?? 300 * a, r, n.sleeve ?? "#5b7db1", i), Gl(t, M, f, {
|
|
14501
14501
|
size: u,
|
|
14502
14502
|
angle: m * 180 / Math.PI,
|
|
@@ -14709,30 +14709,30 @@ function yi(t) {
|
|
|
14709
14709
|
};
|
|
14710
14710
|
}
|
|
14711
14711
|
function Mc(t, e, { ground: n, every: s, floors: o }) {
|
|
14712
|
-
if (o.every((
|
|
14713
|
-
const r = t.find((
|
|
14714
|
-
const
|
|
14715
|
-
return o.findIndex((M) => Math.abs(M.top -
|
|
14716
|
-
}, c = (r?.keyframes ?? []).map((
|
|
14717
|
-
const
|
|
14718
|
-
if (M >= 0) return
|
|
14719
|
-
if (Math.abs(a(
|
|
14720
|
-
const E = (x) => l(x) >= 0 || Math.abs(a(x)) < 0.5, v = [...c].reverse().find((x) => x <=
|
|
14721
|
-
return v === void 0 && S === void 0 ? 0 : v === void 0 ?
|
|
14722
|
-
}, u = o.flatMap((
|
|
14723
|
-
const M = /* @__PURE__ */ new Set([
|
|
14724
|
-
for (let E =
|
|
14725
|
-
for (const E of u) for (const v of [E.start, E.end]) v >
|
|
14712
|
+
if (o.every((b) => b.windows.length === 0)) return t;
|
|
14713
|
+
const r = t.find((b) => b.target === e && b.property === "y"), i = new Wt({ id: `${e}-ride`, tracks: r ? [r] : [] }), a = (b) => r ? Number(i.getStateAtTime(b).values.get(e)?.get("y") ?? 0) : 0, l = (b) => {
|
|
14714
|
+
const w = n + a(b);
|
|
14715
|
+
return o.findIndex((M) => Math.abs(M.top - w) < 0.5);
|
|
14716
|
+
}, c = (r?.keyframes ?? []).map((b) => b.time), h = (b) => {
|
|
14717
|
+
const w = (x) => x < 0 ? 0 : o[x].offset(b), M = l(b);
|
|
14718
|
+
if (M >= 0) return w(M);
|
|
14719
|
+
if (Math.abs(a(b)) < 0.5) return 0;
|
|
14720
|
+
const E = (x) => l(x) >= 0 || Math.abs(a(x)) < 0.5, v = [...c].reverse().find((x) => x <= b && E(x)), S = c.find((x) => x >= b && E(x));
|
|
14721
|
+
return v === void 0 && S === void 0 ? 0 : v === void 0 ? w(l(S)) : S === void 0 || S === v ? w(l(v)) : w(l(v)) + (w(l(S)) - w(l(v))) * (b - v) / (S - v);
|
|
14722
|
+
}, u = o.flatMap((b) => b.windows), d = (b, w) => u.some((M) => M.start < w && M.end > b) || h(b) !== h(w), f = r ? [...r.keyframes] : [{ time: 0, value: 0 }], p = [{ ...f[0], value: f[0].value + h(f[0].time) }], g = (b, w) => {
|
|
14723
|
+
const M = /* @__PURE__ */ new Set([w]);
|
|
14724
|
+
for (let E = b + s; E < w; E += s) M.add(E);
|
|
14725
|
+
for (const E of u) for (const v of [E.start, E.end]) v > b && v < w && M.add(v);
|
|
14726
14726
|
for (const E of [...M].sort((v, S) => v - S)) p.push({ time: E, value: a(E) + h(E) });
|
|
14727
14727
|
};
|
|
14728
|
-
for (let
|
|
14729
|
-
const
|
|
14730
|
-
d(
|
|
14728
|
+
for (let b = 1; b < f.length; b++) {
|
|
14729
|
+
const w = f[b - 1].time, M = f[b].time;
|
|
14730
|
+
d(w, M) ? g(w, M) : p.push({ ...f[b], value: f[b].value + h(M) });
|
|
14731
14731
|
}
|
|
14732
|
-
const m = f[f.length - 1].time, y = Math.max(m, ...u.map((
|
|
14732
|
+
const m = f[f.length - 1].time, y = Math.max(m, ...u.map((b) => b.end));
|
|
14733
14733
|
y > m && g(m, y);
|
|
14734
14734
|
const k = { id: r?.id ?? `${e}-y`, target: e, property: "y", keyframes: p };
|
|
14735
|
-
return r ? t.map((
|
|
14735
|
+
return r ? t.map((b) => b === r ? k : b) : [...t, k];
|
|
14736
14736
|
}
|
|
14737
14737
|
function Ts(t) {
|
|
14738
14738
|
const e = t.indexOf(":");
|
|
@@ -14793,7 +14793,7 @@ function v6(t) {
|
|
|
14793
14793
|
const e = { ...Cv, ...t.theme }, n = t.code.replace(/\t/g, " ").replace(/\n$/, "").split(`
|
|
14794
14794
|
`), s = t.fontSize ?? 16, o = (t.lineHeight ?? 1.6) * s, r = (t.charWidth ?? 0.6) * s, i = t.padding ?? 12, a = t.lineNumbers === !1 ? 0 : (String(n.length).length + 2) * r, l = Math.max(1, ...n.map((R) => R.length)), c = t.width ?? i * 2 + a + l * r, h = i * 2 + n.length * o, u = t.x + i + a, d = new Set(t.hidden ?? []), f = t.language ?? "plain";
|
|
14795
14795
|
if (!bl.includes(f)) throw new Error(`codePanel: ${ut("language", f, bl)}`);
|
|
14796
|
-
const p = n.map((R) => Lv(R, f).flatMap((B) => Array.from(B.text, () => e[B.kind]))), g = Ao(), m = yi(g), y = [], k = /* @__PURE__ */ new Map(),
|
|
14796
|
+
const p = n.map((R) => Lv(R, f).flatMap((B) => Array.from(B.text, () => e[B.kind]))), g = Ao(), m = yi(g), y = [], k = /* @__PURE__ */ new Map(), b = [], w = [], M = (R) => {
|
|
14797
14797
|
if (!Number.isInteger(R) || R < 1 || R > n.length) throw new Error(`codePanel: no line ${R} (it has ${n.length})`);
|
|
14798
14798
|
}, E = g.tween, v = g.last, S = (R, B, Y, _, j, nt = 300) => {
|
|
14799
14799
|
M(R), E(`line.${R}.${B}`, Y, _, j, nt);
|
|
@@ -14839,8 +14839,8 @@ function v6(t) {
|
|
|
14839
14839
|
const tt = _(`line.${K}.highlight`);
|
|
14840
14840
|
tt > 0 && (R.globalAlpha *= Math.min(1, tt), R.fillStyle = e.highlight, R.fillRect(j - r / 2, W, X + r, o), R.globalAlpha /= Math.min(1, tt)), a > 0 && z > 0 && (R.fillStyle = e.gutter, R.textAlign = "right", R.fillText(String(K), j - r, N), R.textAlign = "left");
|
|
14841
14841
|
const H = [
|
|
14842
|
-
...
|
|
14843
|
-
...
|
|
14842
|
+
...b.filter((ot) => ot.line === K).map((ot) => ({ column: ot.column, length: ot.text.length, piece: ot, insert: void 0 })),
|
|
14843
|
+
...w.filter((ot) => ot.line === K).map((ot) => ({ column: ot.column, length: 0, piece: void 0, insert: ot }))
|
|
14844
14844
|
].sort((ot, lt) => ot.column - lt.column || ot.length - lt.length);
|
|
14845
14845
|
let G = 0, et = j;
|
|
14846
14846
|
for (const ot of H) {
|
|
@@ -14858,7 +14858,7 @@ function v6(t) {
|
|
|
14858
14858
|
const it = _(`line.${K}.strike`);
|
|
14859
14859
|
it > 0 && (R.strokeStyle = e.strike, R.lineWidth = Math.max(1.5, s / 10), R.beginPath(), R.moveTo(j, N), R.lineTo(j + X * Math.min(1, it), N), R.stroke()), R.restore();
|
|
14860
14860
|
});
|
|
14861
|
-
for (const O of
|
|
14861
|
+
for (const O of b) {
|
|
14862
14862
|
const D = _(`piece.${O.id}.opacity`);
|
|
14863
14863
|
if (D <= 0 || _(`line.${O.line}.wipe`) >= 1) continue;
|
|
14864
14864
|
const K = j + (O.column + O.text.length / 2) * r + _(`piece.${O.id}.x`), L = nt(O.line) + o / 2 + _(`piece.${O.id}.y`);
|
|
@@ -14950,12 +14950,12 @@ function v6(t) {
|
|
|
14950
14950
|
const _ = R;
|
|
14951
14951
|
if (B === void 0) throw new Error('codePanel.piece: which word? piece(n, text) or piece("token:N:TEXT")');
|
|
14952
14952
|
M(_);
|
|
14953
|
-
const j = I(_, B, Y), nt =
|
|
14953
|
+
const j = I(_, B, Y), nt = b.find((O) => O.line === _ && O.column === j && O.text === B);
|
|
14954
14954
|
if (nt) return nt;
|
|
14955
|
-
if (
|
|
14955
|
+
if (b.some((O) => O.line === _ && j < O.column + O.text.length && O.column < j + B.length))
|
|
14956
14956
|
throw new Error(`codePanel: "${B}" on line ${_} overlaps another piece`);
|
|
14957
|
-
const $ = { id:
|
|
14958
|
-
|
|
14957
|
+
const $ = { id: b.length + 1, line: _, column: j, text: B, home: V.token(_, B, Y, 0) };
|
|
14958
|
+
b.push($);
|
|
14959
14959
|
for (const O of ["x", "y", "rotate", "write", "away"]) C[`piece.${$.id}.${O}`] = 0;
|
|
14960
14960
|
return C[`piece.${$.id}.opacity`] = 1, $;
|
|
14961
14961
|
},
|
|
@@ -14973,20 +14973,20 @@ function v6(t) {
|
|
|
14973
14973
|
},
|
|
14974
14974
|
spot(R, B, Y = 1, _ = 1 / 0) {
|
|
14975
14975
|
M(R);
|
|
14976
|
-
const j =
|
|
14976
|
+
const j = w.filter((nt) => nt.line === R && nt.column <= B && nt.at <= _).reduce((nt, $) => nt + $.chars, 0);
|
|
14977
14977
|
return T(u + (B + j) * r, A(R) - x(R, _) * o, Y * r, o);
|
|
14978
14978
|
},
|
|
14979
14979
|
insert(R, B, Y, _) {
|
|
14980
14980
|
M(R);
|
|
14981
|
-
const j = { id:
|
|
14982
|
-
|
|
14981
|
+
const j = { id: w.length + 1, line: R, column: B, chars: Y.length, text: Y, at: _.at };
|
|
14982
|
+
w.push(j), C[`insert.${j.id}.open`] = 0, C[`insert.${j.id}.type`] = 0;
|
|
14983
14983
|
const nt = _.duration ?? Y.length * 70;
|
|
14984
14984
|
return E(`insert.${j.id}.open`, 0, 1, { at: _.at, duration: nt * 0.6, easing: "ease-out" }), E(`insert.${j.id}.type`, 0, 1, { at: _.at, duration: nt }), V;
|
|
14985
14985
|
},
|
|
14986
14986
|
drop(R, B, Y, _) {
|
|
14987
14987
|
M(B);
|
|
14988
|
-
const j = _.duration ?? 250, nt = B === R.line, $ = _.easing ?? (nt ? "linear" : "ease-out"), O = V.landing(R, B, Y, _.at), D = { id:
|
|
14989
|
-
return
|
|
14988
|
+
const j = _.duration ?? 250, nt = B === R.line, $ = _.easing ?? (nt ? "linear" : "ease-out"), O = V.landing(R, B, Y, _.at), D = { id: w.length + 1, line: B, column: Y, chars: R.text.length, at: _.at };
|
|
14989
|
+
return w.push(D), C[`insert.${D.id}.open`] = 0, E(`insert.${D.id}.open`, 0, 1, { at: _.at, duration: j, easing: nt ? $ : "ease-out" }), E(`piece.${R.id}.away`, v(`piece.${R.id}.away`, 0), 1, { at: _.at, duration: j, easing: nt ? $ : "ease-in-out" }), m.cutAfter(R, _.at), V.move(R, { at: _.at, duration: j, easing: $, to: { x: O.x, y: O.y } }), E(`piece.${R.id}.rotate`, g.valueAt(`piece.${R.id}.rotate`, _.at), 0, { at: _.at, duration: j }), V;
|
|
14990
14990
|
},
|
|
14991
14991
|
landing(R, B, Y, _ = 1 / 0) {
|
|
14992
14992
|
const j = V.spot(B, Y, R.text.length, _), nt = B === R.line && Y > R.column ? R.text.length * r : 0;
|
|
@@ -15188,16 +15188,16 @@ const fa = '"Patrick Hand", "Segoe Print", "Bradley Hand", "Comic Sans MS", "Cha
|
|
|
15188
15188
|
function M6(t) {
|
|
15189
15189
|
const e = typeof t.theme == "string" ? t.theme : "whiteboard";
|
|
15190
15190
|
if (!(e in Uo)) throw new Error(`whiteboard: ${ut("theme", e, Object.keys(Uo))}`);
|
|
15191
|
-
const n = typeof t.theme == "object" ? { ...Uo.whiteboard, ...t.theme } : Uo[e], s = t.fontSize ?? 28, o = t.charWidth ?? 0.55, r = (
|
|
15192
|
-
const S = h.get(
|
|
15193
|
-
if (!S || S.kind !== "text") throw kn("whiteboard", v, Ge, `there is no text "${
|
|
15191
|
+
const n = typeof t.theme == "object" ? { ...Uo.whiteboard, ...t.theme } : Uo[e], s = t.fontSize ?? 28, o = t.charWidth ?? 0.55, r = (w) => w === void 0 ? n.ink : n.colors[w] ?? w, i = (w) => Mt(t.x + w.left, t.y + w.top, w.width, w.height), a = Ao(), l = yi(a), c = {}, h = /* @__PURE__ */ new Map(), u = [], d = [], f = (w, M, E, v) => {
|
|
15192
|
+
const S = h.get(w);
|
|
15193
|
+
if (!S || S.kind !== "text") throw kn("whiteboard", v, Ge, `there is no text "${w}" (texts: ${p().join(", ") || "none"})`);
|
|
15194
15194
|
let x = -1;
|
|
15195
15195
|
for (let A = 0; A < E; A++)
|
|
15196
|
-
if (x = S.item.text.indexOf(M, x + 1), x < 0) throw kn("whiteboard", v, Ge, `text "${
|
|
15196
|
+
if (x = S.item.text.indexOf(M, x + 1), x < 0) throw kn("whiteboard", v, Ge, `text "${w}" has no ${E > 1 ? `${E}th ` : ""}"${M}"`);
|
|
15197
15197
|
const T = S.size * o;
|
|
15198
15198
|
return { column: x, box: Mt(S.box.left + x * T, S.box.top, M.length * T, S.box.height) };
|
|
15199
|
-
}, p = () => [...h.values()].filter((
|
|
15200
|
-
const { kind: M, rest: E } = Ts(
|
|
15199
|
+
}, p = () => [...h.values()].filter((w) => w.kind === "text").map((w) => w.item.id), g = (w) => {
|
|
15200
|
+
const { kind: M, rest: E } = Ts(w), v = (S) => kn("whiteboard", w, Ge, S);
|
|
15201
15201
|
if (M === "box") {
|
|
15202
15202
|
if (E) throw v("box takes no arguments");
|
|
15203
15203
|
return { kind: M };
|
|
@@ -15212,33 +15212,33 @@ function M6(t) {
|
|
|
15212
15212
|
return { kind: M, id: S[1], occurrence: S[2] ? Number(S[2]) : 1, text: S[3] };
|
|
15213
15213
|
}
|
|
15214
15214
|
throw v();
|
|
15215
|
-
}, m = (
|
|
15216
|
-
const M = g(
|
|
15215
|
+
}, m = (w) => {
|
|
15216
|
+
const M = g(w);
|
|
15217
15217
|
if (M.kind === "box") return Mt(0, 0, t.width, t.height);
|
|
15218
|
-
if (M.kind === "term") return f(M.id, M.text, M.occurrence,
|
|
15218
|
+
if (M.kind === "term") return f(M.id, M.text, M.occurrence, w).box;
|
|
15219
15219
|
const E = h.get(M.id);
|
|
15220
15220
|
if (!E || E.kind !== M.kind) {
|
|
15221
15221
|
const v = [...h.values()].filter((S) => S.kind === M.kind).map((S) => S.item.id);
|
|
15222
|
-
throw kn("whiteboard",
|
|
15222
|
+
throw kn("whiteboard", w, Ge, `there is no ${M.kind} "${M.id}" (${M.kind}s: ${v.join(", ") || "none"})`);
|
|
15223
15223
|
}
|
|
15224
15224
|
return E.box;
|
|
15225
15225
|
};
|
|
15226
|
-
for (const
|
|
15227
|
-
if (!
|
|
15228
|
-
if (h.has(
|
|
15229
|
-
if ("text" in
|
|
15230
|
-
if (!Array.isArray(
|
|
15231
|
-
const x =
|
|
15232
|
-
h.set(
|
|
15226
|
+
for (const w of t.items ?? []) {
|
|
15227
|
+
if (!w || typeof w.id != "string" || !w.id || /[:#]/.test(w.id)) throw new Error(`whiteboard: every item needs an \`id\` without ":" or "#" (got ${JSON.stringify(w?.id)})`);
|
|
15228
|
+
if (h.has(w.id)) throw new Error(`whiteboard: two items are called "${w.id}"`);
|
|
15229
|
+
if ("text" in w) {
|
|
15230
|
+
if (!Array.isArray(w.at) || w.at.length !== 2 || !w.at.every((A) => typeof A == "number")) throw new Error(`whiteboard: text "${w.id}" needs \`at\`, [x, y] from the board's top-left`);
|
|
15231
|
+
const x = w.size ?? s, T = Mt(w.at[0], w.at[1], Math.max(1, w.text.length) * x * o, x * 1.3);
|
|
15232
|
+
h.set(w.id, { kind: "text", item: w, size: x, color: r(w.color), box: T }), c[`text.${w.id}.write`] = w.hidden ? 0 : 1, c[`text.${w.id}.erase`] = 0;
|
|
15233
15233
|
continue;
|
|
15234
15234
|
}
|
|
15235
|
-
if (!J0.includes(
|
|
15236
|
-
const M =
|
|
15237
|
-
for (const x of M) if (typeof
|
|
15238
|
-
const E = new Set([
|
|
15239
|
-
h.set(
|
|
15235
|
+
if (!J0.includes(w.mark)) throw new Error(`whiteboard: mark "${w.id}": ${ut("mark", w.mark, J0)}`);
|
|
15236
|
+
const M = w.mark === "arrow" ? ["from", "to"] : ["around"];
|
|
15237
|
+
for (const x of M) if (typeof w[x] != "string") throw new Error(`whiteboard: ${w.mark} "${w.id}" needs \`${x}\`, a place on the board (an item before it)`);
|
|
15238
|
+
const E = new Set([w.from, w.to].filter((x) => typeof x == "string").map((x) => x.split(":")[1])), v = w.mark === "arrow" ? [...h.values()].filter((x) => x.kind === "text" && !E.has(x.item.id)).map((x) => x.box) : [], S = Bv(w, m, s, v);
|
|
15239
|
+
h.set(w.id, { kind: "mark", item: w, color: r(w.color), points: S, box: qv(S) }), c[`mark.${w.id}.draw`] = w.hidden ? 0 : 1, c[`mark.${w.id}.erase`] = 0;
|
|
15240
15240
|
}
|
|
15241
|
-
const y = (
|
|
15241
|
+
const y = (w) => u.filter((M) => M.item === w), k = {
|
|
15242
15242
|
type: "custom",
|
|
15243
15243
|
x: t.x,
|
|
15244
15244
|
y: t.y,
|
|
@@ -15253,63 +15253,63 @@ function M6(t) {
|
|
|
15253
15253
|
},
|
|
15254
15254
|
actions: Ge.edits
|
|
15255
15255
|
},
|
|
15256
|
-
draw(
|
|
15256
|
+
draw(w, M) {
|
|
15257
15257
|
const E = M.props ?? {}, v = (S) => Number(E[S] ?? c[S] ?? 0);
|
|
15258
|
-
if (
|
|
15259
|
-
|
|
15258
|
+
if (w.save(), w.fillStyle = n.background, nu(w, 0, 0, t.width, t.height, 10), w.fill(), w.lineWidth = Math.max(4, t.width * 0.012), w.strokeStyle = n.frame, w.stroke(), n.rule) {
|
|
15259
|
+
w.save(), w.beginPath(), nu(w, 0, 0, t.width, t.height, 10), w.clip(), w.lineWidth = 1, w.strokeStyle = n.rule.color;
|
|
15260
15260
|
const S = s * (n.rule.spacing ?? 1.55);
|
|
15261
15261
|
for (let x = S; x < t.height; x += S)
|
|
15262
|
-
|
|
15263
|
-
n.rule.margin && (
|
|
15262
|
+
w.beginPath(), w.moveTo(0, x), w.lineTo(t.width, x), w.stroke();
|
|
15263
|
+
n.rule.margin && (w.strokeStyle = n.rule.margin, w.beginPath(), w.moveTo(s * 2.2, 0), w.lineTo(s * 2.2, t.height), w.stroke()), w.restore();
|
|
15264
15264
|
}
|
|
15265
|
-
|
|
15265
|
+
w.textAlign = "center", w.textBaseline = "middle", w.lineCap = "round", w.lineJoin = "round", w.globalAlpha = n.opacity;
|
|
15266
15266
|
for (const S of h.values()) {
|
|
15267
|
-
if (
|
|
15267
|
+
if (w.save(), ga(w, S.box, v(`${S.kind}.${S.item.id}.erase`)), S.kind === "text") {
|
|
15268
15268
|
const x = y(S.item.id), T = v(`text.${S.item.id}.write`) * S.item.text.length;
|
|
15269
|
-
|
|
15269
|
+
w.font = `${S.size}px ${n.font}`, w.fillStyle = S.color;
|
|
15270
15270
|
for (let A = 0; A < Math.ceil(T); A++)
|
|
15271
|
-
S.item.text[A] === " " || x.some((P) => A >= P.column && A < P.column + P.text.length) || (
|
|
15271
|
+
S.item.text[A] === " " || x.some((P) => A >= P.column && A < P.column + P.text.length) || (w.globalAlpha = n.opacity * Math.min(1, T - A), w.fillText(S.item.text[A], S.box.left + (A + 0.5) * S.size * o, S.box.y));
|
|
15272
15272
|
} else
|
|
15273
|
-
eu(
|
|
15274
|
-
|
|
15273
|
+
eu(w, S.points, v(`mark.${S.item.id}.draw`), S.color, s * n.stroke, S.item.mark === "arrow");
|
|
15274
|
+
w.restore();
|
|
15275
15275
|
}
|
|
15276
15276
|
for (const S of d) {
|
|
15277
15277
|
const x = v(`strike.${S.id}.draw`);
|
|
15278
15278
|
if (x <= 0) continue;
|
|
15279
15279
|
const { box: T } = S, A = T.height * 0.15;
|
|
15280
|
-
eu(
|
|
15280
|
+
eu(w, [{ x: T.left - 3, y: T.y + A }, { x: T.right + 3, y: T.y - A }], x, n.colors.red ?? n.ink, s * n.stroke * 0.8, !1);
|
|
15281
15281
|
}
|
|
15282
15282
|
for (const S of u) {
|
|
15283
15283
|
const x = h.get(S.item), T = x.size * o;
|
|
15284
|
-
|
|
15284
|
+
w.font = `${x.size}px ${n.font}`, w.fillStyle = x.color;
|
|
15285
15285
|
const A = S.written;
|
|
15286
15286
|
if (A) {
|
|
15287
15287
|
const F = v(`piece.${S.id}.write`) * A.length, q = S.home.x - t.x - A.length * T / 2;
|
|
15288
15288
|
for (let U = 0; U < Math.ceil(F); U++)
|
|
15289
|
-
A[U] !== " " && (
|
|
15289
|
+
A[U] !== " " && (w.globalAlpha = n.opacity * Math.min(1, F - U), w.fillText(A[U], q + (U + 0.5) * T, S.home.y - t.y));
|
|
15290
15290
|
}
|
|
15291
15291
|
const P = v(`piece.${S.id}.opacity`) * Math.min(1, v(`text.${S.item}.write`) * x.item.text.length - S.column);
|
|
15292
15292
|
if (P <= 0) continue;
|
|
15293
|
-
|
|
15293
|
+
w.save();
|
|
15294
15294
|
const I = { x: S.home.x - t.x, y: S.home.y - t.y }, C = { x: v(`piece.${S.id}.x`), y: v(`piece.${S.id}.y`) };
|
|
15295
|
-
ga(
|
|
15296
|
-
for (let F = 0; F < S.text.length; F++) S.text[F] !== " " &&
|
|
15297
|
-
|
|
15295
|
+
ga(w, Mt(I.x + C.x - S.home.width / 2, I.y + C.y - S.home.height / 2, S.home.width, S.home.height), v(`piece.${S.id}.erase`)), Math.hypot(C.x, C.y) < 1 && ga(w, x.box, v(`text.${S.item}.erase`)), w.globalAlpha = n.opacity * Math.min(1, P), w.translate(I.x + C.x, I.y + C.y), w.rotate(v(`piece.${S.id}.rotate`) * Math.PI / 180);
|
|
15296
|
+
for (let F = 0; F < S.text.length; F++) S.text[F] !== " " && w.fillText(S.text[F], (F + 0.5 - S.text.length / 2) * T, 0);
|
|
15297
|
+
w.restore();
|
|
15298
15298
|
}
|
|
15299
|
-
|
|
15299
|
+
w.restore();
|
|
15300
15300
|
}
|
|
15301
|
-
},
|
|
15301
|
+
}, b = {
|
|
15302
15302
|
kind: "board",
|
|
15303
15303
|
about: Ge,
|
|
15304
15304
|
target: k,
|
|
15305
15305
|
box: Mt(t.x, t.y, t.width, t.height),
|
|
15306
|
-
anchor(
|
|
15307
|
-
return i(m(
|
|
15306
|
+
anchor(w) {
|
|
15307
|
+
return i(m(w));
|
|
15308
15308
|
},
|
|
15309
|
-
piece(
|
|
15310
|
-
const M = g(
|
|
15311
|
-
if (M.kind !== "term") throw new Error(`whiteboard.piece: a piece is a term, term:ID:TEXT, not "${
|
|
15312
|
-
const { column: E, box: v } = f(M.id, M.text, M.occurrence,
|
|
15309
|
+
piece(w) {
|
|
15310
|
+
const M = g(w);
|
|
15311
|
+
if (M.kind !== "term") throw new Error(`whiteboard.piece: a piece is a term, term:ID:TEXT, not "${w}"`);
|
|
15312
|
+
const { column: E, box: v } = f(M.id, M.text, M.occurrence, w), S = u.find((T) => T.item === M.id && T.column === E && T.text === M.text);
|
|
15313
15313
|
if (S) return S;
|
|
15314
15314
|
if (u.some((T) => T.item === M.id && E < T.column + T.text.length && T.column < E + M.text.length))
|
|
15315
15315
|
throw new Error(`whiteboard: "${M.text}" in "${M.id}" overlaps another piece`);
|
|
@@ -15318,87 +15318,87 @@ function M6(t) {
|
|
|
15318
15318
|
for (const T of ["x", "y", "rotate", "erase", "write"]) c[`piece.${x.id}.${T}`] = 0;
|
|
15319
15319
|
return c[`piece.${x.id}.opacity`] = 1, x;
|
|
15320
15320
|
},
|
|
15321
|
-
edit(
|
|
15321
|
+
edit(w, M, E) {
|
|
15322
15322
|
const v = Array.isArray(M) ? M : [M];
|
|
15323
|
-
if (v.length === 0) throw new Error(`whiteboard.edit: ${
|
|
15323
|
+
if (v.length === 0) throw new Error(`whiteboard.edit: ${w} takes at least one anchor`);
|
|
15324
15324
|
const S = v.map((A) => ({ name: A, anchor: g(A) }));
|
|
15325
15325
|
for (const { name: A } of S) m(A);
|
|
15326
15326
|
const x = (A, P = !1) => {
|
|
15327
15327
|
const I = S.find((C) => !A.includes(C.anchor.kind));
|
|
15328
|
-
if (I) throw new Error(`whiteboard.edit: ${
|
|
15329
|
-
if (P && S.length > 1) throw new Error(`whiteboard.edit: ${
|
|
15330
|
-
}, T = () =>
|
|
15331
|
-
if (
|
|
15328
|
+
if (I) throw new Error(`whiteboard.edit: ${w} takes ${A.join(" or ")} anchors, not "${I.name}"`);
|
|
15329
|
+
if (P && S.length > 1) throw new Error(`whiteboard.edit: ${w} takes one ${A.join(" or ")} anchor`);
|
|
15330
|
+
}, T = () => b.piece(S[0].name);
|
|
15331
|
+
if (w === "write") {
|
|
15332
15332
|
if (S.some((A) => A.anchor.kind === "term")) {
|
|
15333
15333
|
if (x(["term"], !0), typeof E.text != "string") throw new Error("whiteboard.edit: write into a term needs `text` (the new text)");
|
|
15334
15334
|
const A = T();
|
|
15335
|
-
return A.written = E.text, a.tween(`piece.${A.id}.write`, 0, 1, { duration: Math.max(Q0, E.text.length * Z0), ...E }),
|
|
15335
|
+
return A.written = E.text, a.tween(`piece.${A.id}.write`, 0, 1, { duration: Math.max(Q0, E.text.length * Z0), ...E }), b;
|
|
15336
15336
|
}
|
|
15337
15337
|
x(["text"]);
|
|
15338
15338
|
for (const { anchor: A } of S) {
|
|
15339
15339
|
const P = A.id, I = h.get(P).item.text;
|
|
15340
15340
|
a.tween(`text.${P}.write`, 0, 1, { duration: Math.max(Q0, I.length * Z0), ...E });
|
|
15341
15341
|
}
|
|
15342
|
-
return
|
|
15342
|
+
return b;
|
|
15343
15343
|
}
|
|
15344
|
-
if (
|
|
15344
|
+
if (w === "draw") {
|
|
15345
15345
|
x(["mark"]);
|
|
15346
15346
|
for (const { anchor: A } of S) a.tween(`mark.${A.id}.draw`, 0, 1, { duration: 500, ...E });
|
|
15347
|
-
return
|
|
15347
|
+
return b;
|
|
15348
15348
|
}
|
|
15349
|
-
if (
|
|
15349
|
+
if (w === "erase") {
|
|
15350
15350
|
x(["text", "term", "mark"]);
|
|
15351
15351
|
for (const A of S) {
|
|
15352
|
-
const P = A.anchor.kind === "term" ? `piece.${
|
|
15352
|
+
const P = A.anchor.kind === "term" ? `piece.${b.piece(A.name).id}.erase` : `${A.anchor.kind}.${A.anchor.id}.erase`;
|
|
15353
15353
|
a.tween(P, 0, 1, { duration: 400, ...E });
|
|
15354
15354
|
}
|
|
15355
|
-
return
|
|
15355
|
+
return b;
|
|
15356
15356
|
}
|
|
15357
|
-
if (
|
|
15357
|
+
if (w === "strike") {
|
|
15358
15358
|
x(["text", "term"]);
|
|
15359
15359
|
for (const A of S) {
|
|
15360
15360
|
const P = { id: d.length + 1, box: m(A.name) };
|
|
15361
15361
|
d.push(P), c[`strike.${P.id}.draw`] = 0, a.tween(`strike.${P.id}.draw`, 0, 1, { duration: 250, ...E });
|
|
15362
15362
|
}
|
|
15363
|
-
return
|
|
15363
|
+
return b;
|
|
15364
15364
|
}
|
|
15365
|
-
if (
|
|
15365
|
+
if (w === "move") {
|
|
15366
15366
|
x(["term"], !0);
|
|
15367
|
-
const A = typeof E.to == "string" ?
|
|
15367
|
+
const A = typeof E.to == "string" ? b.anchor(E.to) : E.to;
|
|
15368
15368
|
if (!A || typeof A.x != "number" || typeof A.y != "number") throw new Error("whiteboard.edit: move needs `to`, an anchor name or { x, y }");
|
|
15369
|
-
return
|
|
15369
|
+
return b.move(T(), { ...E, to: A });
|
|
15370
15370
|
}
|
|
15371
|
-
if (
|
|
15372
|
-
return x(["term"], !0),
|
|
15373
|
-
throw bi("whiteboard",
|
|
15371
|
+
if (w === "fling")
|
|
15372
|
+
return x(["term"], !0), b.fling(T(), E);
|
|
15373
|
+
throw bi("whiteboard", w, Ge);
|
|
15374
15374
|
},
|
|
15375
|
-
follow(
|
|
15376
|
-
return l.follow(
|
|
15375
|
+
follow(w, M) {
|
|
15376
|
+
return l.follow(w, M), b;
|
|
15377
15377
|
},
|
|
15378
|
-
fling(
|
|
15379
|
-
return l.fling(
|
|
15378
|
+
fling(w, M) {
|
|
15379
|
+
return l.fling(w, M), b;
|
|
15380
15380
|
},
|
|
15381
|
-
move(
|
|
15382
|
-
return l.move(
|
|
15381
|
+
move(w, M) {
|
|
15382
|
+
return l.move(w, M), b;
|
|
15383
15383
|
},
|
|
15384
|
-
ride(
|
|
15385
|
-
return
|
|
15384
|
+
ride(w) {
|
|
15385
|
+
return w;
|
|
15386
15386
|
},
|
|
15387
15387
|
tracks: a.tracks
|
|
15388
15388
|
};
|
|
15389
|
-
return
|
|
15389
|
+
return b;
|
|
15390
15390
|
}
|
|
15391
15391
|
function Bv(t, e, n, s = []) {
|
|
15392
15392
|
const o = He(be(t.id)), r = (g) => (o.next() * 2 - 1) * g, i = n * Nv;
|
|
15393
15393
|
if (t.mark === "arrow") {
|
|
15394
|
-
const g = e(t.from), m = e(t.to), y = tu(g, m, i * 0.6), k = tu(m, g, i * 0.6),
|
|
15395
|
-
let M =
|
|
15396
|
-
if (t.bend !== void 0) M =
|
|
15394
|
+
const g = e(t.from), m = e(t.to), y = tu(g, m, i * 0.6), k = tu(m, g, i * 0.6), b = Math.hypot(k.x - y.x, k.y - y.y), w = zv(y, k);
|
|
15395
|
+
let M = b * (0.06 + r(0.04));
|
|
15396
|
+
if (t.bend !== void 0) M = b * t.bend;
|
|
15397
15397
|
else {
|
|
15398
|
-
const S = Dv(y, k,
|
|
15398
|
+
const S = Dv(y, k, w, s, i);
|
|
15399
15399
|
S !== 0 && (M = S);
|
|
15400
15400
|
}
|
|
15401
|
-
const E = { x: (y.x + k.x) / 2 +
|
|
15401
|
+
const E = { x: (y.x + k.x) / 2 + w.x * M, y: (y.y + k.y) / 2 + w.y * M }, v = [];
|
|
15402
15402
|
for (let S = 0; S <= 24; S++) {
|
|
15403
15403
|
const x = S / 24;
|
|
15404
15404
|
v.push({ x: (1 - x) ** 2 * y.x + 2 * (1 - x) * x * E.x + x * x * k.x, y: (1 - x) ** 2 * y.y + 2 * (1 - x) * x * E.y + x * x * k.y });
|
|
@@ -15415,8 +15415,8 @@ function Bv(t, e, n, s = []) {
|
|
|
15415
15415
|
];
|
|
15416
15416
|
}
|
|
15417
15417
|
if (t.mark === "box") {
|
|
15418
|
-
const g = a.left - i, m = a.right + i, y = a.top - i * 0.6, k = a.bottom + i * 0.6,
|
|
15419
|
-
return [
|
|
15418
|
+
const g = a.left - i, m = a.right + i, y = a.top - i * 0.6, k = a.bottom + i * 0.6, b = (M, E) => ({ x: M + r(i * 0.2), y: E + r(i * 0.2) }), w = b(g, y);
|
|
15419
|
+
return [w, b(m, y), b(m, k), b(g, k), w, { x: w.x + i * 0.8, y: w.y + r(2) }];
|
|
15420
15420
|
}
|
|
15421
15421
|
const l = a.width / 2 + i, c = a.height / 2 + i * 0.6, h = -2.2 + r(0.3), u = o.next() * Math.PI * 2, d = 1.12, f = 64, p = [];
|
|
15422
15422
|
for (let g = 0; g <= f * d; g++) {
|
|
@@ -15569,21 +15569,21 @@ function x6(t) {
|
|
|
15569
15569
|
}
|
|
15570
15570
|
const d = s === "bar" ? "bar" : s === "line" ? "point" : "slice", f = Math.max(...t.data.flatMap((H) => i.map((G) => u(H, G)))), p = o ? t.data.reduce((H, G) => H + u(G, i[0]), 0) : t.max ?? Jv(f * 1.1);
|
|
15571
15571
|
if (!o && !(p > 0)) throw new Error(`chart: \`max\` must be above 0 (got ${p})`);
|
|
15572
|
-
const g = Math.max(10, Math.min(16, t.height / 20)), m = r && t.legend !== !1, y = o ? void 0 : t.axis?.x, k = o ? void 0 : t.axis?.y,
|
|
15572
|
+
const g = Math.max(10, Math.min(16, t.height / 20)), m = r && t.legend !== !1, y = o ? void 0 : t.axis?.x, k = o ? void 0 : t.axis?.y, b = t.title ? g * 2.3 : g * 0.5, w = {
|
|
15573
15573
|
left: g * 3.6 + (k ? g * 1.5 : 0),
|
|
15574
15574
|
right: t.width - g,
|
|
15575
15575
|
top: (t.title ? g * 3 : g * 1.6) + (m ? g * 1.6 : 0),
|
|
15576
15576
|
bottom: t.height - g * 2.4 - (y ? g * 1.4 : 0)
|
|
15577
|
-
}, M =
|
|
15577
|
+
}, M = w.bottom - w.top, E = (w.right - w.left) / t.data.length, v = r ? E * 0.72 / i.length : E * 0.6, S = r ? v * 0.86 : v, x = Math.max(4, g * 0.35), T = M / p, A = new Map(t.data.map((H, G) => [H.id, G])), P = (H) => w.left + E * (A.get(H) + 0.5), I = (H, G) => r ? P(H) - E * 0.36 + v * l.get(G) + (v - S) / 2 : P(H) - S / 2, C = (H, G) => I(H, G) + S / 2, F = t.height - g * 1.2, q = {
|
|
15578
15578
|
cx: t.width / 2,
|
|
15579
|
-
cy: (
|
|
15580
|
-
r: Math.max(10, Math.min(t.width / 2, (F -
|
|
15579
|
+
cy: (w.top + F) / 2,
|
|
15580
|
+
r: Math.max(10, Math.min(t.width / 2, (F - w.top) / 2) - g * 2.6)
|
|
15581
15581
|
}, U = s === "donut" ? q.r * 0.55 : 0, Q = s === "donut" ? (U + q.r) / 2 : q.r * 0.62, V = /* @__PURE__ */ new Map();
|
|
15582
15582
|
if (m) {
|
|
15583
|
-
let H =
|
|
15583
|
+
let H = w.right;
|
|
15584
15584
|
for (const G of [...i].reverse()) {
|
|
15585
15585
|
const et = G.label ?? G.id, it = g * 0.62 * et.length + g * 1.9;
|
|
15586
|
-
V.set(G.id, Mt(H - it,
|
|
15586
|
+
V.set(G.id, Mt(H - it, b, it, g * 1.4)), H -= it + g * 0.6;
|
|
15587
15587
|
}
|
|
15588
15588
|
}
|
|
15589
15589
|
const R = Ao(), B = yi(R), Y = {}, _ = (H, G, et) => r ? `${d}.${H}.${G}.${et}` : `${d}.${H}.${et}`;
|
|
@@ -15632,10 +15632,10 @@ function x6(t) {
|
|
|
15632
15632
|
const rt = L(st);
|
|
15633
15633
|
return H.kind === "label" ? rt : st.sweep >= 0.3 ? Mt(st.centre.x - g * 1.6, st.centre.y - g * 0.65, g * 3.2, g * 1.3) : Mt(rt.left, rt.bottom, rt.width, g * 1.3);
|
|
15634
15634
|
}
|
|
15635
|
-
const et = H.kind === "label" ? P(H.id) : C(H.id, H.series), it =
|
|
15636
|
-
if (H.kind === "bar") return Mt(et - S / 2, it, S,
|
|
15635
|
+
const et = H.kind === "label" ? P(H.id) : C(H.id, H.series), it = w.bottom - nt(H.id, H.series, G);
|
|
15636
|
+
if (H.kind === "bar") return Mt(et - S / 2, it, S, w.bottom - it);
|
|
15637
15637
|
if (H.kind === "point") return Mt(P(H.id) - x, it - x, x * 2, x * 2);
|
|
15638
|
-
if (H.kind === "label") return Mt(et - E / 2,
|
|
15638
|
+
if (H.kind === "label") return Mt(et - E / 2, w.bottom + g * 0.4, E, g * 1.4);
|
|
15639
15639
|
const ot = it - (s === "line" ? x : 0) - g * 0.3, lt = r && s === "bar" ? v : E;
|
|
15640
15640
|
return Mt((s === "line" ? P(H.id) : et) - lt / 2, ot - g * 1.3, lt, g * 1.3);
|
|
15641
15641
|
}, L = (H) => {
|
|
@@ -15656,7 +15656,7 @@ function x6(t) {
|
|
|
15656
15656
|
},
|
|
15657
15657
|
draw(H, G) {
|
|
15658
15658
|
const et = G.props ?? {}, it = (st) => Number(et[st] ?? Y[st] ?? 0);
|
|
15659
|
-
if (H.save(), H.fillStyle = n.background, ru(H, 0, 0, t.width, t.height, 8), H.fill(), H.font = `${g}px ${n.font}`, H.textBaseline = "middle", t.title && (H.fillStyle = n.text, H.textAlign = "left", H.font = `600 ${g * 1.2}px ${n.font}`, H.fillText(t.title, o ? g :
|
|
15659
|
+
if (H.save(), H.fillStyle = n.background, ru(H, 0, 0, t.width, t.height, 8), H.fill(), H.font = `${g}px ${n.font}`, H.textBaseline = "middle", t.title && (H.fillStyle = n.text, H.textAlign = "left", H.font = `600 ${g * 1.2}px ${n.font}`, H.fillText(t.title, o ? g : w.left, g * 1.5), H.font = `${g}px ${n.font}`), m) {
|
|
15660
15660
|
H.textAlign = "left";
|
|
15661
15661
|
for (const st of i) {
|
|
15662
15662
|
const Z = V.get(st.id);
|
|
@@ -15669,23 +15669,23 @@ function x6(t) {
|
|
|
15669
15669
|
}
|
|
15670
15670
|
H.lineWidth = 1, H.textAlign = "right";
|
|
15671
15671
|
for (let st = 0; st <= 4; st++) {
|
|
15672
|
-
const Z =
|
|
15673
|
-
H.strokeStyle = n.grid, H.beginPath(), H.moveTo(
|
|
15672
|
+
const Z = w.bottom - M * st / 4;
|
|
15673
|
+
H.strokeStyle = n.grid, H.beginPath(), H.moveTo(w.left, Z), H.lineTo(w.right, Z), H.stroke(), H.fillStyle = n.text, H.globalAlpha = 0.7, H.fillText(Zv(p * st / 4), w.left - g * 0.5, Z), H.globalAlpha = 1;
|
|
15674
15674
|
}
|
|
15675
|
-
(k || y) && (H.fillStyle = n.text, H.textAlign = "center", H.globalAlpha = 0.85, k && (H.save(), H.translate(g * 0.9, (
|
|
15675
|
+
(k || y) && (H.fillStyle = n.text, H.textAlign = "center", H.globalAlpha = 0.85, k && (H.save(), H.translate(g * 0.9, (w.top + w.bottom) / 2), H.rotate(-Math.PI / 2), H.fillText(k, 0, 0), H.restore()), y && H.fillText(y, (w.left + w.right) / 2, w.bottom + g * 2.3), H.globalAlpha = 1);
|
|
15676
15676
|
const ot = (st, Z) => it(_(st, Z, "value")) * (s === "bar" ? it(_(st, Z, "show")) : 1) * T, lt = (st, Z) => pa(c(Z), n.highlight, it(_(st, Z, "highlight")));
|
|
15677
15677
|
if (s === "line") {
|
|
15678
15678
|
H.lineWidth = Math.max(2, g * 0.2), H.lineJoin = "round", H.lineCap = "round";
|
|
15679
15679
|
for (const st of i)
|
|
15680
15680
|
H.strokeStyle = c(st.id), H.beginPath(), t.data.forEach((Z, rt) => {
|
|
15681
|
-
const ct = { x: P(Z.id), y:
|
|
15681
|
+
const ct = { x: P(Z.id), y: w.bottom - ot(Z.id, st.id) }, dt = it(_(Z.id, st.id, "show"));
|
|
15682
15682
|
if (rt === 0) {
|
|
15683
15683
|
dt > 0 && H.moveTo(ct.x, ct.y);
|
|
15684
15684
|
return;
|
|
15685
15685
|
}
|
|
15686
15686
|
const yt = t.data[rt - 1];
|
|
15687
15687
|
if (it(_(yt.id, st.id, "show")) < 1 || dt <= 0) return;
|
|
15688
|
-
const bt = { x: P(yt.id), y:
|
|
15688
|
+
const bt = { x: P(yt.id), y: w.bottom - ot(yt.id, st.id) };
|
|
15689
15689
|
H.lineTo(bt.x + (ct.x - bt.x) * dt, bt.y + (ct.y - bt.y) * dt);
|
|
15690
15690
|
}), H.stroke();
|
|
15691
15691
|
}
|
|
@@ -15693,15 +15693,15 @@ function x6(t) {
|
|
|
15693
15693
|
for (const st of t.data) {
|
|
15694
15694
|
for (const Z of i) {
|
|
15695
15695
|
const rt = s === "bar" ? C(st.id, Z.id) : P(st.id), ct = ot(st.id, Z.id), dt = it(_(st.id, Z.id, "show"));
|
|
15696
|
-
if (H.fillStyle = lt(st.id, Z.id), s === "bar" ? ct > 0.5 && (Qv(H, rt - S / 2,
|
|
15696
|
+
if (H.fillStyle = lt(st.id, Z.id), s === "bar" ? ct > 0.5 && (Qv(H, rt - S / 2, w.bottom - ct, S, ct, Math.min(6, S / 4)), H.fill()) : dt > 0 && (H.beginPath(), H.arc(rt, w.bottom - ct, x * Math.min(1, dt * 1.5) * (1 + 0.3 * it(_(st.id, Z.id, "highlight"))), 0, Math.PI * 2), H.fill()), t.values !== !1 && dt > 0) {
|
|
15697
15697
|
H.globalAlpha = Math.min(1, dt * 2), H.font = `600 ${r ? g * 0.85 : g}px ${n.font}`, H.fillStyle = pa(n.text, n.highlight, it(_(st.id, Z.id, "highlight")));
|
|
15698
|
-
const yt =
|
|
15698
|
+
const yt = w.bottom - ct - (s === "line" ? x : 0) - g * 0.95;
|
|
15699
15699
|
H.fillText(N(it(_(st.id, Z.id, "value"))), rt, yt), H.font = `${g}px ${n.font}`, H.globalAlpha = 1;
|
|
15700
15700
|
}
|
|
15701
15701
|
}
|
|
15702
|
-
H.fillStyle = n.text, H.fillText(st.label ?? st.id, P(st.id),
|
|
15702
|
+
H.fillStyle = n.text, H.fillText(st.label ?? st.id, P(st.id), w.bottom + g * 1.1);
|
|
15703
15703
|
}
|
|
15704
|
-
H.strokeStyle = n.text, H.lineWidth = 1.5, H.beginPath(), H.moveTo(
|
|
15704
|
+
H.strokeStyle = n.text, H.lineWidth = 1.5, H.beginPath(), H.moveTo(w.left, w.bottom), H.lineTo(w.right, w.bottom), H.stroke(), H.restore();
|
|
15705
15705
|
}
|
|
15706
15706
|
};
|
|
15707
15707
|
function J(H, G) {
|
|
@@ -15774,7 +15774,7 @@ function x6(t) {
|
|
|
15774
15774
|
const it = t.data.flatMap(
|
|
15775
15775
|
(ot) => i.map((lt) => {
|
|
15776
15776
|
const st = nt(ot.id, lt.id, 0), Z = [...go(R.keys(_(ot.id, lt.id, "value"))), ...go(R.keys(_(ot.id, lt.id, "show")))];
|
|
15777
|
-
return { top: t.y +
|
|
15777
|
+
return { top: t.y + w.bottom - st, offset: (rt) => st - nt(ot.id, lt.id, rt), windows: Z };
|
|
15778
15778
|
})
|
|
15779
15779
|
);
|
|
15780
15780
|
return Mc(H, G, { ground: et.ground, every: et.every ?? wn, floors: it });
|
|
@@ -16295,19 +16295,19 @@ function A6(t, e, n, s = {}) {
|
|
|
16295
16295
|
if (!o) throw new Error(`meetHands: unknown meeting '${t}' (one of ${Object.keys(Yr).join(", ")})`);
|
|
16296
16296
|
const [r, i] = e.x <= n.x ? [e, n] : [n, e], a = s.view === "side", l = Math.min(r.character.height, i.character.height), c = { x: (r.x + i.x) / 2, y: -(s.height ?? o.height) * l }, h = (m, y) => {
|
|
16297
16297
|
const k = y ? a ? 1 : 0.62 : a ? 3 : 3.38;
|
|
16298
|
-
let
|
|
16299
|
-
const
|
|
16300
|
-
|
|
16298
|
+
let b = { ...at, ...m.pose, turn: k, lean: (m.pose?.lean ?? 0) + o.lean };
|
|
16299
|
+
const w = y ? 1 : -1, M = (E, v, S) => {
|
|
16300
|
+
b = nn(m.character, b, E, { x: c.x + v - m.x, y: c.y, depth: S });
|
|
16301
16301
|
};
|
|
16302
16302
|
if (t === "handOver") {
|
|
16303
16303
|
const E = au * l;
|
|
16304
|
-
M("arm.left", -
|
|
16304
|
+
M("arm.left", -w * E * 0.9, E), M("arm.right", -w * E * 0.9, -E);
|
|
16305
16305
|
} else
|
|
16306
16306
|
M("arm.right", 0, 0);
|
|
16307
|
-
return t === "fistBump" && (
|
|
16307
|
+
return t === "fistBump" && (b = { ...b, "hand.right.index.curl": 1, "hand.right.middle.curl": 1, "hand.right.ring.curl": 1, "hand.right.pinky.curl": 1 }), b;
|
|
16308
16308
|
}, u = h(r, !0), d = h(i, !1), f = 0.03 * l, p = (m, y) => {
|
|
16309
|
-
const k = Se(m.character, y),
|
|
16310
|
-
return
|
|
16309
|
+
const k = Se(m.character, y), b = t === "handOver" ? ["hand.left", "hand.right"] : ["hand.right"], w = t === "handOver" ? au * l + f : f;
|
|
16310
|
+
return b.every((M) => Math.abs(k.points[M].y - c.y) < f && Math.abs(k.points[M].x + m.x - c.x) < w);
|
|
16311
16311
|
}, g = p(r, u) && p(i, d);
|
|
16312
16312
|
return e.x <= n.x ? { a: u, b: d, point: c, reached: g } : { a: d, b: u, point: c, reached: g };
|
|
16313
16313
|
}
|
|
@@ -16321,12 +16321,12 @@ function P6(t, e, n = {}) {
|
|
|
16321
16321
|
round: { x: g.x - m * 0.04 * i - p.x, y: -0.5 * i, depth: 0.06 * i }
|
|
16322
16322
|
}), l = (p, g, m) => {
|
|
16323
16323
|
const y = m ? r ? 1 : 0.62 : r ? 3 : 3.38, k = m ? 1 : -1;
|
|
16324
|
-
let
|
|
16325
|
-
const { over:
|
|
16326
|
-
return
|
|
16324
|
+
let b = { ...at, ...p.pose, turn: y, lean: (p.pose?.lean ?? 0) + wl.lean, "head.tilt": (p.pose?.["head.tilt"] ?? 0) + k * wl.tilt };
|
|
16325
|
+
const { over: w, round: M } = a(p, g, k);
|
|
16326
|
+
return b = nn(p.character, b, "arm.right", w), b = nn(p.character, b, "arm.left", M), b;
|
|
16327
16327
|
}, c = l(s, o, !0), h = l(o, s, !1), u = 0.05 * i, d = (p, g, m, y) => {
|
|
16328
|
-
const k = Se(p.character, y).points, { over:
|
|
16329
|
-
return Math.hypot(k["hand.right"].x -
|
|
16328
|
+
const k = Se(p.character, y).points, { over: b, round: w } = a(p, g, m);
|
|
16329
|
+
return Math.hypot(k["hand.right"].x - b.x, k["hand.right"].y - b.y) < u && Math.hypot(k["hand.left"].x - w.x, k["hand.left"].y - w.y) < u;
|
|
16330
16330
|
}, f = d(s, o, 1, c) && d(o, s, -1, h);
|
|
16331
16331
|
return t.x <= e.x ? { a: c, b: h, reached: f } : { a: h, b: c, reached: f };
|
|
16332
16332
|
}
|
|
@@ -16366,7 +16366,7 @@ function gM(t, e) {
|
|
|
16366
16366
|
return p.turn * 90 + (p.headTurn ?? 0);
|
|
16367
16367
|
}, c = { start: n, end: e.end, step: e.step, stiffness: e.stiffness ?? 70, damping: e.damping ?? 6 }, h = rr(l, c), u = rr((f) => a(f).x, c), d = rr((f) => a(f).y, c);
|
|
16368
16368
|
return h.map((f, p) => {
|
|
16369
|
-
const g = a(f.time), m = f.value - l(f.time), y = u[p].value - g.x - (e.wind ?? 0) * rM * o, k = d[p].value - g.y,
|
|
16369
|
+
const g = a(f.time), m = f.value - l(f.time), y = u[p].value - g.x - (e.wind ?? 0) * rM * o, k = d[p].value - g.y, b = Math.sin(g.turn * Math.PI / 2), w = Math.cos(g.turn * Math.PI / 2), M = m * cM + y * w / o * hM, E = -y * b / o * uM, v = -k / o * dM;
|
|
16370
16370
|
return {
|
|
16371
16371
|
time: f.time,
|
|
16372
16372
|
swing: ma(M * s, iM),
|
|
@@ -16395,28 +16395,28 @@ const cu = (t) => ({ "hair.swing": t.swing, "hair.trail": t.trail, "hair.lift":
|
|
|
16395
16395
|
function _6(t, e, n, s = {}) {
|
|
16396
16396
|
const o = n.head.hair;
|
|
16397
16397
|
if (!o || !gk(o)) return [];
|
|
16398
|
-
const r = e.filter((k) => k.target === t), i = r.reduce((k,
|
|
16399
|
-
const M = c.getStateAtTime(k).values.get(t)?.get(
|
|
16400
|
-
return typeof M == "number" ? M :
|
|
16398
|
+
const r = e.filter((k) => k.target === t), i = r.reduce((k, b) => b.keyframes.reduce((w, M) => Math.max(w, M.time), k), 0), a = at, l = /* @__PURE__ */ new Set(["x", "y", "turn", "head.turn"]), c = new Wt({ id: `${t}-hair-follow`, tracks: r.filter((k) => l.has(k.property)) }), h = (k, b, w) => {
|
|
16399
|
+
const M = c.getStateAtTime(k).values.get(t)?.get(b);
|
|
16400
|
+
return typeof M == "number" ? M : w;
|
|
16401
16401
|
}, u = new Wt({ id: `${t}-hair-pose`, tracks: r }), d = (k) => u.getStateAtTime(k).values.get(t), f = /* @__PURE__ */ new Map(), p = (k) => {
|
|
16402
|
-
const
|
|
16403
|
-
let
|
|
16404
|
-
if (!
|
|
16402
|
+
const b = Math.round(k / Xn);
|
|
16403
|
+
let w = f.get(b);
|
|
16404
|
+
if (!w) {
|
|
16405
16405
|
const M = {};
|
|
16406
|
-
for (const [v, S] of d(
|
|
16406
|
+
for (const [v, S] of d(b * Xn) ?? []) M[v] = S;
|
|
16407
16407
|
const E = Se(n, dc(M, a, s.gaits)).head.center;
|
|
16408
|
-
f.set(
|
|
16408
|
+
f.set(b, w = { x: E.x, y: E.y });
|
|
16409
16409
|
}
|
|
16410
|
-
return
|
|
16410
|
+
return w;
|
|
16411
16411
|
}, g = (k) => {
|
|
16412
|
-
const
|
|
16413
|
-
return { x: M.x + (E.x - M.x) *
|
|
16412
|
+
const b = Math.floor(k / Xn), w = k / Xn - b, M = p(b * Xn), E = p((b + 1) * Xn);
|
|
16413
|
+
return { x: M.x + (E.x - M.x) * w, y: M.y + (E.y - M.y) * w };
|
|
16414
16414
|
}, m = gM(
|
|
16415
16415
|
(k) => {
|
|
16416
|
-
const
|
|
16416
|
+
const b = g(k);
|
|
16417
16417
|
return {
|
|
16418
|
-
x: h(k, "x", 0) +
|
|
16419
|
-
y: h(k, "y", 0) +
|
|
16418
|
+
x: h(k, "x", 0) + b.x,
|
|
16419
|
+
y: h(k, "y", 0) + b.y,
|
|
16420
16420
|
turn: h(k, "turn", a.turn ?? 0),
|
|
16421
16421
|
headTurn: h(k, "head.turn", a["head.turn"] ?? 0)
|
|
16422
16422
|
};
|
|
@@ -16433,15 +16433,15 @@ function _6(t, e, n, s = {}) {
|
|
|
16433
16433
|
}
|
|
16434
16434
|
), y = [];
|
|
16435
16435
|
for (const k of fM) {
|
|
16436
|
-
const
|
|
16437
|
-
let
|
|
16438
|
-
if (
|
|
16436
|
+
const b = k.slice(5);
|
|
16437
|
+
let w = m.map((E) => ({ time: E.time, value: E[b] }));
|
|
16438
|
+
if (w.every((E) => Math.abs(E.value) < 1e-3)) continue;
|
|
16439
16439
|
const M = r.find((E) => E.property === k);
|
|
16440
16440
|
if (M) {
|
|
16441
16441
|
const E = new Wt({ id: `${t}-${k}-own`, tracks: [M] }), v = (S) => Number(E.getStateAtTime(S).values.get(t)?.get(k) ?? 0);
|
|
16442
|
-
|
|
16442
|
+
w = w.map((S) => ({ time: S.time, value: S.value + v(S.time) }));
|
|
16443
16443
|
}
|
|
16444
|
-
y.push({ id: `${t}-${k}`, target: t, property: k, keyframes:
|
|
16444
|
+
y.push({ id: `${t}-${k}`, target: t, property: k, keyframes: w });
|
|
16445
16445
|
}
|
|
16446
16446
|
return y;
|
|
16447
16447
|
}
|
|
@@ -16545,23 +16545,23 @@ function wM(t, e, n, s, o) {
|
|
|
16545
16545
|
};
|
|
16546
16546
|
let d = e[0].pose[t];
|
|
16547
16547
|
for (let f = 1; f < e.length; f++) {
|
|
16548
|
-
const p = e[f], g = e[f - 1].pose[t], m = p.pose[t], y = m - g, k = h[h.length - 1].time,
|
|
16548
|
+
const p = e[f], g = e[f - 1].pose[t], m = p.pose[t], y = m - g, k = h[h.length - 1].time, b = p.act !== !1;
|
|
16549
16549
|
if (Math.abs(y) <= vn) {
|
|
16550
|
-
const A = p.time + (
|
|
16550
|
+
const A = p.time + (b ? c(f) : 0);
|
|
16551
16551
|
if (f === e.length - 1)
|
|
16552
16552
|
Math.abs(d - m) > vn && u(Math.max(A, k + kl), m, "ease-in-out"), d = m;
|
|
16553
|
-
else if (
|
|
16553
|
+
else if (b && a && s.drift > 0 && n.drift.includes(t) && A - k >= yM) {
|
|
16554
16554
|
const P = be(`${o}:${t}:${f}`) % 2 === 0 ? 1 : -1;
|
|
16555
16555
|
d = m + P * s.drift * i, u(A, d, "ease-in-out");
|
|
16556
16556
|
}
|
|
16557
16557
|
continue;
|
|
16558
16558
|
}
|
|
16559
|
-
if (!
|
|
16559
|
+
if (!b) {
|
|
16560
16560
|
u(e[f - 1].time, d), u(p.time, m, p.easing), d = m;
|
|
16561
16561
|
continue;
|
|
16562
16562
|
}
|
|
16563
|
-
const
|
|
16564
|
-
let E = p.time +
|
|
16563
|
+
const w = c(f), M = Math.max(e[f - 1].time + w, k);
|
|
16564
|
+
let E = p.time + w;
|
|
16565
16565
|
r && s.eyeDart > 0 && (E = Math.min(E, M + s.eyeDart));
|
|
16566
16566
|
const v = E - M;
|
|
16567
16567
|
if (v <= ps) {
|
|
@@ -17036,7 +17036,7 @@ function Tc(t, e, n = {}) {
|
|
|
17036
17036
|
return j && "steps" in j ? j : void 0;
|
|
17037
17037
|
}, c = n.from ?? 0, h = n.ground ?? 0, u = n.height ?? 300;
|
|
17038
17038
|
let d = c, f = h, p = n.facing ?? 1, g = n.start ?? ht, m = 0, y = 0;
|
|
17039
|
-
const k = [{ time: 0, pose: g }],
|
|
17039
|
+
const k = [{ time: 0, pose: g }], b = [{ time: 0, value: 0 }], w = [{ time: 0, value: 0 }], M = [{ time: 0, value: 0 }], E = [{ time: 0, value: 0 }], v = [{ time: 0, value: "walk" }], S = [{ time: 0, value: p }], x = [], T = [], A = [], P = (_, j, nt, $) => {
|
|
17040
17040
|
g = { ...g, ...j }, nt && (g = mn(g, nt)), k.push({ time: _, pose: g, ...$ === !1 ? { act: $ } : {} });
|
|
17041
17041
|
}, I = (_, j, nt) => (P(_ + Gn / 2, { turn: 0 }, nt), S.push({ time: _ + Gn / 2, value: p }, { time: _ + Gn / 2 + 1, value: j }), p = j, P(_ + Gn, { turn: 1 }), _ + Gn), C = (_) => _ < d ? -1 : 1, F = (_, j, nt) => C(j) !== p ? I(_, C(j), nt) : _, q = (_, j, nt, $ = "arm") => {
|
|
17042
17042
|
const O = $ === "arm", D = Ee({ ..._, ...O ? { rightShoulder: 0, rightElbow: 0 } : { rightHip: 0, rightKnee: 0 } }, { height: u, facing: p }), K = O ? D.shoulders.right : D.hip, L = O ? D.elbows.right : D.knees.right, W = (z, J) => Math.atan2(p * z, J) * 180 / Math.PI, X = ((W(j - (d + K.x), nt - (f + K.y)) - W(L.x - K.x, L.y - K.y)) % 360 + 360) % 360;
|
|
@@ -17056,7 +17056,7 @@ function Tc(t, e, n = {}) {
|
|
|
17056
17056
|
rt < G && (G = rt, H = ot);
|
|
17057
17057
|
}
|
|
17058
17058
|
return H;
|
|
17059
|
-
}, R = (_, j, nt) => Math.abs(j - d) < 2 ? _ : (
|
|
17059
|
+
}, R = (_, j, nt) => Math.abs(j - d) < 2 ? _ : (b.push({ time: _, value: d - c }, { time: _ + nt, value: j - c, easing: "ease-in-out" }), d = j, _ + nt);
|
|
17060
17060
|
for (const _ of r) {
|
|
17061
17061
|
const j = Math.max(_.at ?? y, y === 0 ? 0 : k[k.length - 1].time);
|
|
17062
17062
|
let nt = j, $, O;
|
|
@@ -17066,7 +17066,7 @@ function Tc(t, e, n = {}) {
|
|
|
17066
17066
|
let N = j;
|
|
17067
17067
|
W !== p ? N = I(j, W, _.mood) : g.turn < 1 ? (N = j + Le, P(N, { turn: 1, ...D }, _.mood)) : (_.mood || _.pose) && P(j + Le, D, _.mood);
|
|
17068
17068
|
const z = Math.abs(L - d) / Qa(i(_.do), u), J = _.for ?? Math.max(Le * 2, z * a(_.do)), tt = N + J;
|
|
17069
|
-
v.push({ time: N, value: _.do }), E.push({ time: N, value: 0 }, { time: N + Le, value: 1, easing: "ease-out" }), E.push({ time: tt - Le, value: 1 }, { time: tt, value: 0, easing: "ease-in" }), M.push({ time: N, value: m }, { time: tt, value: m + z }),
|
|
17069
|
+
v.push({ time: N, value: _.do }), E.push({ time: N, value: 0 }, { time: N + Le, value: 1, easing: "ease-out" }), E.push({ time: tt - Le, value: 1 }, { time: tt, value: 0, easing: "ease-in" }), M.push({ time: N, value: m }, { time: tt, value: m + z }), b.push({ time: N, value: d - c }, { time: tt, value: L - c }), m += z, d = L, P(tt, {}), nt = tt;
|
|
17070
17070
|
} else if (_.do === "zip") {
|
|
17071
17071
|
const L = _.to ?? d, W = L === d ? p : C(L);
|
|
17072
17072
|
let N = j;
|
|
@@ -17074,7 +17074,7 @@ function Tc(t, e, n = {}) {
|
|
|
17074
17074
|
const X = uu("windUp", { at: N, from: _.mood ? mn(g, _.mood) : g });
|
|
17075
17075
|
k.push(...X), g = X[X.length - 1].pose;
|
|
17076
17076
|
const z = N + Kr("windUp"), J = z + RM, tt = J + Math.max(WM, Math.abs(L - d) / FM);
|
|
17077
|
-
v.push({ time: z, value: "run" }), E.push({ time: z, value: 0 }, { time: z + 80, value: 1, easing: "ease-out" }, { time: tt, value: 1 }, { time: tt + 120, value: 0 }), M.push({ time: z, value: m }, { time: J, value: m + pu, easing: "ease-in" }), m += pu + (tt - J) / gu.run * 1.5, M.push({ time: tt, value: m }),
|
|
17077
|
+
v.push({ time: z, value: "run" }), E.push({ time: z, value: 0 }, { time: z + 80, value: 1, easing: "ease-out" }, { time: tt, value: 1 }, { time: tt + 120, value: 0 }), M.push({ time: z, value: m }, { time: J, value: m + pu, easing: "ease-in" }), m += pu + (tt - J) / gu.run * 1.5, M.push({ time: tt, value: m }), b.push({ time: J, value: d - c }, { time: tt, value: L - c, easing: "ease-in" }), A.push({ kind: "dust", time: J, x: d, y: f, length: 900 }), d = L, P(tt, {}), nt = tt;
|
|
17078
17078
|
} else if (_.do === "leap") {
|
|
17079
17079
|
const L = _.to ?? d, W = _.onto ?? f;
|
|
17080
17080
|
let N = L === d ? j : F(j, L, _.mood);
|
|
@@ -17084,7 +17084,7 @@ function Tc(t, e, n = {}) {
|
|
|
17084
17084
|
const z = N + NM;
|
|
17085
17085
|
P(z - 40, { stretch: 0.72 }, void 0, !1), P(z, { stretch: 1.2, bend: -6, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4 }, void 0, !1);
|
|
17086
17086
|
const J = Math.hypot(L - d, W - f), tt = _.for ?? Math.min(mu[1], Math.max(mu[0], 300 + J * BM)), H = Math.min(f, W) - DM * u, G = Math.sqrt(f - H), et = Math.sqrt(W - H), it = z + tt * G / (G + et), ot = z + tt;
|
|
17087
|
-
P(it, { stretch: 1, bend: 4, leftHip: -55, leftKnee: -80, rightHip: 55, rightKnee: 80, leftShoulder: 110, rightShoulder: 110 }, void 0, !1), P(ot, { stretch: 0.72, bend: 12, leftShoulder: 75, rightShoulder: 75, leftElbow: 0, rightElbow: 0, leftHip: 18, rightHip: 18, leftKnee: 0, rightKnee: 0 }, void 0, !1), P(ot + 180, { stretch: 1.05, bend: -3 }, void 0, !1), P(ot + 340, { stretch: 1, bend: 0, leftHip: ht.leftHip, rightHip: ht.rightHip, leftShoulder: ht.leftShoulder, rightShoulder: ht.rightShoulder, leftElbow: ht.leftElbow, rightElbow: ht.rightElbow }, void 0, !1),
|
|
17087
|
+
P(it, { stretch: 1, bend: 4, leftHip: -55, leftKnee: -80, rightHip: 55, rightKnee: 80, leftShoulder: 110, rightShoulder: 110 }, void 0, !1), P(ot, { stretch: 0.72, bend: 12, leftShoulder: 75, rightShoulder: 75, leftElbow: 0, rightElbow: 0, leftHip: 18, rightHip: 18, leftKnee: 0, rightKnee: 0 }, void 0, !1), P(ot + 180, { stretch: 1.05, bend: -3 }, void 0, !1), P(ot + 340, { stretch: 1, bend: 0, leftHip: ht.leftHip, rightHip: ht.rightHip, leftShoulder: ht.leftShoulder, rightShoulder: ht.rightShoulder, leftElbow: ht.leftElbow, rightElbow: ht.rightElbow }, void 0, !1), b.push({ time: z, value: d - c }, { time: ot, value: L - c }), w.push(
|
|
17088
17088
|
{ time: z, value: f - h },
|
|
17089
17089
|
{ time: it, value: H - h, easing: "ease-out-quad" },
|
|
17090
17090
|
{ time: ot, value: W - h, easing: "ease-in-quad" }
|
|
@@ -17100,7 +17100,7 @@ function Tc(t, e, n = {}) {
|
|
|
17100
17100
|
const G = N + Qo + ba + 80;
|
|
17101
17101
|
P(G, { ...tt, rightShoulder: q(tt, X, L.y) }, void 0, !1);
|
|
17102
17102
|
const et = G + (_.for ?? Math.max(zM, Math.abs(z - X) / qM));
|
|
17103
|
-
|
|
17103
|
+
b.push({ time: G, value: d - c }), d = U(H, z, L.y, "arm"), b.push({ time: et, value: d - c }), P(et, { ...H, rightShoulder: q(H, z, L.y) }, void 0, !1), P(et + wa, { lean: 16, bend: 14, rightShoulder: q(g, z + W * u * 0.4, L.y + u * 0.25) }, void 0, !1), P(et + wa + yu, { lean: 0, bend: 0, rightShoulder: ht.rightShoulder, rightElbow: ht.rightElbow }), nt = et + wa + yu, $ = G, O = et;
|
|
17104
17104
|
} else if (_.do === "grab" && _.target) {
|
|
17105
17105
|
const L = _.target, W = F(j, L.x, _.mood), N = L.y > f - u * 0.5, X = {
|
|
17106
17106
|
...g,
|
|
@@ -17144,10 +17144,10 @@ function Tc(t, e, n = {}) {
|
|
|
17144
17144
|
}, H = p === 1 ? W : N, G = R(X, J((W + N) / 2), Ls), et = !tt(W) || !tt(N), it = et ? R(G, J(W), Ls) + Su : G + Su;
|
|
17145
17145
|
P(it, { ...z, ...V(z, et ? W : H, L.y) }, _.mood, !1);
|
|
17146
17146
|
const ot = _.for ?? Math.max(VM, Math.abs(N - W) * UM);
|
|
17147
|
-
et &&
|
|
17147
|
+
et && b.push({ time: it, value: d - c });
|
|
17148
17148
|
for (let st = Tu, Z = 0; st <= ot; st += Tu, Z++) {
|
|
17149
17149
|
const rt = W + (N - W) * Math.min(st, ot) / ot;
|
|
17150
|
-
et && (d = J(rt),
|
|
17150
|
+
et && (d = J(rt), b.push({ time: it + st, value: d - c }));
|
|
17151
17151
|
const ct = (Z % 2 === 0 ? -1 : 1) * u * 0.02;
|
|
17152
17152
|
P(it + st, V(z, rt, L.y + ct), void 0, !1);
|
|
17153
17153
|
}
|
|
@@ -17157,7 +17157,7 @@ function Tc(t, e, n = {}) {
|
|
|
17157
17157
|
const L = _.target, W = _.to ?? L.x, N = F(j, d + (W >= L.x ? 1 : -1), _.mood), X = p === 1 ? L.left ?? L.x : L.right ?? L.x, z = { ...g, turn: 1, lean: 16, bend: 8, rightWrist: 0, leftWrist: 0, lookX: 1, ...D }, J = U(z, X, L.y, "arm"), tt = R(N, J + p * u * 0.06, Ls), H = V(z, X, L.y), G = { ...z, ...H, leftShoulder: -H.rightShoulder, leftElbow: -H.rightElbow }, et = tt + JM;
|
|
17158
17158
|
P(et, G, _.mood, !1);
|
|
17159
17159
|
const it = Math.abs(W - L.x), ot = et + (_.for ?? Math.max(600, it / ZM)), lt = it / Qa("shove", u);
|
|
17160
|
-
v.push({ time: et, value: "shove" }), E.push({ time: et, value: 0 }, { time: et + Le, value: 1, easing: "ease-out" }, { time: ot - Le, value: 1 }, { time: ot, value: 0, easing: "ease-in" }), M.push({ time: et, value: m }, { time: ot, value: m + lt }), m += lt,
|
|
17160
|
+
v.push({ time: et, value: "shove" }), E.push({ time: et, value: 0 }, { time: et + Le, value: 1, easing: "ease-out" }, { time: ot - Le, value: 1 }, { time: ot, value: 0, easing: "ease-in" }), M.push({ time: et, value: m }, { time: ot, value: m + lt }), m += lt, b.push({ time: et, value: d - c }, { time: ot, value: d + (W - L.x) - c }), d += W - L.x, P(ot, {}, void 0, !1), P(ot + Au, { lean: 0, bend: 0, rightShoulder: ht.rightShoulder, leftShoulder: ht.leftShoulder, rightElbow: ht.rightElbow, leftElbow: ht.leftElbow }), nt = ot + Au, $ = et, O = ot;
|
|
17161
17161
|
} else if (K) {
|
|
17162
17162
|
const L = _.mood ? mn(g, _.mood) : g, W = K.steps(L, _), N = Gg(W, { at: j, from: L });
|
|
17163
17163
|
k.push(...N), g = N[N.length - 1].pose, nt = j + Math.max(HM(W), _.for ?? 0);
|
|
@@ -17185,11 +17185,11 @@ function Tc(t, e, n = {}) {
|
|
|
17185
17185
|
const L = i(_.do) || $u(_.do) || K ? j : j + Math.min(150, (nt - j) / 4), W = i(_.do) ? nt : Math.max(L + 200, nt - 100);
|
|
17186
17186
|
x.push({ text: _.say, start: L, end: W }), _.do === "say" && ax(k, g, L, W);
|
|
17187
17187
|
}
|
|
17188
|
-
_.onto !== void 0 && _.do !== "leap" && _.onto !== f && (
|
|
17188
|
+
_.onto !== void 0 && _.do !== "leap" && _.onto !== f && (w.push({ time: j, value: f - h }, { time: nt, value: _.onto - h, easing: "ease-in-out" }), f = _.onto), nt > k[k.length - 1].time && k.push({ time: nt, pose: g }), T.push({ start: j, end: nt, ...$ !== void 0 ? { contact: $ } : {}, ...O !== void 0 ? { release: O } : {} }), y = nt;
|
|
17189
17189
|
}
|
|
17190
17190
|
const B = EM(t, ix(k), n), Y = [
|
|
17191
|
-
{ id: `${t}-x`, target: t, property: "x", keyframes:
|
|
17192
|
-
{ id: `${t}-y`, target: t, property: "y", keyframes:
|
|
17191
|
+
{ id: `${t}-x`, target: t, property: "x", keyframes: b },
|
|
17192
|
+
{ id: `${t}-y`, target: t, property: "y", keyframes: w },
|
|
17193
17193
|
{ id: `${t}-walk`, target: t, property: "walk", keyframes: M },
|
|
17194
17194
|
{ id: `${t}-walking`, target: t, property: "walking", keyframes: E },
|
|
17195
17195
|
{ id: `${t}-gait`, target: t, property: "gait", keyframes: v },
|
|
@@ -17242,15 +17242,15 @@ ${o.map((d) => ` ${d.beat >= 0 ? `beat ${d.beat}: ` : ""}${d.message}`).join(`
|
|
|
17242
17242
|
const r = n.map((d) => Qg(d, e)), i = Tc(t, r, s), a = dx(r, i.beats, s), l = s.ground ?? 0, c = (d) => s.ride === !1 ? d : Object.values(e).reduce((f, p) => p.ride(f, t, { ground: l }), d);
|
|
17243
17243
|
n.forEach((d, f) => {
|
|
17244
17244
|
for (const p of hx(d)) {
|
|
17245
|
-
const g = (
|
|
17246
|
-
const E = typeof
|
|
17245
|
+
const g = (w) => new Error(`surfaceScript: beat ${f} (${d.do}), ${p.edit} on ${p.surface}: ${w}`), m = (w, M) => {
|
|
17246
|
+
const E = typeof w == "object" ? w.beat : f, v = (typeof w == "object" ? w.at : w) ?? M ?? "start", S = a[E][v];
|
|
17247
17247
|
if (S === void 0) {
|
|
17248
17248
|
const x = eo.filter((T) => a[E][T] !== void 0).join(", ");
|
|
17249
17249
|
throw g(`beat ${E} (${n[E].do}) has no ${v} (it has ${x})`);
|
|
17250
17250
|
}
|
|
17251
17251
|
return S;
|
|
17252
|
-
}, y = e[p.surface], k = m(p.at ?? (a[f].contact !== void 0 ? "contact" : "start")),
|
|
17253
|
-
if (
|
|
17252
|
+
}, y = e[p.surface], k = m(p.at ?? (a[f].contact !== void 0 ? "contact" : "start")), b = p.until === void 0 ? void 0 : m(p.until, "end");
|
|
17253
|
+
if (b !== void 0 && b < k) throw g(`it ends (${b} ms) before it starts (${k} ms)`);
|
|
17254
17254
|
try {
|
|
17255
17255
|
if (p.edit === "carry") {
|
|
17256
17256
|
const M = y.piece(p.anchor), E = Zg(t, c(i.tracks), {
|
|
@@ -17259,15 +17259,15 @@ ${o.map((d) => ` ${d.beat >= 0 ? `beat ${d.beat}: ` : ""}${d.message}`).join(`
|
|
|
17259
17259
|
style: s.figureStyle ?? (s.height ? { height: s.height } : void 0),
|
|
17260
17260
|
cast: s,
|
|
17261
17261
|
start: k,
|
|
17262
|
-
end:
|
|
17262
|
+
end: b
|
|
17263
17263
|
});
|
|
17264
17264
|
y.follow(M, E);
|
|
17265
17265
|
continue;
|
|
17266
17266
|
}
|
|
17267
|
-
const
|
|
17268
|
-
y.edit(p.edit, p.anchor, { ...
|
|
17269
|
-
} catch (
|
|
17270
|
-
throw g(
|
|
17267
|
+
const w = Object.fromEntries(Object.entries(p).filter(([M]) => !lx.includes(M)));
|
|
17268
|
+
y.edit(p.edit, p.anchor, { ...w, at: k, ...b !== void 0 ? { duration: b - k } : {} });
|
|
17269
|
+
} catch (w) {
|
|
17270
|
+
throw g(w.message);
|
|
17271
17271
|
}
|
|
17272
17272
|
}
|
|
17273
17273
|
});
|
|
@@ -17404,13 +17404,13 @@ function gx(t, e, n = 1) {
|
|
|
17404
17404
|
function B6(t, e, n, s = {}) {
|
|
17405
17405
|
const o = Tc(t, n, { ...s, height: e.height, reach: s.reach ?? px(e) }), r = o.tracks.find((y) => y.property === "facing")?.keyframes ?? [], i = (y) => {
|
|
17406
17406
|
let k = s.facing ?? 1;
|
|
17407
|
-
for (const
|
|
17407
|
+
for (const b of r) b.time <= y && (k = b.value);
|
|
17408
17408
|
return k;
|
|
17409
17409
|
}, a = Ul(o.keys), l = o.keys.map((y, k) => {
|
|
17410
|
-
const
|
|
17410
|
+
const b = z5(a[k]);
|
|
17411
17411
|
return {
|
|
17412
17412
|
time: y.time,
|
|
17413
|
-
pose: i(y.time) < 0 ? x2(
|
|
17413
|
+
pose: i(y.time) < 0 ? x2(b) : b,
|
|
17414
17414
|
...y.easing ? { easing: y.easing } : {},
|
|
17415
17415
|
...y.act === !1 ? { act: !1 } : {}
|
|
17416
17416
|
};
|
|
@@ -17437,7 +17437,7 @@ function bx(t, e, n, s, o, r, i) {
|
|
|
17437
17437
|
const p = f.contact, g = f.release ?? f.contact;
|
|
17438
17438
|
t.forEach((m, y) => {
|
|
17439
17439
|
if (m.time < p - 1 || m.time > g + 1) return;
|
|
17440
|
-
const k = r(m.time),
|
|
17440
|
+
const k = r(m.time), b = Ee(e[y], { height: o.height, facing: k < 0 ? -1 : 1 }), w = c(m.time), M = yx.has(h.do) && h.target ? { x: h.target.x - w.x, y: h.target.y - w.y } : void 0, E = { x: (b.hands.right.x + b.fingertips.right.x) / 2, y: (b.hands.right.y + b.fingertips.right.y) / 2 }, v = M ?? (d === "arm" ? E : b.toes.right), S = k < 0 ? "right" : "left", x = `${d}.${S}`;
|
|
17441
17441
|
let T = m.pose;
|
|
17442
17442
|
if (h.do === "point")
|
|
17443
17443
|
T = nn(o, T, x, v);
|
|
@@ -17681,10 +17681,10 @@ function t8(t, e, n) {
|
|
|
17681
17681
|
const d = Ac(t, n.text, n.maxWidth ?? 640), f = i * 1.3, p = Math.max(...d.map((M) => t.measureText(M).width)) + i * 1.75, g = d.length * f + i * 1.25, m = n.speaker ? i * 0.5 : 0, y = Math.min(h.x + h.width - p / 2, Math.max(h.x + p / 2, u.x));
|
|
17682
17682
|
let k = Math.min(u.y - (n.gap ?? 70) - g / 2, n.maxCenterY ?? 1 / 0);
|
|
17683
17683
|
k = Math.max(h.y + m + g / 2, k);
|
|
17684
|
-
const
|
|
17685
|
-
t.translate(
|
|
17686
|
-
const
|
|
17687
|
-
if (t.beginPath(), t.moveTo(
|
|
17684
|
+
const b = { x: u.x + (y - u.x) * 0.2, y: Math.max(k + g / 2 + 16, u.y - 14) };
|
|
17685
|
+
t.translate(b.x, b.y), t.scale(r, r), t.translate(-b.x, -b.y), t.fillStyle = c, t.strokeStyle = l, t.lineWidth = 5, t.lineJoin = "round";
|
|
17686
|
+
const w = Math.min(Math.max(b.x, y - p / 2 + 50), y + p / 2 - 50);
|
|
17687
|
+
if (t.beginPath(), t.moveTo(w - 22, k + g / 2 - 4), t.lineTo(b.x, b.y), t.lineTo(w + 22, k + g / 2 - 4), t.closePath(), t.fill(), t.stroke(), xe(t, y - p / 2, k - g / 2, p, g, 26), t.fill(), t.stroke(), t.fillRect(w - 19, k + g / 2 - 8, 38, 6), n.speaker) {
|
|
17688
17688
|
const M = i * 0.68;
|
|
17689
17689
|
t.font = Ut(M, 800, a);
|
|
17690
17690
|
const E = t.measureText(n.speaker).width + M * 1.1;
|
|
@@ -17829,15 +17829,15 @@ function n8(t, e, n, s = {}) {
|
|
|
17829
17829
|
if (m)
|
|
17830
17830
|
d.title && (t.font = Ut(28, 800, e.font), t.fillStyle = l, t.fillText(d.title, 0, k + (g - k) * 0.45, p - 16)), d.note && (t.font = Ut(19, 600, e.font), t.fillStyle = "#7f1d1d", t.fillText(d.note, 0, k + (g - k) * 0.8, p - 16));
|
|
17831
17831
|
else {
|
|
17832
|
-
const
|
|
17832
|
+
const w = [d.title, d.note].filter(Boolean).join(`
|
|
17833
17833
|
`);
|
|
17834
17834
|
t.font = Ut(26, 700, e.handFont), t.fillStyle = l;
|
|
17835
|
-
const M = Ac(t,
|
|
17835
|
+
const M = Ac(t, w, p - 20), E = s.drawCard ? k + 8 : (g - M.length * 30) / 2;
|
|
17836
17836
|
M.forEach((v, S) => t.fillText(v, 0, E + 24 + S * 30, p - 12));
|
|
17837
17837
|
}
|
|
17838
17838
|
d.highlight && n >= d.highlight.at && n <= d.highlight.at + d.highlight.duration && (t.strokeStyle = tp, t.lineWidth = 8, t.globalAlpha *= 0.6 + 0.4 * Math.sin((n - d.highlight.at) / 1e3 * 6), t.strokeRect(-p / 2 - 8, -8, p + 16, g + 16)), t.restore();
|
|
17839
|
-
const
|
|
17840
|
-
Cx(t,
|
|
17839
|
+
const b = Ta(e, d.id).pin;
|
|
17840
|
+
Cx(t, b.x, b.y - 40 * (1 - Math.min(1, f)), { ink: l });
|
|
17841
17841
|
}
|
|
17842
17842
|
for (const d of e.marks) {
|
|
17843
17843
|
if (n <= d.at) continue;
|
|
@@ -18260,8 +18260,8 @@ function ap(t, e, n, s, o = {}) {
|
|
|
18260
18260
|
m: C.cut ? c : i.get(C.part.id),
|
|
18261
18261
|
local: C.cut ? oi() : g.get(C.part.id),
|
|
18262
18262
|
cell: C.cell
|
|
18263
|
-
})) : t.parts.map((C) => ({ part: C, mesh: mr(C.shape), m: i.get(C.id), local: void 0, cell: void 0 }))).map((C) => ({ cell: C.cell, solved: p(C.part, C.mesh, C.m, C.local) })), k = y.map((C) => C.solved),
|
|
18264
|
-
let
|
|
18263
|
+
})) : t.parts.map((C) => ({ part: C, mesh: mr(C.shape), m: i.get(C.id), local: void 0, cell: void 0 }))).map((C) => ({ cell: C.cell, solved: p(C.part, C.mesh, C.m, C.local) })), k = y.map((C) => C.solved), b = (C) => C.filter((F) => F.faces.length > 0 && F.opacity > 0.01).sort((F, q) => F.depth - q.depth);
|
|
18264
|
+
let w;
|
|
18265
18265
|
if (d) {
|
|
18266
18266
|
const C = new Map(t.parts.map((q) => {
|
|
18267
18267
|
const U = i.get(q.id), Q = mr(q.shape).vertices;
|
|
@@ -18271,7 +18271,7 @@ function ap(t, e, n, s, o = {}) {
|
|
|
18271
18271
|
const U = q.cell.join(",");
|
|
18272
18272
|
F.has(U) || F.set(U, { cell: q.cell, parts: [] }), F.get(U).parts.push(q.solved), q.solved.depth = C.get(q.solved.part.id);
|
|
18273
18273
|
}
|
|
18274
|
-
|
|
18274
|
+
w = [...F.values()].map(({ cell: q, parts: U }) => ({ depth: n.toView(ae(c, d.middle(q)))[2], parts: b(U) })).filter((q) => q.parts.length > 0);
|
|
18275
18275
|
}
|
|
18276
18276
|
const M = {};
|
|
18277
18277
|
for (const [C, F] of Object.entries(t.anchors ?? {})) {
|
|
@@ -18287,7 +18287,7 @@ function ap(t, e, n, s, o = {}) {
|
|
|
18287
18287
|
points: (A === void 0 ? T : Ou(T, A)).map((C) => n.toScreen(C)),
|
|
18288
18288
|
opacity: 0.16 * x
|
|
18289
18289
|
}, I = k.filter((C) => C.part.seeThrough && C.opacity > 0.01).flatMap((C) => C.faces.map((F) => F.points));
|
|
18290
|
-
return { under:
|
|
18290
|
+
return { under: b(k.filter((C) => !C.part.overRider)), over: b(k.filter((C) => C.part.overRider)), ...w ? { cells: w } : {}, anchors: M, openings: I, shadow: P, pxPerUnit: s, sizePx: t.height * s };
|
|
18291
18291
|
}
|
|
18292
18292
|
const Lu = /* @__PURE__ */ new WeakMap();
|
|
18293
18293
|
function Jx(t) {
|
|
@@ -18491,7 +18491,7 @@ function r8(t, e = {}) {
|
|
|
18491
18491
|
y.set(E, v = { ...S, solved: Po(n, S.values, t.propScale) });
|
|
18492
18492
|
}
|
|
18493
18493
|
return v;
|
|
18494
|
-
},
|
|
18494
|
+
}, b = (E, v) => {
|
|
18495
18495
|
const S = g(E), { values: x, origin: T, solved: A } = k(v);
|
|
18496
18496
|
if (S.kind === "box") return Mt(T.x - t.width / 2, T.y - t.height, t.width, t.height);
|
|
18497
18497
|
if (S.kind === "anchor") {
|
|
@@ -18511,9 +18511,9 @@ function r8(t, e = {}) {
|
|
|
18511
18511
|
const U = q.map((B) => B.x), Q = q.map((B) => B.y), V = Math.min(...U), R = Math.min(...Q);
|
|
18512
18512
|
return Mt(T.x + V, T.y + R, Math.max(...U) - V, Math.max(...Q) - R);
|
|
18513
18513
|
}
|
|
18514
|
-
},
|
|
18514
|
+
}, w = (E, v) => {
|
|
18515
18515
|
try {
|
|
18516
|
-
return
|
|
18516
|
+
return b(E, v);
|
|
18517
18517
|
} catch {
|
|
18518
18518
|
return;
|
|
18519
18519
|
}
|
|
@@ -18524,7 +18524,7 @@ function r8(t, e = {}) {
|
|
|
18524
18524
|
target: t,
|
|
18525
18525
|
box: Mt(t.x, t.y, t.width, t.height),
|
|
18526
18526
|
anchor(E, v = 1 / 0) {
|
|
18527
|
-
return
|
|
18527
|
+
return b(E, v);
|
|
18528
18528
|
},
|
|
18529
18529
|
piece(E) {
|
|
18530
18530
|
const v = g(E);
|
|
@@ -18533,7 +18533,7 @@ function r8(t, e = {}) {
|
|
|
18533
18533
|
if (S) return S;
|
|
18534
18534
|
const x = [v.name];
|
|
18535
18535
|
for (let A = 0; A < x.length; A++) for (const P of n.rig.parts) P.parent === x[A] && !x.includes(P.id) && x.push(P.id);
|
|
18536
|
-
const T = { id: u.size + 1, part: v.name, home:
|
|
18536
|
+
const T = { id: u.size + 1, part: v.name, home: b(E, 0) };
|
|
18537
18537
|
u.set(v.name, T);
|
|
18538
18538
|
for (const A of x) d.set(A, T.id);
|
|
18539
18539
|
for (const A of ["x", "y", "rotate"]) f[`piece.${T.id}.${A}`] = 0;
|
|
@@ -18549,7 +18549,7 @@ function r8(t, e = {}) {
|
|
|
18549
18549
|
if (E === "fling") return M.fling(T, S);
|
|
18550
18550
|
const A = S.to;
|
|
18551
18551
|
if (!A) throw new Error(`${n.kind}.edit: move needs \`to\`, an anchor name or { x, y }`);
|
|
18552
|
-
const P = typeof A == "string" ?
|
|
18552
|
+
const P = typeof A == "string" ? b(A, S.at) : void 0;
|
|
18553
18553
|
return M.move(T, { ...S, to: P ? { x: P.left + P.width / 2, y: P.top + P.height / 2 } : A });
|
|
18554
18554
|
}
|
|
18555
18555
|
for (const T of x) {
|
|
@@ -18582,8 +18582,8 @@ function r8(t, e = {}) {
|
|
|
18582
18582
|
];
|
|
18583
18583
|
if (x.length === 0) return E;
|
|
18584
18584
|
const T = [...r.map((A) => `anchor:${A}`), ...i.map((A) => `part:${A}`)].flatMap((A) => {
|
|
18585
|
-
const P =
|
|
18586
|
-
return P ? [{ top: P.top, offset: (I) => (
|
|
18585
|
+
const P = w(A, 0);
|
|
18586
|
+
return P ? [{ top: P.top, offset: (I) => (w(A, I)?.top ?? P.top) - P.top, windows: x }] : [];
|
|
18587
18587
|
});
|
|
18588
18588
|
return Mc(E, v, { ground: S.ground, every: S.every ?? wn, floors: T });
|
|
18589
18589
|
},
|
|
@@ -18668,7 +18668,7 @@ function an(t) {
|
|
|
18668
18668
|
outline: 0.4
|
|
18669
18669
|
}), n.push({
|
|
18670
18670
|
id: `door-${m}`,
|
|
18671
|
-
shape: { type: "panel", points: p.map(([
|
|
18671
|
+
shape: { type: "panel", points: p.map(([b, w]) => [b - u, w]), facing: g > 0 ? "left" : "right" },
|
|
18672
18672
|
// The panel's origin is at its hinge (its front edge), just outside the body.
|
|
18673
18673
|
at: [g * (t.width / 2 + 0.01), 0, u],
|
|
18674
18674
|
fill: e.body,
|
|
@@ -19066,10 +19066,10 @@ function w3() {
|
|
|
19066
19066
|
};
|
|
19067
19067
|
}
|
|
19068
19068
|
function k3(t = {}) {
|
|
19069
|
-
const e = t.width ?? 4, n = t.depth ?? 3.2, s = t.wallHeight ?? 2.5, o = t.roofHeight ?? 1.5, r = t.overhang ?? 0.25, i = { walls: "#f1d9a8", roof: "#b8433a", door: "#7a4b2a", doorway: "#3a2a22", glass: "#bfe3f2", lit: "#ffd66b", chimney: "#9b5a45", ...t.colors }, a = n / 2 + 0.01, l = t.door?.width ?? 0.9, c = t.door?.height ?? 1.9, h = t.door?.at ?? 0,
|
|
19069
|
+
const e = t.width ?? 4, n = t.depth ?? 3.2, s = t.wallHeight ?? 2.5, o = t.roofHeight ?? 1.5, r = t.overhang ?? 0.25, i = { walls: "#f1d9a8", roof: "#b8433a", door: "#7a4b2a", doorway: "#3a2a22", glass: "#bfe3f2", lit: "#ffd66b", chimney: "#9b5a45", ...t.colors }, a = n / 2 + 0.01, l = t.door?.width ?? 0.9, c = t.door?.height ?? 1.9, h = t.door?.at ?? 0, d = (t.door?.hinge ?? "left") === "left" ? 1 : -1, f = h - d * l / 2, p = -80 * d * ((t.door?.opens ?? "out") === "out" ? 1 : -1), g = t.windows ?? [
|
|
19070
19070
|
{ at: -1.25, low: 1, width: 0.8, height: 0.8 },
|
|
19071
19071
|
{ at: 1.25, low: 1, width: 0.8, height: 0.8 }
|
|
19072
|
-
],
|
|
19072
|
+
], m = [
|
|
19073
19073
|
{ id: "walls", shape: { type: "box", size: [e, s, n] }, at: [0, s / 2, 0], fill: i.walls },
|
|
19074
19074
|
{
|
|
19075
19075
|
id: "roof",
|
|
@@ -19080,39 +19080,39 @@ function k3(t = {}) {
|
|
|
19080
19080
|
},
|
|
19081
19081
|
// The doorway behind the door shows when it opens.
|
|
19082
19082
|
{ id: "doorway", shape: { type: "panel", points: [[0, 0], [l, 0], [l, c], [0, c]], facing: "front" }, at: [h - l / 2, 0, a - 5e-3], fill: i.doorway, outline: 0.6, seeThrough: !0 },
|
|
19083
|
-
// The door, hinged on
|
|
19084
|
-
{ id: "door", shape: { type: "panel", points: [[0, 0], [l, 0], [l, c], [0, c]], facing: "front" }, at: [
|
|
19083
|
+
// The door, hinged on the panel's origin edge (left or right); drawn over a rider, so a figure in the doorway shows only when it opens.
|
|
19084
|
+
{ id: "door", shape: { type: "panel", points: [[0, 0], [d * l, 0], [d * l, c], [0, c]], facing: "front" }, at: [f, 0, a + 5e-3], fill: i.door, outline: 0.8, overRider: !0 }
|
|
19085
19085
|
];
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
id: `window-${
|
|
19089
|
-
shape: { type: "panel", points: [[-
|
|
19086
|
+
g.forEach((b, w) => {
|
|
19087
|
+
m.push({
|
|
19088
|
+
id: `window-${w}`,
|
|
19089
|
+
shape: { type: "panel", points: [[-b.width / 2, b.low], [b.width / 2, b.low], [b.width / 2, b.low + b.height], [-b.width / 2, b.low + b.height]], facing: "front" },
|
|
19090
19090
|
// A centimetre out from the wall, as the side windows are: never in its very plane (a depth buffer can't
|
|
19091
19091
|
// tell which is in front).
|
|
19092
|
-
at: [
|
|
19092
|
+
at: [b.at, 0, a + 0.01],
|
|
19093
19093
|
fill: i.glass,
|
|
19094
19094
|
outline: 0.8,
|
|
19095
19095
|
glow: { control: "lights", color: i.lit }
|
|
19096
19096
|
});
|
|
19097
19097
|
});
|
|
19098
|
-
for (const
|
|
19099
|
-
|
|
19100
|
-
id: `side-window-${
|
|
19101
|
-
shape: { type: "panel", points: [[-0.4, 1], [0.4, 1], [0.4, 1.8], [-0.4, 1.8]], facing:
|
|
19102
|
-
at: [
|
|
19098
|
+
for (const b of [1, -1])
|
|
19099
|
+
m.push({
|
|
19100
|
+
id: `side-window-${b > 0 ? "left" : "right"}`,
|
|
19101
|
+
shape: { type: "panel", points: [[-0.4, 1], [0.4, 1], [0.4, 1.8], [-0.4, 1.8]], facing: b > 0 ? "left" : "right" },
|
|
19102
|
+
at: [b * (e / 2 + 0.01), 0, 0],
|
|
19103
19103
|
fill: i.glass,
|
|
19104
19104
|
outline: 0.8,
|
|
19105
19105
|
glow: { control: "lights", color: i.lit }
|
|
19106
19106
|
});
|
|
19107
|
-
const
|
|
19108
|
-
if (
|
|
19109
|
-
const
|
|
19110
|
-
|
|
19107
|
+
const y = t.chimney === !1 ? void 0 : { at: t.chimney?.at ?? e * 0.28, back: t.chimney?.back ?? -n * 0.18 };
|
|
19108
|
+
if (y) {
|
|
19109
|
+
const b = s + o * (1 - Math.abs(y.back) / (n / 2 + r)), w = s + o + 0.45;
|
|
19110
|
+
m.push({ id: "chimney", shape: { type: "box", size: [0.42, w - b + 0.3, 0.42] }, at: [y.at, (w + b - 0.3) / 2, y.back], fill: i.chimney, layer: 1 });
|
|
19111
19111
|
}
|
|
19112
|
-
const
|
|
19113
|
-
parts:
|
|
19112
|
+
const k = {
|
|
19113
|
+
parts: m,
|
|
19114
19114
|
controls: {
|
|
19115
|
-
door: { description: "The front door open: 0 shut, 1 open", unit: "0..1", min: 0, max: 1, bind: [{ parts: ["door"], rotate: { axis: "y", degrees:
|
|
19115
|
+
door: { description: "The front door open: 0 shut, 1 open", unit: "0..1", min: 0, max: 1, bind: [{ parts: ["door"], rotate: { axis: "y", degrees: p } }] },
|
|
19116
19116
|
lights: { description: "The windows lit: 0 dark, 1 lit", unit: "0..1", min: 0, max: 1 }
|
|
19117
19117
|
},
|
|
19118
19118
|
length: n + r * 2,
|
|
@@ -19120,17 +19120,19 @@ function k3(t = {}) {
|
|
|
19120
19120
|
footprint: [e + 0.6, n + 0.6],
|
|
19121
19121
|
anchors: {
|
|
19122
19122
|
door: { at: [h, c / 2, a] },
|
|
19123
|
+
// The handle, a hand's width in from the free edge.
|
|
19124
|
+
handle: { at: [f + d * (l - 0.12), c * 0.5, a + 0.02] },
|
|
19123
19125
|
doorstep: { at: [h, 0, a + 0.4] },
|
|
19124
19126
|
ridge: { at: [0, s + o, 0] },
|
|
19125
|
-
...
|
|
19127
|
+
...y ? { chimney: { at: [y.at, s + o + 0.5, y.back] } } : {}
|
|
19126
19128
|
}
|
|
19127
19129
|
};
|
|
19128
19130
|
return {
|
|
19129
19131
|
kind: t.kind ?? "house",
|
|
19130
19132
|
family: "building",
|
|
19131
19133
|
summary: t.summary ?? "A house: opens its door, lights its windows, puffs chimney smoke, shakes, pops up.",
|
|
19132
|
-
rig:
|
|
19133
|
-
actions: M3(!!
|
|
19134
|
+
rig: k,
|
|
19135
|
+
actions: M3(!!y),
|
|
19134
19136
|
acting: v3,
|
|
19135
19137
|
colors: { body: i.walls }
|
|
19136
19138
|
};
|
|
@@ -19420,8 +19422,8 @@ function _3(t = {}) {
|
|
|
19420
19422
|
{ id: "footrest", shape: { type: "box", size: [e * 0.8, 0.02, 0.14] }, at: [0, 0.12, l / 2 + 0.22], fill: r.frame }
|
|
19421
19423
|
];
|
|
19422
19424
|
for (const [g, m] of [[-1, "left"], [1, "right"]]) {
|
|
19423
|
-
const y = g * u, k = (
|
|
19424
|
-
d.push({ id:
|
|
19425
|
+
const y = g * u, k = (b, w, M = a) => {
|
|
19426
|
+
d.push({ id: b, shape: { type: "tube", points: w, radius: M, segments: 6 }, fill: r.frame, outline: 0.7 });
|
|
19425
19427
|
};
|
|
19426
19428
|
k(`post-${m}`, [[y, n - 0.1, -l / 2], [y, c + 0.04, -l / 2], [y, c + 0.04, -l / 2 - 0.14]]), k(`rail-${m}`, [[y, n - 0.03, -l / 2], [y, n - 0.03, l / 2]]), k(`leg-${m}`, [[y, n - 0.03, l / 2], [y * 0.85, o, l / 2 + 0.06]]), k(`strut-${m}`, [[y * 0.85, o + 0.08, l / 2 + 0.04], [y * 0.8, 0.13, l / 2 + 0.22]]), k(`armrest-${m}`, [[y, n + 0.22, -l / 2 + 0.02], [y, n + 0.22, l / 2 - 0.08]], a * 1.3), d.push({
|
|
19427
19429
|
id: `wheel-${m}`,
|
|
@@ -20690,18 +20692,18 @@ ${o.map((x) => ` beat ${x.beat}: ${x.message}`).join(`
|
|
|
20690
20692
|
if (!A) throw new Error(`${e.kind}: no anchor "${x}"`);
|
|
20691
20693
|
return { x: p + A.point.x, y: g + A.point.y };
|
|
20692
20694
|
}
|
|
20693
|
-
},
|
|
20694
|
-
let
|
|
20695
|
+
}, b = [];
|
|
20696
|
+
let w = 0;
|
|
20695
20697
|
for (const x of n) {
|
|
20696
|
-
const T = Math.max(x.at ??
|
|
20697
|
-
A.end > u[u.length - 1].time && u.push({ time: A.end, pose: { ...h } }),
|
|
20698
|
+
const T = Math.max(x.at ?? w, u[u.length - 1].time), A = c[x.do].run(k, x, T);
|
|
20699
|
+
A.end > u[u.length - 1].time && u.push({ time: A.end, pose: { ...h } }), b.push({ start: T, end: A.end, ...A.contact !== void 0 ? { contact: A.contact } : {}, ...A.release !== void 0 ? { release: A.release } : {} }), w = A.end;
|
|
20698
20700
|
}
|
|
20699
20701
|
const M = Kg(s.style ?? "snappy"), E = { ...M, anticipation: M.anticipation * l, overshoot: M.overshoot * l }, v = xc(pS(u), e.acting, { style: E }), S = [
|
|
20700
20702
|
// Controls keyed exactly (wheels, rotors) are not acted.
|
|
20701
20703
|
...Object.entries(v).filter(([x]) => !d.has(x)).map(([x, T]) => ({ id: `${t}-${x}`, target: t, property: x, keyframes: T })),
|
|
20702
20704
|
...[...d].map(([x, T]) => ({ id: `${t}-${x}`, target: t, property: x, keyframes: mS(T) }))
|
|
20703
20705
|
];
|
|
20704
|
-
for (const x of fS(t, e, S,
|
|
20706
|
+
for (const x of fS(t, e, S, w, u[0].pose)) {
|
|
20705
20707
|
const T = S.findIndex((I) => I.property === x.property);
|
|
20706
20708
|
if (T < 0) {
|
|
20707
20709
|
S.push(x);
|
|
@@ -20710,7 +20712,7 @@ ${o.map((x) => ` beat ${x.beat}: ${x.message}`).join(`
|
|
|
20710
20712
|
const A = new Wt({ id: `${t}-own`, tracks: [S[T]] }), P = (I) => Number(A.getStateAtTime(I).values.get(t)?.get(x.property) ?? 0);
|
|
20711
20713
|
S[T] = { ...x, keyframes: x.keyframes.map((I) => ({ time: I.time, value: Number(I.value) + P(I.time) })) };
|
|
20712
20714
|
}
|
|
20713
|
-
return { tracks: S, duration:
|
|
20715
|
+
return { tracks: S, duration: w, beats: b, effects: f };
|
|
20714
20716
|
}
|
|
20715
20717
|
const dS = 1500;
|
|
20716
20718
|
function fS(t, e, n, s, o) {
|
|
@@ -21028,18 +21030,18 @@ function u8(t, e = {}) {
|
|
|
21028
21030
|
throw new Error("cricketCamera: target override is not supported by follow-ball");
|
|
21029
21031
|
const l = xS(t, n), c = e.pitch ?? l.pitch, h = e.distance ?? l.distance, u = i(e.fov ?? l.fov), d = e.target ? [...e.target] : l.target ?? [0, 0, 0], f = t.scene.id + "/camera", p = (g) => {
|
|
21030
21032
|
if (e.distance === void 0 && e.target === void 0) return g;
|
|
21031
|
-
const m = g.find((
|
|
21033
|
+
const m = g.find((b) => b.property === "position");
|
|
21032
21034
|
if (!m || !("keyframes" in m)) return g;
|
|
21033
|
-
const y = t.scene.objects.find((
|
|
21035
|
+
const y = t.scene.objects.find((b) => b.id === "camera" && b.kind === "camera");
|
|
21034
21036
|
let k = y?.kind === "camera" ? Math.max(600, y.far) : 600;
|
|
21035
|
-
for (const
|
|
21037
|
+
for (const b of m.keyframes) k = Math.max(k, Math.hypot(...b.value) + t.boundaryRadius + 10);
|
|
21036
21038
|
if (!Number.isFinite(k)) throw new Error("cricketCamera: framing exceeds finite camera range");
|
|
21037
21039
|
return [...g, { id: f + "-framing-far", target: f, property: "far", keyframes: [{ time: 0, value: k }, { time: t.duration, value: k }] }];
|
|
21038
21040
|
};
|
|
21039
21041
|
if (n === "follow-ball") {
|
|
21040
|
-
const g = ["x", "y", "z"].map((
|
|
21041
|
-
const M = t.timeline.tracks.find((x) => x.target === t.scene.id + "/ball" && x.property ===
|
|
21042
|
-
if (!M || !("keyframes" in M) || !M.keyframes.length) throw new Error("cricketCamera: missing ball " +
|
|
21042
|
+
const g = ["x", "y", "z"].map((w) => {
|
|
21043
|
+
const M = t.timeline.tracks.find((x) => x.target === t.scene.id + "/ball" && x.property === w);
|
|
21044
|
+
if (!M || !("keyframes" in M) || !M.keyframes.length) throw new Error("cricketCamera: missing ball " + w + " keyframes");
|
|
21043
21045
|
const E = M.keyframes;
|
|
21044
21046
|
let v = 0, S = new Mn({ ...M, keyframes: E.slice(0, 2) });
|
|
21045
21047
|
return (x) => {
|
|
@@ -21047,8 +21049,8 @@ function u8(t, e = {}) {
|
|
|
21047
21049
|
for (; v < E.length - 2 && x - (M.delay ?? 0) > E[v + 1].time; ) v++;
|
|
21048
21050
|
return v !== T && (S = new Mn({ ...M, keyframes: E.slice(v, v + 2) })), S.getValueAtTime(x);
|
|
21049
21051
|
};
|
|
21050
|
-
}), m = (Math.atan2(5, 6) * 180 / Math.PI + o - _a["follow-ball"]) * Math.PI / 180, y = c * Math.PI / 180, k = o === _a["follow-ball"] && (e.pitch === void 0 || e.pitch === l.pitch) && (e.distance === void 0 || e.distance === l.distance) ? [5, 3, 6] : [Math.sin(m) * Math.cos(y) * h, Math.sin(y) * h, Math.cos(m) * Math.cos(y) * h],
|
|
21051
|
-
return p([...
|
|
21052
|
+
}), m = (Math.atan2(5, 6) * 180 / Math.PI + o - _a["follow-ball"]) * Math.PI / 180, y = c * Math.PI / 180, k = o === _a["follow-ball"] && (e.pitch === void 0 || e.pitch === l.pitch) && (e.distance === void 0 || e.distance === l.distance) ? [5, 3, 6] : [Math.sin(m) * Math.cos(y) * h, Math.sin(y) * h, Math.cos(m) * Math.cos(y) * h], b = MS({ scene: t.scene.id, camera: "camera", start: 0, end: t.duration, every: a, offset: k, subjectAt: (w) => g.map((M) => M(w)) });
|
|
21053
|
+
return p([...b, { id: f + "-zoom-fov", target: f, property: "fov", keyframes: [{ time: 0, value: u }, { time: t.duration, value: u }] }]);
|
|
21052
21054
|
}
|
|
21053
21055
|
return p(vS({ scene: t.scene.id, camera: "camera", start: 0, end: t.duration, every: a, easing: "linear", from: { target: d, yaw: o, pitch: c, distance: h, fov: u }, to: { yaw: n === "orbit" ? o + 360 : o } }));
|
|
21054
21056
|
}
|
|
@@ -21155,9 +21157,9 @@ function Ap(t = {}) {
|
|
|
21155
21157
|
for (const p of [-1, 1]) {
|
|
21156
21158
|
const g = p > 0 ? "striker" : "bowler", m = p * a, y = m - p * Gt.poppingCrease;
|
|
21157
21159
|
h.push(...$S(g, m));
|
|
21158
|
-
const k = (
|
|
21160
|
+
const k = (b, w) => h.push({ id: `${g}-${b}`, kind: "line", layer: -1, color: "#fffdf0", width: 0.045, points: w });
|
|
21159
21161
|
k("popping-line", [[-o.poppingCreaseHalfWidth, 0.02, y], [o.poppingCreaseHalfWidth, 0.02, y]]), k("bowling-line", [[-1.32, 0.02, m], [1.32, 0.02, m]]);
|
|
21160
|
-
for (const
|
|
21162
|
+
for (const b of [-1, 1]) k(`return-line-${b < 0 ? "left" : "right"}`, [[b * 1.32, 0.02, y], [b * 1.32, 0.02, m + p * 2.5]]);
|
|
21161
21163
|
}
|
|
21162
21164
|
const u = [
|
|
21163
21165
|
["batter", "batter", [-0.38, 0, 9.3]],
|
|
@@ -21177,9 +21179,9 @@ function Ap(t = {}) {
|
|
|
21177
21179
|
["square-umpire", "umpire", [-15, 0, 8.84]]
|
|
21178
21180
|
];
|
|
21179
21181
|
u.forEach(([p, g, m], y) => {
|
|
21180
|
-
const k = n === "children" || n === "mixed" && y % 3 === 0,
|
|
21182
|
+
const k = n === "children" || n === "mixed" && y % 3 === 0, b = n === "men" ? "youngMan" : k ? y % 2 ? "childGirl" : "childBoy" : y % 2 ? "youngWoman" : "youngMan", w = Math.hypot(m[0], m[2]), M = w > r * 0.88 ? [m[0] * r * 0.88 / w, 0, m[2] * r * 0.88 / w] : [...m];
|
|
21181
21183
|
c[p] = [...M];
|
|
21182
|
-
const E = AS({ id: p, role: g, preset:
|
|
21184
|
+
const E = AS({ id: p, role: g, preset: b, format: e, position: M, color: g === "batter" ? t.battingColor ?? "#397cb9" : t.fieldingColor ?? "#bf604e" });
|
|
21183
21185
|
if (Object.hasOwn(yo, p) && (E.name = yo[p]), p !== "batter") {
|
|
21184
21186
|
const v = p === "non-striker" || p === "bowler" ? u[0][2] : u.find(([S]) => S === "bowler")[2];
|
|
21185
21187
|
E.pose = { turn: us(M, v) };
|
|
@@ -21251,9 +21253,9 @@ function $p(t, e, n) {
|
|
|
21251
21253
|
const h = Object.fromEntries(["batter", "non-striker", "bowler", "keeper", "fielder", "umpire"].map(($) => [$, Il(t.scene, $)]));
|
|
21252
21254
|
for (const $ of ["slip", "point", "cover", "mid-off", "mid-on", "square-leg", "fine-leg", "third-man", "square-umpire"])
|
|
21253
21255
|
t.scene.objects.some((O) => O.id === $ && O.kind === "character") && (h[$] = Il(t.scene, $));
|
|
21254
|
-
const u = ($) => h[$].who.height, d = ($) => kp(h[$]), f = ($) => Math.round($ * 6e3 / l * 1e9) / 1e9, p = ($) => $ * l / 6e3, g = ["batting", "defend", "running", "four", "six", "catch", "fielding", "throw", "run-out"].includes(s), m = ["bowling", "spin", "no-ball", "stumping"].includes(s), y = ["catch", "fielding", "throw", "run-out", "batting", "running"].includes(s), k = s === "running" || s === "run-out",
|
|
21255
|
-
let D =
|
|
21256
|
-
D || (D = /* @__PURE__ */ new Map(),
|
|
21256
|
+
const u = ($) => h[$].who.height, d = ($) => kp(h[$]), f = ($) => Math.round($ * 6e3 / l * 1e9) / 1e9, p = ($) => $ * l / 6e3, g = ["batting", "defend", "running", "four", "six", "catch", "fielding", "throw", "run-out"].includes(s), m = ["bowling", "spin", "no-ball", "stumping"].includes(s), y = ["catch", "fielding", "throw", "run-out", "batting", "running"].includes(s), k = s === "running" || s === "run-out", b = /* @__PURE__ */ new Map(), w = [d("bowler").position[0], 0, o ? -8.25 : -9.55], M = s === "fielding" ? [10.5, 0, 2] : [9, 0, -1], E = d("fielder").position, v = ($, O) => {
|
|
21257
|
+
let D = b.get($);
|
|
21258
|
+
D || (D = /* @__PURE__ */ new Map(), b.set($, D));
|
|
21257
21259
|
const K = D.get(O);
|
|
21258
21260
|
if (K) return K;
|
|
21259
21261
|
const L = h[$];
|
|
@@ -21261,10 +21263,10 @@ function $p(t, e, n) {
|
|
|
21261
21263
|
if ($ === "bowler") {
|
|
21262
21264
|
const N = W.position;
|
|
21263
21265
|
if (O < 1400) {
|
|
21264
|
-
const X = Tt(
|
|
21266
|
+
const X = Tt(w, [0, 0, -0.65]);
|
|
21265
21267
|
W = sr(L, O, 0, 1400, N, X), W.pose["arm.right.swing"] = 45, W.pose["arm.right.elbow"] = 80;
|
|
21266
21268
|
} else
|
|
21267
|
-
W.position = O <= jt ? gn(Tt(
|
|
21269
|
+
W.position = O <= jt ? gn(Tt(w, [0, 0, -0.65]), w, _t(It(O, 1400, jt))) : Tt(w, [0, 0, 0.8 * _t(It(O, jt, 2600))]), W.pose = Ia(O, [
|
|
21268
21270
|
[1400, { turn: 0, "arm.right.swing": 285, "arm.right.elbow": 8, "arm.left.swing": 115, "leg.right.swing": 15, "leg.left.knee": 45 }],
|
|
21269
21271
|
[1800, { turn: 0, "arm.right.swing": 180, "arm.right.elbow": 0, "arm.left.swing": 80, "leg.right.swing": 25, "leg.right.knee": 0, "leg.left.swing": -25, "leg.left.knee": 60 }],
|
|
21270
21272
|
[jt, { turn: 0, lean: 8, "arm.right.swing": 155, "arm.right.elbow": 0, "arm.left.swing": 45, "leg.right.swing": 25, "leg.right.knee": 0, "leg.left.swing": -25, "leg.left.knee": 60 }],
|
|
@@ -22090,8 +22092,8 @@ function k8(t) {
|
|
|
22090
22092
|
if (!y) throw new Error(`propTow: ${s.prop.kind} has no anchor "${t.anchor}"`);
|
|
22091
22093
|
const k = g.x - y.point.x;
|
|
22092
22094
|
if (u !== void 0 && i) {
|
|
22093
|
-
const
|
|
22094
|
-
h += (k - u) * (
|
|
22095
|
+
const b = Math.sin(m * Math.PI / 2);
|
|
22096
|
+
h += (k - u) * (b || 1) / s.propScale / i * (180 / Math.PI);
|
|
22095
22097
|
}
|
|
22096
22098
|
if (u = k, a.push({ time: f, value: k - o }), l.push({ time: f, value: m }), c.push({ time: f, value: h }), f >= t.end) break;
|
|
22097
22099
|
}
|
|
@@ -22114,7 +22116,7 @@ function YS(t, e) {
|
|
|
22114
22116
|
for (const g of d.corners) for (const m of [0, 1, 2]) l[g][m] += d.normal[m];
|
|
22115
22117
|
const [f, ...p] = d.corners;
|
|
22116
22118
|
for (let g = 0; g + 1 < p.length; g++) {
|
|
22117
|
-
const [m, y, k] = [f, p[g], p[g + 1]], [
|
|
22119
|
+
const [m, y, k] = [f, p[g], p[g + 1]], [b, w, M] = [i.vertices[m], i.vertices[y], i.vertices[k]], E = [w[0] - b[0], w[1] - b[1], w[2] - b[2]], v = [M[0] - b[0], M[1] - b[1], M[2] - b[2]], S = [E[1] * v[2] - E[2] * v[1], E[2] * v[0] - E[0] * v[2], E[0] * v[1] - E[1] * v[0]], x = S[0] * d.normal[0] + S[1] * d.normal[1] + S[2] * d.normal[2];
|
|
22118
22120
|
c.push(...x >= 0 ? [m, y, k] : [m, k, y]);
|
|
22119
22121
|
}
|
|
22120
22122
|
});
|
|
@@ -22200,14 +22202,14 @@ const VS = /* @__PURE__ */ new Set([
|
|
|
22200
22202
|
const p = a(f), g = a(d.toView([0, c.rig.height / 2 + 1, 0])), m = Math.hypot(g.x - p.x, g.y - p.y), y = r.length === 0 ? void 0 : (v, S) => {
|
|
22201
22203
|
const x = ae(s, v), T = [s[0] * S[0] + s[4] * S[1] + s[8] * S[2], s[1] * S[0] + s[5] * S[1] + s[9] * S[2], s[2] * S[0] + s[6] * S[1] + s[10] * S[2]], A = Math.hypot(...T) || 1;
|
|
22202
22204
|
return { light: tf(x, [T[0] / A, T[1] / A, T[2] / A], r), fog: ef(i, Math.hypot(x[0] - o.position[0], x[1] - o.position[1], x[2] - o.position[2])) };
|
|
22203
|
-
}, k = ap(c.rig, h, d, m, { perspective: !0, near: o.near, slice: JS, light: y }),
|
|
22205
|
+
}, k = ap(c.rig, h, d, m, { perspective: !0, near: o.near, slice: JS, light: y }), b = { look: l.look, style: l.style, ink: l.ink, paper: l.paper, fog: i?.color }, w = Ag(k), M = k.cells ?? [], E = Math.max(...M.map((v) => -v.depth), -f[2]);
|
|
22204
22206
|
return {
|
|
22205
22207
|
drawables: [
|
|
22206
|
-
...l.shadow === !1 ? [] : [{ depth: E + c.rig.length, draw: (v) => $g(v, k,
|
|
22208
|
+
...l.shadow === !1 ? [] : [{ depth: E + c.rig.length, draw: (v) => $g(v, k, b) }],
|
|
22207
22209
|
...M.map((v) => ({
|
|
22208
22210
|
depth: -v.depth,
|
|
22209
22211
|
draw(S, x) {
|
|
22210
|
-
S.lineCap = "round", S.lineJoin = "round", G5(S, v.parts,
|
|
22212
|
+
S.lineCap = "round", S.lineJoin = "round", G5(S, v.parts, w, { ...b, time: x.time });
|
|
22211
22213
|
}
|
|
22212
22214
|
}))
|
|
22213
22215
|
]
|
|
@@ -22236,29 +22238,29 @@ function o4(t, e) {
|
|
|
22236
22238
|
function M8(t, e, n, s) {
|
|
22237
22239
|
const o = o4(n, e);
|
|
22238
22240
|
if (o.length > 0) throw new Error(`propScript3D (${e.kind}): ${o.length} problem(s) in the beats:
|
|
22239
|
-
${o.map((
|
|
22241
|
+
${o.map((b) => ` beat ${b.beat}: ${b.message}`).join(`
|
|
22240
22242
|
`)}`);
|
|
22241
22243
|
const r = {};
|
|
22242
|
-
for (const
|
|
22244
|
+
for (const b of [...Object.keys($o), ...Object.keys(e.rig.controls)]) r[b] = s.values?.[b] ?? Ot(e.rig, {}, b);
|
|
22243
22245
|
let [i, a] = s.position ?? [0, 0], l = s.heading ?? 0;
|
|
22244
|
-
const c = /* @__PURE__ */ new Map(), h = (
|
|
22245
|
-
const v = c.get(
|
|
22246
|
-
v.push({ time:
|
|
22247
|
-
}, u = (
|
|
22246
|
+
const c = /* @__PURE__ */ new Map(), h = (b, w, M, E = "linear") => {
|
|
22247
|
+
const v = c.get(b) ?? [];
|
|
22248
|
+
v.push({ time: w, value: M, easing: E }), c.set(b, v);
|
|
22249
|
+
}, u = (b, w, M) => h(b, w, M);
|
|
22248
22250
|
h("x", 0, i), h("z", 0, a), h("rotateY", 0, l);
|
|
22249
|
-
const d = (
|
|
22250
|
-
const M = zr(l,
|
|
22251
|
-
if (Math.abs(M) < 1) return
|
|
22251
|
+
const d = (b, w) => {
|
|
22252
|
+
const M = zr(l, w);
|
|
22253
|
+
if (Math.abs(M) < 1) return b;
|
|
22252
22254
|
const E = Math.max(t4, Math.abs(M) * QS);
|
|
22253
|
-
return u("rotateY",
|
|
22254
|
-
}, f = (
|
|
22255
|
-
const E = Rg([[i, a], ...
|
|
22255
|
+
return u("rotateY", b, l), l += M, h("rotateY", b + E, l, "ease-in-out"), b + E;
|
|
22256
|
+
}, f = (b, w, M) => {
|
|
22257
|
+
const E = Rg([[i, a], ...w.through ?? [w.to]]);
|
|
22256
22258
|
if (E.length < 2) return M;
|
|
22257
|
-
const v = d(M, fs(E[0].point, E[1].point)), S = E[E.length - 1].at, x =
|
|
22258
|
-
for (const [U, Q] of Object.entries(
|
|
22259
|
+
const v = d(M, fs(E[0].point, E[1].point)), S = E[E.length - 1].at, x = w.for ?? S / (w.speed ?? b.speed) * 1e3, T = qt("ease-in-out"), A = Math.min(e4, x / 4);
|
|
22260
|
+
for (const [U, Q] of Object.entries(b.set ?? {}))
|
|
22259
22261
|
u(U, v, r[U]), h(U, v + 1, Q), r[U] = Q;
|
|
22260
|
-
const P =
|
|
22261
|
-
for (const [U, Q] of Object.entries(
|
|
22262
|
+
const P = b.flies ? w.height ?? (r.lift > 0.05 ? r.lift : 2) : void 0, I = P !== void 0 && P > 0.05;
|
|
22263
|
+
for (const [U, Q] of Object.entries(b.hold ?? {}))
|
|
22262
22264
|
u(U, v, r[U]), h(U, v + A, Q, "ease-out"), I || (h(U, v + x - A, Q), h(U, v + x, 0, "ease-in")), r[U] = I ? Q : 0;
|
|
22263
22265
|
P !== void 0 && (u("lift", v, r.lift), h("lift", v + Math.min(x * 0.35, 1400), P, "ease-out"), h("lift", v + x, P), r.lift = P);
|
|
22264
22266
|
const C = { ...r };
|
|
@@ -22266,39 +22268,39 @@ ${o.map((w) => ` beat ${w.beat}: ${w.message}`).join(`
|
|
|
22266
22268
|
for (let U = 0; ; U = Math.min(S, U + ZS)) {
|
|
22267
22269
|
const Q = v + Wg(T, U / S) * x, { point: V, direction: R } = Fg(E, U);
|
|
22268
22270
|
F += zr(F, fs([0, 0], R)), h("x", Q, V[0]), h("z", Q, V[1]), h("rotateY", Q, F);
|
|
22269
|
-
for (const [B, Y] of Object.entries(
|
|
22270
|
-
for (const [B, Y] of Object.entries(
|
|
22271
|
+
for (const [B, Y] of Object.entries(b.perMetre ?? {})) h(B, Q, C[B] + U * Y);
|
|
22272
|
+
for (const [B, Y] of Object.entries(b.perSecond ?? {})) h(B, Q, C[B] + (Q - v) / 1e3 * Y);
|
|
22271
22273
|
if (U >= S) break;
|
|
22272
22274
|
}
|
|
22273
|
-
for (const [U, Q] of Object.entries(
|
|
22274
|
-
for (const [U, Q] of Object.entries(
|
|
22275
|
+
for (const [U, Q] of Object.entries(b.perMetre ?? {})) r[U] = C[U] + S * Q;
|
|
22276
|
+
for (const [U, Q] of Object.entries(b.perSecond ?? {})) r[U] = C[U] + x / 1e3 * Q;
|
|
22275
22277
|
return [i, a] = E[E.length - 1].point, l = F, v + x;
|
|
22276
|
-
}, p = (
|
|
22277
|
-
const M = Object.fromEntries(Object.entries(
|
|
22278
|
+
}, p = (b, w) => {
|
|
22279
|
+
const M = Object.fromEntries(Object.entries(b).filter(([v]) => !["at", "to", "through", "toward"].includes(v))), E = uS(t, e, [M], { start: { ...r, turn: 1 }, scale: 100, style: s.style, exaggeration: s.exaggeration });
|
|
22278
22280
|
for (const v of E.tracks) {
|
|
22279
22281
|
if (r4.includes(v.property)) continue;
|
|
22280
22282
|
const S = v.keyframes ?? [], x = r[v.property];
|
|
22281
22283
|
if (!S.every((T) => T.value === x)) {
|
|
22282
|
-
u(v.property,
|
|
22283
|
-
for (const T of S) T.time > 0 && c.get(v.property).push({ ...T, time:
|
|
22284
|
+
u(v.property, w, x);
|
|
22285
|
+
for (const T of S) T.time > 0 && c.get(v.property).push({ ...T, time: w + T.time });
|
|
22284
22286
|
r[v.property] = S[S.length - 1].value;
|
|
22285
22287
|
}
|
|
22286
22288
|
}
|
|
22287
|
-
return
|
|
22289
|
+
return w + E.duration;
|
|
22288
22290
|
}, g = [];
|
|
22289
22291
|
let m = 0;
|
|
22290
|
-
for (const
|
|
22291
|
-
const
|
|
22292
|
-
let M =
|
|
22293
|
-
const E = e.moves?.[
|
|
22294
|
-
E ? M = f(E,
|
|
22292
|
+
for (const b of n) {
|
|
22293
|
+
const w = b.at ?? m;
|
|
22294
|
+
let M = w;
|
|
22295
|
+
const E = e.moves?.[b.do];
|
|
22296
|
+
E ? M = f(E, b, w) : b.do === "face" ? M = d(w, typeof b.toward == "number" ? b.toward : fs([i, a], b.toward)) : b.do === "hold" ? M = w + (b.for ?? 1e3) : M = p(b, w), g.push({ do: b.do, start: w, end: M }), m = M;
|
|
22295
22297
|
}
|
|
22296
22298
|
const y = `${s.scene}/${t}`;
|
|
22297
|
-
return { tracks: [...c].map(([
|
|
22298
|
-
id: `${t}-${
|
|
22299
|
+
return { tracks: [...c].map(([b, w]) => ({
|
|
22300
|
+
id: `${t}-${b}`,
|
|
22299
22301
|
target: y,
|
|
22300
|
-
property:
|
|
22301
|
-
keyframes: Hg(
|
|
22302
|
+
property: b,
|
|
22303
|
+
keyframes: Hg(w)
|
|
22302
22304
|
})), duration: m, beats: g, end: { position: [i, a], heading: l, values: { ...r } } };
|
|
22303
22305
|
}
|
|
22304
22306
|
const r4 = ["x", "y", "turn", "facing", "tilt"], i4 = 0.35, Pp = {
|
|
@@ -22341,12 +22343,12 @@ function S8(t) {
|
|
|
22341
22343
|
const y = n.getStateAtTime(m).values.get(e) ?? /* @__PURE__ */ new Map(), k = (C, F) => {
|
|
22342
22344
|
const q = y.get(C);
|
|
22343
22345
|
return typeof q == "number" ? q : F;
|
|
22344
|
-
},
|
|
22345
|
-
for (const C of Object.keys(a.controls))
|
|
22346
|
-
for (const C of ["pitch", "roll", "squash", "lift", "lean", "size"])
|
|
22347
|
-
const
|
|
22348
|
-
if (!
|
|
22349
|
-
const M = k("rotateY", s.heading ?? 0), E = Uu(
|
|
22346
|
+
}, b = { ...s.values };
|
|
22347
|
+
for (const C of Object.keys(a.controls)) b[C] = k(C, s.values?.[C] ?? Ot(a, {}, C));
|
|
22348
|
+
for (const C of ["pitch", "roll", "squash", "lift", "lean", "size"]) b[C] = k(C, s.values?.[C] ?? Ot(a, {}, C));
|
|
22349
|
+
const w = Qx(a, b)[t.anchor];
|
|
22350
|
+
if (!w) throw new Error(`propRide3D: ${t.prop.kind} has no anchor "${t.anchor}" (it has ${Object.keys(a.anchors ?? {}).join(", ") || "none"})`);
|
|
22351
|
+
const M = k("rotateY", s.heading ?? 0), E = Uu(w, M), v = [k("x", o) + E[0], k("y", r) + E[1], k("z", i) + E[2]], S = M + u, x = Uu(h, S);
|
|
22350
22352
|
let T = [v[0] - x[0], v[1] - x[1], v[2] - x[2]];
|
|
22351
22353
|
const A = (C, F) => {
|
|
22352
22354
|
const q = F * F * (3 - 2 * F);
|
|
@@ -22409,7 +22411,7 @@ function p4(t) {
|
|
|
22409
22411
|
wind: t.wind ?? 0,
|
|
22410
22412
|
rain: t.rain ?? 0,
|
|
22411
22413
|
snow: t.snow ?? 0
|
|
22412
|
-
},
|
|
22414
|
+
}, b = Ao(), w = (T, A) => b.keys(T)?.length ? b.valueAt(T, A) : k[T], M = (T, A) => {
|
|
22413
22415
|
const P = u4(T, A), I = P < 0 ? 0.5 : P, C = i - n;
|
|
22414
22416
|
return { x: 0.1 * s + 0.8 * s * I, y: P < 0 ? C + o * 0.2 : C - Math.sin(I * Math.PI) * C * 0.8, up: P >= 0 };
|
|
22415
22417
|
}, E = (T, A, P, I, C) => {
|
|
@@ -22511,7 +22513,7 @@ function p4(t) {
|
|
|
22511
22513
|
},
|
|
22512
22514
|
ground: i,
|
|
22513
22515
|
anchor(T, A = 1 / 0) {
|
|
22514
|
-
const P =
|
|
22516
|
+
const P = w("hour", A);
|
|
22515
22517
|
if (T === "sun" || T === "moon") {
|
|
22516
22518
|
const I = M(P, T === "sun" ? 6 : 18);
|
|
22517
22519
|
return { x: e + I.x, y: n + I.y };
|
|
@@ -22523,9 +22525,9 @@ function p4(t) {
|
|
|
22523
22525
|
set(T, A) {
|
|
22524
22526
|
if (!(T in k)) throw new Error(`scenery: ${ut("value", T, Object.keys(k))}`);
|
|
22525
22527
|
if (typeof A.value != "number" || !Number.isFinite(A.value)) throw new Error("scenery.set needs `value`, a number");
|
|
22526
|
-
return
|
|
22528
|
+
return b.tween(T, w(T, A.at), A.value, A, 1e3), x;
|
|
22527
22529
|
},
|
|
22528
|
-
tracks:
|
|
22530
|
+
tracks: b.tracks
|
|
22529
22531
|
};
|
|
22530
22532
|
return x;
|
|
22531
22533
|
}
|