@algorisys/tinyfly 0.90.0 → 0.92.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 +5 -5
- package/lib/addons/adapters.js +179 -205
- package/lib/addons/camera-C7bZOWMB.js +33 -0
- package/lib/addons/characters.js +1410 -1290
- package/lib/browser/tinyfly.iife.js +4 -4
- package/lib/browser/tinyfly.js +2716 -2593
- package/lib/browser/tinyfly.umd.js +4 -4
- package/lib/cli/tools.js +16 -0
- package/lib/embed/tinyfly-embed.iife.js +4 -4
- package/lib/embed/tinyfly-embed.js +216 -203
- package/lib/engine/tinyfly-engine.js +287 -278
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/player/tinyfly-player.es.js +183 -170
- package/lib/player/tinyfly-player.iife.js +2 -2
- package/lib/player/tinyfly-player.umd.js +2 -2
- package/lib/types/characters/acting/script.d.ts +12 -1
- package/lib/types/characters/index.d.ts +2 -0
- package/lib/types/characters/species/human-motion.d.ts +45 -0
- package/lib/types/characters/species/human.d.ts +2 -0
- package/lib/types/engine/core/timeline.d.ts +3 -0
- package/lib/types/engine/types.d.ts +6 -0
- package/package.json +1 -1
package/lib/addons/characters.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { a as
|
|
3
|
-
import { createRandom as
|
|
4
|
-
import { f as
|
|
5
|
-
|
|
1
|
+
import { c as ho, s as mt, p as vn, b as xt } from "./sketch-CYPUbk3Q.js";
|
|
2
|
+
import { a as gl } from "./sketch-CYPUbk3Q.js";
|
|
3
|
+
import { createRandom as co, hashSeed as tt, getEasingFunction as nt, mat4 as U, vec3 as Q, quat as Yt, Timeline as fo } from "@algorisys/tinyfly";
|
|
4
|
+
import { f as Ct, h as uo, a as go } from "./load-scene-CQvcFWGJ.js";
|
|
5
|
+
import { I as ml, a as bl, c as wl, b as yl } from "./camera-C7bZOWMB.js";
|
|
6
|
+
function qe(e, t, n) {
|
|
6
7
|
const s = e.length;
|
|
7
8
|
if (s < 2) return [];
|
|
8
9
|
const o = [], r = [], l = (i) => t + (n - t) * i / (s - 1);
|
|
9
10
|
return e.forEach((i, a) => {
|
|
10
|
-
const h = e[Math.max(0, a - 1)], c = e[Math.min(s - 1, a + 1)], u = Math.hypot(c.x - h.x, c.y - h.y) || 1,
|
|
11
|
+
const h = e[Math.max(0, a - 1)], c = e[Math.min(s - 1, a + 1)], u = Math.hypot(c.x - h.x, c.y - h.y) || 1, d = l(a) / 2, f = -(c.y - h.y) / u * d, p = (c.x - h.x) / u * d;
|
|
11
12
|
o.push({ x: i.x + f, y: i.y + p }), r.push({ x: i.x - f, y: i.y - p });
|
|
12
13
|
}), [...o, ...r.reverse()];
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function Pt(e, t, n, s) {
|
|
15
16
|
const o = t.length;
|
|
16
17
|
if (o < 2) return;
|
|
17
|
-
const r =
|
|
18
|
+
const r = qe(t, n, s), l = (i) => n + (s - n) * i / (o - 1);
|
|
18
19
|
e.beginPath(), e.moveTo(r[0].x, r[0].y);
|
|
19
20
|
for (const i of r.slice(1)) e.lineTo(i.x, i.y);
|
|
20
21
|
e.closePath(), e.fill(), t.forEach((i, a) => {
|
|
21
22
|
a !== 0 && a !== o - 1 && o > 3 || (e.beginPath(), e.arc(i.x, i.y, l(a) / 2, 0, Math.PI * 2), e.fill());
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function He(e, t, n, s, o = 16) {
|
|
25
26
|
const r = { x: 2 * t.x - (e.x + n.x) / 2, y: 2 * t.y - (e.y + n.y) / 2 }, l = [];
|
|
26
27
|
for (let i = 0; i <= o; i++) {
|
|
27
28
|
const a = i / o, h = a < 0.5 ? { x: e.x + (t.x - e.x) * 2 * a, y: e.y + (t.y - e.y) * 2 * a } : { x: t.x + (n.x - t.x) * (2 * a - 1), y: t.y + (n.y - t.y) * (2 * a - 1) }, c = 1 - a, u = {
|
|
@@ -32,34 +33,34 @@ function ke(e, t, n, s, o = 16) {
|
|
|
32
33
|
}
|
|
33
34
|
return l;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function Dt(e, t, n, s, o, r = 0, l = 1, i = 40) {
|
|
36
37
|
const a = Math.cos(o), h = Math.sin(o);
|
|
37
38
|
return Array.from({ length: i + 1 }, (c, u) => {
|
|
38
|
-
const
|
|
39
|
+
const d = r + Math.PI * 2 * l * u / i, f = Math.cos(d) * n, p = Math.sin(d) * s;
|
|
39
40
|
return { x: e + f * a - p * h, y: t + f * h + p * a };
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
return t.look === "pencil" ?
|
|
43
|
+
function Tn(e, t) {
|
|
44
|
+
return t.look === "pencil" ? wo(e, t) : po(e, t.ink, t.look);
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function ze(e, t, n = !1) {
|
|
46
47
|
e.beginPath(), e.moveTo(t[0].x, t[0].y);
|
|
47
48
|
for (const s of t.slice(1)) e.lineTo(s.x, s.y);
|
|
48
49
|
n && e.closePath();
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function po(e, t, n) {
|
|
51
52
|
const s = n === "silhouette", o = s ? 1.25 : 1;
|
|
52
53
|
return {
|
|
53
54
|
look: n,
|
|
54
55
|
ink: t,
|
|
55
56
|
limb(r, l, i) {
|
|
56
|
-
e.fillStyle = t,
|
|
57
|
+
e.fillStyle = t, Pt(e, r, l * o, i * o);
|
|
57
58
|
},
|
|
58
59
|
line(r, l) {
|
|
59
|
-
r.length < 2 || (e.strokeStyle = t, e.lineWidth = l * o, e.lineCap = "round", e.lineJoin = "round",
|
|
60
|
+
r.length < 2 || (e.strokeStyle = t, e.lineWidth = l * o, e.lineCap = "round", e.lineJoin = "round", ze(e, r), e.stroke());
|
|
60
61
|
},
|
|
61
62
|
shape(r, l, i) {
|
|
62
|
-
|
|
63
|
+
ze(e, r, !0), (l !== null || s) && (e.fillStyle = s ? t : l, e.fill()), !(i <= 0) && (e.strokeStyle = t, e.lineWidth = i * o, e.lineJoin = "round", e.stroke());
|
|
63
64
|
},
|
|
64
65
|
ellipse(r, l, i, a, h, c, u) {
|
|
65
66
|
e.beginPath(), e.ellipse(r, l, i, a, h, 0, Math.PI * 2), (c !== null || s) && (e.fillStyle = s ? t : c, e.fill()), !(u <= 0) && (e.strokeStyle = t, e.lineWidth = u * o, e.stroke());
|
|
@@ -73,7 +74,7 @@ function io(e, t, n) {
|
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
+
function mo(e, t) {
|
|
77
78
|
const n = [e[0]];
|
|
78
79
|
let s = 0;
|
|
79
80
|
for (let l = 1; l < e.length; l++) {
|
|
@@ -88,14 +89,14 @@ function lo(e, t) {
|
|
|
88
89
|
const o = e[e.length - 1], r = n[n.length - 1];
|
|
89
90
|
return Math.hypot(o.x - r.x, o.y - r.y) > t * 0.25 ? n.push(o) : n[n.length - 1] = o, n;
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function bo(e, t) {
|
|
92
93
|
const n = e.length;
|
|
93
94
|
return e.map((s, o) => {
|
|
94
95
|
const r = e[Math.max(0, o - 1)], l = e[Math.min(n - 1, o + 1)], i = Math.hypot(l.x - r.x, l.y - r.y) || 1, a = t(n === 1 ? 0 : o / (n - 1));
|
|
95
96
|
return { x: s.x - (l.y - r.y) / i * a, y: s.y + (l.x - r.x) / i * a };
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
+
function Xt(e) {
|
|
99
100
|
const t = [0.6, 1.4, 2.9].map((s) => ({
|
|
100
101
|
frequency: s * (0.8 + e.next() * 0.4),
|
|
101
102
|
phase: e.next() * Math.PI * 2,
|
|
@@ -103,71 +104,71 @@ function Nt(e) {
|
|
|
103
104
|
})), n = t.reduce((s, o) => s + o.amount, 0);
|
|
104
105
|
return (s) => t.reduce((o, r) => o + r.amount * Math.sin(Math.PI * 2 * r.frequency * s + r.phase), 0) / n;
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
-
const n = t.pencil ?? {}, s = t.ink, o = n.roughness ?? Math.max(1, t.lineWidth * 0.12), r = Math.max(1, Math.round(n.passes ?? 2)), l = Math.min(1, Math.max(0, n.pressure ?? 0.25)), i = Math.min(1, Math.max(0, n.rubbedOut ?? 0.15)), a =
|
|
107
|
+
function wo(e, t) {
|
|
108
|
+
const n = t.pencil ?? {}, s = t.ink, o = n.roughness ?? Math.max(1, t.lineWidth * 0.12), r = Math.max(1, Math.round(n.passes ?? 2)), l = Math.min(1, Math.max(0, n.pressure ?? 0.25)), i = Math.min(1, Math.max(0, n.rubbedOut ?? 0.15)), a = ho(t.time, n.boil ?? 8);
|
|
108
109
|
let h = 0;
|
|
109
|
-
const c = (p,
|
|
110
|
+
const c = (p, g, m = !1) => co(tt(`${t.seed}:${m ? "paper" : a}:${p}:${g}`)), u = (p, g, m, b, S, k = 0) => {
|
|
110
111
|
if (p.length < 2) return;
|
|
111
|
-
const
|
|
112
|
-
let
|
|
113
|
-
if (
|
|
114
|
-
const [
|
|
115
|
-
|
|
112
|
+
const v = p.slice(1).reduce((x, E, P) => x + Math.hypot(E.x - p[P].x, E.y - p[P].y), 0);
|
|
113
|
+
let H = mo(p, Math.max(1.5, Math.min(t.lineWidth * 0.8, v / 24)));
|
|
114
|
+
if (k > 0 && H.length >= 2) {
|
|
115
|
+
const [x, E] = [H[H.length - 2], H[H.length - 1]], P = Math.hypot(E.x - x.x, E.y - x.y) || 1;
|
|
116
|
+
H = [...H, { x: E.x + (E.x - x.x) / P * k, y: E.y + (E.y - x.y) / P * k }];
|
|
116
117
|
}
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
}), e.save(), e.globalAlpha *= b, e.fillStyle = s,
|
|
122
|
-
},
|
|
118
|
+
const T = Xt(m), M = Xt(m), w = H.length, y = [], A = [];
|
|
119
|
+
H.forEach((x, E) => {
|
|
120
|
+
const P = w === 1 ? 0 : E / (w - 1), K = H[Math.max(0, E - 1)], _ = H[Math.min(w - 1, E + 1)], $ = Math.hypot(_.x - K.x, _.y - K.y) || 1, G = -(_.y - K.y) / $, W = (_.x - K.x) / $, I = T(P) * S, N = Math.min(1, P / 0.08, (1 - P) / 0.08), F = (0.55 + 0.45 * Math.sqrt(Math.max(0, N))) * (1 + l * M(P)), R = Math.max(0.3, g(P) * F / 2), z = x.x + G * I, se = x.y + W * I;
|
|
121
|
+
y.push({ x: z + G * R, y: se + W * R }), A.push({ x: z - G * R, y: se - W * R });
|
|
122
|
+
}), e.save(), e.globalAlpha *= b, e.fillStyle = s, ze(e, [...y, ...A.reverse()], !0), e.fill(), e.restore();
|
|
123
|
+
}, d = (p, g) => {
|
|
123
124
|
const m = h++, b = c(m, 99, !0);
|
|
124
125
|
if (b.next() < i) {
|
|
125
|
-
const
|
|
126
|
-
u(
|
|
126
|
+
const H = (b.next() * 2 - 1) * t.lineWidth * 1.4, T = (b.next() * 2 - 1) * t.lineWidth * 1.4, M = p.map((w) => ({ x: w.x + H, y: w.y + T }));
|
|
127
|
+
u(M, (w) => g(w) * 1.8, c(m, 98, !0), 0.035, o), u(M, (w) => g(w) * 0.45, c(m, 97, !0), 0.12, o * 1.5);
|
|
127
128
|
}
|
|
128
|
-
const
|
|
129
|
-
for (let
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
u(
|
|
129
|
+
const S = p.slice(1).reduce((H, T, M) => H + Math.hypot(T.x - p[M].x, T.y - p[M].y), 0), k = g(0.5) > 4 && S > g(0.5) * 6, v = k ? [-0.3, 0.3, 0] : [0];
|
|
130
|
+
for (let H = 0; H < r; H++) {
|
|
131
|
+
const T = H === 0;
|
|
132
|
+
v.forEach((M, w) => {
|
|
133
|
+
const y = c(m, H * 10 + w), A = M === 0 ? p : bo(p, (E) => g(E) * M * Math.sqrt(Math.sin(Math.PI * E))), x = !T && M === 0 ? t.lineWidth * (0.3 + y.next() * 0.8) : 0;
|
|
134
|
+
u(A, (E) => g(E) * (k ? 0.5 : 1) * (T ? 1 : 0.6), y, T ? 0.85 : 0.45, o * (T ? 0.6 : 1), x);
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
|
-
}, f = (p,
|
|
137
|
-
const
|
|
138
|
-
|
|
137
|
+
}, f = (p, g, m, b, S, k) => {
|
|
138
|
+
const H = c(h, 50).next() * Math.PI * 2;
|
|
139
|
+
d(Dt(p, g, m, b, S, H, 1.08, 48), () => k);
|
|
139
140
|
};
|
|
140
141
|
return {
|
|
141
142
|
look: "pencil",
|
|
142
143
|
ink: s,
|
|
143
|
-
limb(p,
|
|
144
|
-
|
|
144
|
+
limb(p, g, m) {
|
|
145
|
+
d(p, (b) => g + (m - g) * b);
|
|
145
146
|
},
|
|
146
|
-
line(p,
|
|
147
|
-
|
|
147
|
+
line(p, g) {
|
|
148
|
+
d(p, () => g);
|
|
148
149
|
},
|
|
149
|
-
shape(p,
|
|
150
|
-
|
|
150
|
+
shape(p, g, m) {
|
|
151
|
+
g !== null && (e.save(), e.globalAlpha *= 0.88, e.fillStyle = g, ze(e, p, !0), e.fill(), e.restore()), m > 0 && d([...p, p[0]], () => m);
|
|
151
152
|
},
|
|
152
|
-
ellipse(p,
|
|
153
|
-
|
|
153
|
+
ellipse(p, g, m, b, S, k, v) {
|
|
154
|
+
k !== null && (e.save(), e.globalAlpha *= 0.9, e.fillStyle = k, e.beginPath(), e.ellipse(p, g, m, b, S, 0, Math.PI * 2), e.fill(), e.restore()), f(p, g, m, b, S, v);
|
|
154
155
|
},
|
|
155
|
-
dot(p,
|
|
156
|
-
e.save(), e.globalAlpha *= 0.9, e.fillStyle = s, e.beginPath(), e.arc(p,
|
|
156
|
+
dot(p, g, m) {
|
|
157
|
+
e.save(), e.globalAlpha *= 0.9, e.fillStyle = s, e.beginPath(), e.arc(p, g, m, 0, Math.PI * 2), e.fill(), e.restore();
|
|
157
158
|
},
|
|
158
159
|
guide(p) {
|
|
159
160
|
if (n.construction === !1 || p.length < 2) return;
|
|
160
|
-
const
|
|
161
|
-
u(p, () => Math.max(0.6, t.lineWidth * 0.18), c(
|
|
161
|
+
const g = h++;
|
|
162
|
+
u(p, () => Math.max(0.6, t.lineWidth * 0.18), c(g, 0), 0.28, o * 1.2, t.lineWidth);
|
|
162
163
|
},
|
|
163
|
-
guideEllipse(p,
|
|
164
|
+
guideEllipse(p, g, m, b, S) {
|
|
164
165
|
if (n.construction === !1) return;
|
|
165
|
-
const
|
|
166
|
-
u(
|
|
166
|
+
const k = h++, v = c(k, 0), H = Dt(p, g, m, b, S, v.next() * Math.PI * 2, 1.12, 48);
|
|
167
|
+
u(H, () => Math.max(0.6, t.lineWidth * 0.18), v, 0.28, o * 1.5);
|
|
167
168
|
}
|
|
168
169
|
};
|
|
169
170
|
}
|
|
170
|
-
const
|
|
171
|
+
const yo = ["thumb", "index", "middle", "ring", "pinky"], Y = {
|
|
171
172
|
"thumb.curl": 0.15,
|
|
172
173
|
"thumb.across": 0.15,
|
|
173
174
|
"index.curl": 0.12,
|
|
@@ -180,35 +181,35 @@ const co = ["thumb", "index", "middle", "ring", "pinky"], L = {
|
|
|
180
181
|
tilt: 0,
|
|
181
182
|
roll: 0
|
|
182
183
|
};
|
|
183
|
-
function
|
|
184
|
-
return { ...
|
|
184
|
+
function L(e = {}) {
|
|
185
|
+
return { ...Y, ...e };
|
|
185
186
|
}
|
|
186
|
-
const
|
|
187
|
+
const J = (e, t, n, s, o) => ({
|
|
187
188
|
"thumb.curl": e,
|
|
188
189
|
"index.curl": t,
|
|
189
190
|
"middle.curl": n,
|
|
190
191
|
"ring.curl": s,
|
|
191
192
|
"pinky.curl": o
|
|
192
|
-
}),
|
|
193
|
-
relaxed:
|
|
194
|
-
open:
|
|
195
|
-
spread:
|
|
196
|
-
flat:
|
|
197
|
-
fist:
|
|
198
|
-
point:
|
|
193
|
+
}), q = {
|
|
194
|
+
relaxed: Y,
|
|
195
|
+
open: L({ ...J(0, 0, 0, 0, 0), "thumb.across": 0, spread: 0.55 }),
|
|
196
|
+
spread: L({ ...J(0, 0, 0, 0, 0), "thumb.across": 0, spread: 1 }),
|
|
197
|
+
flat: L({ ...J(0, 0, 0, 0, 0), "thumb.across": 0.35, spread: 0 }),
|
|
198
|
+
fist: L({ ...J(0.7, 1, 1, 1, 1), "thumb.across": 0.9, spread: 0 }),
|
|
199
|
+
point: L({ ...J(0.75, 0, 1, 1, 1), "thumb.across": 0.9, spread: 0 }),
|
|
199
200
|
/** The fist on its side, knuckles toward the viewer, the thumb up */
|
|
200
|
-
thumbsUp:
|
|
201
|
-
peace:
|
|
202
|
-
ok:
|
|
203
|
-
pinch:
|
|
204
|
-
cupped:
|
|
205
|
-
wave:
|
|
201
|
+
thumbsUp: L({ ...J(0, 1, 1, 1, 1), "thumb.across": 0, spread: 0, roll: 70 }),
|
|
202
|
+
peace: L({ ...J(0.75, 0, 0, 1, 1), "thumb.across": 0.9, spread: 1 }),
|
|
203
|
+
ok: L({ ...J(0.12, 0.6, 0.1, 0.15, 0.2), "thumb.across": 0.55, spread: 0.6 }),
|
|
204
|
+
pinch: L({ ...J(0.1, 0.65, 0.75, 0.85, 0.9), "thumb.across": 0.55, spread: 0 }),
|
|
205
|
+
cupped: L({ ...J(0.25, 0.4, 0.4, 0.4, 0.4), "thumb.across": 0.4, spread: 0.05, turn: 2 }),
|
|
206
|
+
wave: L({ ...J(0, 0.05, 0.05, 0.1, 0.12), "thumb.across": 0, spread: 0.7, turn: 2 }),
|
|
206
207
|
/** Holding a pencil to write: thumb and middle finger pinch it, the index finger rests on top */
|
|
207
|
-
pencilGrip:
|
|
208
|
+
pencilGrip: L({ ...J(0.1, 0.6, 0.72, 0.88, 0.95), "thumb.across": 0.5, spread: 0, turn: 0.8, bend: 10 }),
|
|
208
209
|
/** Holding a handle, a cup or a bar: every finger wrapped round it */
|
|
209
|
-
hold:
|
|
210
|
+
hold: L({ ...J(0.5, 0.7, 0.72, 0.74, 0.76), "thumb.across": 0.75, spread: 0, turn: 1 })
|
|
210
211
|
};
|
|
211
|
-
function
|
|
212
|
+
function Ie(e, t, n) {
|
|
212
213
|
const s = { ...e };
|
|
213
214
|
for (const [o, r] of Object.entries(t)) {
|
|
214
215
|
const l = e[o] ?? r;
|
|
@@ -216,23 +217,23 @@ function Ke(e, t, n) {
|
|
|
216
217
|
}
|
|
217
218
|
return s;
|
|
218
219
|
}
|
|
219
|
-
const
|
|
220
|
+
const ko = {
|
|
220
221
|
index: { knuckle: [-0.16, 0.47, -0.02], bones: [0.2, 0.125, 0.1], width: 0.125, fan: -1 },
|
|
221
222
|
middle: { knuckle: [-0.055, 0.49, -0.02], bones: [0.22, 0.135, 0.1], width: 0.13, fan: -0.2 },
|
|
222
223
|
ring: { knuckle: [0.05, 0.475, -0.02], bones: [0.2, 0.125, 0.1], width: 0.122, fan: 0.55 },
|
|
223
224
|
pinky: { knuckle: [0.15, 0.43, -0.02], bones: [0.16, 0.1, 0.085], width: 0.108, fan: 1.25 }
|
|
224
|
-
},
|
|
225
|
+
}, So = {
|
|
225
226
|
index: { knuckle: [-0.14, 0.47, -0.02], bones: [0.2, 0.125, 0.1], width: 0.15, fan: -1 },
|
|
226
227
|
middle: { knuckle: [0, 0.49, -0.02], bones: [0.22, 0.135, 0.1], width: 0.155, fan: 0 },
|
|
227
228
|
pinky: { knuckle: [0.14, 0.45, -0.02], bones: [0.19, 0.115, 0.095], width: 0.145, fan: 1 }
|
|
228
|
-
},
|
|
229
|
+
}, ie = {
|
|
229
230
|
base: [-0.11, 0.1, -0.05],
|
|
230
231
|
bones: [0.2, 0.15, 0.12],
|
|
231
232
|
widths: [0.2, 0.145, 0.135],
|
|
232
233
|
/** Where the thumb points with `across` 0 and 1 */
|
|
233
234
|
out: [-0.7, 0.68, -0.22],
|
|
234
235
|
across: [0.35, 0.5, -0.8]
|
|
235
|
-
},
|
|
236
|
+
}, Eo = [82, 100, 62], Mo = [48, 72], Ho = 3, vo = 13, To = 0.035, Ao = -0.075, xo = [
|
|
236
237
|
[-0.17, 0],
|
|
237
238
|
[-0.215, 0.12],
|
|
238
239
|
[-0.235, 0.26],
|
|
@@ -245,86 +246,86 @@ const fo = {
|
|
|
245
246
|
[0.225, 0.26],
|
|
246
247
|
[0.2, 0.1],
|
|
247
248
|
[0.16, 0]
|
|
248
|
-
],
|
|
249
|
+
], ce = (e) => e * Math.PI / 180, bt = (e, t) => [e[0] + t[0], e[1] + t[1], e[2] + t[2]], Ge = (e, t) => [e[0] * t, e[1] * t, e[2] * t], wt = (e, t) => [e[1] * t[2] - e[2] * t[1], e[2] * t[0] - e[0] * t[2], e[0] * t[1] - e[1] * t[0]], Te = (e) => {
|
|
249
250
|
const t = Math.hypot(e[0], e[1], e[2]) || 1;
|
|
250
251
|
return [e[0] / t, e[1] / t, e[2] / t];
|
|
251
252
|
};
|
|
252
|
-
function
|
|
253
|
-
const s = Math.cos(n), o = Math.sin(n), r =
|
|
253
|
+
function pe(e, t, n) {
|
|
254
|
+
const s = Math.cos(n), o = Math.sin(n), r = wt(t, e), l = t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
|
|
254
255
|
return [
|
|
255
256
|
e[0] * s + r[0] * o + t[0] * l * (1 - s),
|
|
256
257
|
e[1] * s + r[1] * o + t[1] * l * (1 - s),
|
|
257
258
|
e[2] * s + r[2] * o + t[2] * l * (1 - s)
|
|
258
259
|
];
|
|
259
260
|
}
|
|
260
|
-
const
|
|
261
|
-
function
|
|
262
|
-
const s =
|
|
261
|
+
const qt = [1, 0, 0], Gt = [0, 1, 0], Ke = [0, 0, 1];
|
|
262
|
+
function Po(e, t, n) {
|
|
263
|
+
const s = ce(e.fan * (Ho + vo * n)), o = [Math.sin(s), Math.cos(s), 0], r = [Math.cos(s), -Math.sin(s), 0], l = [e.knuckle];
|
|
263
264
|
let i = 0;
|
|
264
265
|
e.bones.forEach((c, u) => {
|
|
265
|
-
i +=
|
|
266
|
+
i += ce(Eo[u] * t), l.push(bt(l[u], Ge(pe(o, r, -i), c)));
|
|
266
267
|
});
|
|
267
|
-
const a =
|
|
268
|
+
const a = pe(Ke, r, -i), h = l.map((c, u) => e.width * (1 - 0.14 * (u / (l.length - 1))));
|
|
268
269
|
return { joints: l, back: a, widths: h };
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
-
const o = Math.min(1, Math.max(0, t)), r =
|
|
271
|
+
function Ko(e, t, n = 1, s = 1) {
|
|
272
|
+
const o = Math.min(1, Math.max(0, t)), r = Te(bt(Ge(Te(ie.out), 1 - o), Ge(Te(ie.across), o))), l = Te(wt(Ke, r)), i = Te(wt(r, l)), a = [[ie.base[0] * s, ie.base[1], ie.base[2]]];
|
|
272
273
|
let h = 0;
|
|
273
|
-
|
|
274
|
-
f > 0 && (h +=
|
|
274
|
+
ie.bones.forEach((d, f) => {
|
|
275
|
+
f > 0 && (h += ce(Mo[f - 1] * e)), a.push(bt(a[f], Ge(pe(r, l, h), d)));
|
|
275
276
|
});
|
|
276
|
-
const c =
|
|
277
|
+
const c = pe(i, l, h), u = [...ie.widths, ie.widths[ie.widths.length - 1] * 0.92].map((d) => d * n);
|
|
277
278
|
return { joints: a, back: c, widths: u };
|
|
278
279
|
}
|
|
279
|
-
function
|
|
280
|
-
const n = { ...
|
|
281
|
-
...
|
|
282
|
-
knuckle: [
|
|
283
|
-
width:
|
|
284
|
-
}), u =
|
|
285
|
-
const
|
|
286
|
-
return { x:
|
|
287
|
-
},
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
},
|
|
291
|
-
thumb:
|
|
292
|
-
},
|
|
293
|
-
for (const
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
const
|
|
298
|
-
for (const [
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
points:
|
|
302
|
-
depths:
|
|
303
|
-
widths:
|
|
304
|
-
nail:
|
|
305
|
-
back:
|
|
280
|
+
function yt(e, t = {}) {
|
|
281
|
+
const n = { ...Y, ...e }, s = t.size ?? 100, o = t.side ?? "right", r = o === "left" ? -1 : 1, l = ce(t.angle ?? 0), i = t.fingers === 4, a = Math.max(0.5, t.plump ?? 1), h = 1 + (a - 1) * 0.7, c = (E) => ({
|
|
282
|
+
...E,
|
|
283
|
+
knuckle: [E.knuckle[0] * h, E.knuckle[1], E.knuckle[2]],
|
|
284
|
+
width: E.width * a
|
|
285
|
+
}), u = ce(n.bend ?? 0), d = ce(n.tilt ?? 0), f = ce(90 * (n.turn ?? 0)), p = (E) => pe(pe(pe(E, qt, -u), Ke, -d), Gt, f), g = Math.cos(l), m = Math.sin(l), b = ce(n.roll ?? 0), S = Math.cos(b), k = Math.sin(b), v = (E) => {
|
|
286
|
+
const P = E[0] * s, K = -E[1] * s, _ = (P * S - K * k) * r, $ = P * k + K * S;
|
|
287
|
+
return { x: _ * g - $ * m, y: _ * m + $ * g };
|
|
288
|
+
}, H = (E) => {
|
|
289
|
+
const P = v(E), K = Math.hypot(P.x, P.y);
|
|
290
|
+
return K > 1e-6 * s ? { x: P.x / K, y: P.y / K } : { x: 0, y: 0 };
|
|
291
|
+
}, T = {
|
|
292
|
+
thumb: Ko(n["thumb.curl"] ?? 0, n["thumb.across"] ?? 0, a, h)
|
|
293
|
+
}, M = i ? So : ko;
|
|
294
|
+
for (const E of yo) {
|
|
295
|
+
const P = M[E];
|
|
296
|
+
P && (T[E] = Po(c(P), n[`${E}.curl`] ?? 0, n.spread ?? 0));
|
|
297
|
+
}
|
|
298
|
+
const w = {};
|
|
299
|
+
for (const [E, P] of Object.entries(T)) {
|
|
300
|
+
const K = P.joints.map(p), _ = p(P.back);
|
|
301
|
+
w[E] = {
|
|
302
|
+
points: K.map(v),
|
|
303
|
+
depths: K.map(($) => $[2] * s),
|
|
304
|
+
widths: P.widths.map(($) => $ * s),
|
|
305
|
+
nail: _[2],
|
|
306
|
+
back: H(_)
|
|
306
307
|
};
|
|
307
308
|
}
|
|
308
|
-
const
|
|
309
|
+
const y = xo.flatMap(([E, P]) => [p([E * h, P, To]), p([E * h, P, Ao])]), A = Oo(y.map(v)), x = y.reduce((E, P) => E + P[2], 0) / y.length * s;
|
|
309
310
|
return {
|
|
310
311
|
size: s,
|
|
311
312
|
side: o,
|
|
312
313
|
wrist: { x: 0, y: 0 },
|
|
313
|
-
palm:
|
|
314
|
-
palmDepth:
|
|
315
|
-
palmFacing: -p(
|
|
316
|
-
fingers:
|
|
317
|
-
axes: { up:
|
|
318
|
-
curls: Object.fromEntries(Object.keys(
|
|
314
|
+
palm: A,
|
|
315
|
+
palmDepth: x,
|
|
316
|
+
palmFacing: -p(Ke)[2],
|
|
317
|
+
fingers: w,
|
|
318
|
+
axes: { up: H(p(Gt)), across: H(p(qt)), out: H(p(Ke)) },
|
|
319
|
+
curls: Object.fromEntries(Object.keys(w).map((E) => [E, n[`${E}.curl`] ?? 0]))
|
|
319
320
|
};
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
+
function Wo(e, t) {
|
|
322
323
|
const n = (o) => ({ x: o.x + t.x - e.wrist.x, y: o.y + t.y - e.wrist.y }), s = {};
|
|
323
324
|
for (const [o, r] of Object.entries(e.fingers))
|
|
324
325
|
s[o] = { ...r, points: r.points.map(n) };
|
|
325
326
|
return { ...e, wrist: n(e.wrist), palm: e.palm.map(n), fingers: s };
|
|
326
327
|
}
|
|
327
|
-
function
|
|
328
|
+
function Oo(e) {
|
|
328
329
|
const t = [...e].sort((r, l) => r.x - l.x || r.y - l.y);
|
|
329
330
|
if (t.length < 3) return t;
|
|
330
331
|
const n = (r, l, i) => (l.x - r.x) * (i.y - r.y) - (l.y - r.y) * (i.x - r.x), s = [];
|
|
@@ -339,47 +340,47 @@ function Ho(e) {
|
|
|
339
340
|
}
|
|
340
341
|
return [...s.slice(0, -1), ...o.slice(0, -1)];
|
|
341
342
|
}
|
|
342
|
-
const
|
|
343
|
-
function
|
|
344
|
-
const r =
|
|
343
|
+
const Io = "#f1c9a5", _o = "#2f2f33";
|
|
344
|
+
function Kt(e, t, n, s = {}, o = 0) {
|
|
345
|
+
const r = Wo(yt(n, s), t), l = s.ink ?? _o, i = s.lineWidth ?? r.size * 0.035, a = s.pen ?? Tn(e, {
|
|
345
346
|
look: s.look ?? "clean",
|
|
346
347
|
ink: l,
|
|
347
348
|
lineWidth: i,
|
|
348
349
|
seed: s.seed ?? 1,
|
|
349
350
|
time: o,
|
|
350
351
|
pencil: { construction: !1, ...s.pencil }
|
|
351
|
-
}), h = s.skin ??
|
|
352
|
+
}), h = s.skin ?? Io, c = s.nails ?? !0, u = [
|
|
352
353
|
{
|
|
353
354
|
depth: r.palmDepth,
|
|
354
|
-
draw: () =>
|
|
355
|
+
draw: () => $o(a, r, h, i)
|
|
355
356
|
}
|
|
356
357
|
];
|
|
357
|
-
for (const
|
|
358
|
-
const f =
|
|
358
|
+
for (const d of Object.values(r.fingers)) {
|
|
359
|
+
const f = d.depths.reduce((p, g) => p + g, 0) / d.depths.length;
|
|
359
360
|
u.push({
|
|
360
361
|
depth: f,
|
|
361
|
-
draw: () =>
|
|
362
|
+
draw: () => Bo(e, a, d, h, i, c)
|
|
362
363
|
});
|
|
363
364
|
}
|
|
364
365
|
if (s.prop) {
|
|
365
|
-
const
|
|
366
|
-
u.push({ depth:
|
|
366
|
+
const d = s.prop;
|
|
367
|
+
u.push({ depth: d.depth, draw: () => d.draw(a) });
|
|
367
368
|
}
|
|
368
369
|
e.save(), e.lineCap = "round", e.lineJoin = "round";
|
|
369
|
-
for (const
|
|
370
|
+
for (const d of [...u].sort((f, p) => f.depth - p.depth)) d.draw();
|
|
370
371
|
return e.restore(), r;
|
|
371
372
|
}
|
|
372
|
-
function
|
|
373
|
+
function $o(e, t, n, s) {
|
|
373
374
|
if (e.shape(t.palm, n, s), t.palmFacing < -0.3 && e.look !== "silhouette") {
|
|
374
375
|
const { up: o } = t.axes;
|
|
375
376
|
for (const [r, l] of Object.entries(t.fingers)) {
|
|
376
377
|
const i = t.curls[r] ?? 0;
|
|
377
378
|
if (r === "thumb" || i < 0.5) continue;
|
|
378
|
-
const a = l.points[0], h = l.widths[0] * 0.42, c = { x: a.x - o.x * h * 0.2, y: a.y - o.y * h * 0.2 }, u = Math.atan2(o.y, o.x),
|
|
379
|
-
const
|
|
380
|
-
return { x: c.x + Math.cos(
|
|
379
|
+
const a = l.points[0], h = l.widths[0] * 0.42, c = { x: a.x - o.x * h * 0.2, y: a.y - o.y * h * 0.2 }, u = Math.atan2(o.y, o.x), d = Array.from({ length: 7 }, (f, p) => {
|
|
380
|
+
const g = u - Math.PI / 2 + Math.PI * p / 6;
|
|
381
|
+
return { x: c.x + Math.cos(g) * h, y: c.y + Math.sin(g) * h };
|
|
381
382
|
});
|
|
382
|
-
e.line(
|
|
383
|
+
e.line(d, s * 0.6);
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
386
|
if (t.palmFacing > 0.45 && e.look !== "silhouette") {
|
|
@@ -390,15 +391,15 @@ function Ao(e, t, n, s) {
|
|
|
390
391
|
e.line([a(-0.15 * h, 0.36), a(-0.04 * h, 0.3), a(0.1 * h, 0.33)], s * 0.5);
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
|
-
function
|
|
394
|
-
const { widths: l } = n, i =
|
|
394
|
+
function Bo(e, t, n, s, o, r) {
|
|
395
|
+
const { widths: l } = n, i = Fo(n.points, 2), a = n.points[0], h = i[i.length - 1], c = l[0], u = l[l.length - 1];
|
|
395
396
|
if (e.save(), t.look !== "silhouette") {
|
|
396
397
|
e.beginPath(), e.rect(a.x - 1e5, a.y - 1e5, 2e5, 2e5);
|
|
397
|
-
const
|
|
398
|
-
e.moveTo(a.x +
|
|
398
|
+
const g = c / 2 + o * 1.6;
|
|
399
|
+
e.moveTo(a.x + g, a.y), e.arc(a.x, a.y, g, 0, Math.PI * 2), e.clip("evenodd");
|
|
399
400
|
}
|
|
400
|
-
if (t.limb(i, c + 2 * o, u + 2 * o), e.restore(), t.look !== "silhouette" && (e.fillStyle = s,
|
|
401
|
-
const
|
|
401
|
+
if (t.limb(i, c + 2 * o, u + 2 * o), e.restore(), t.look !== "silhouette" && (e.fillStyle = s, Pt(e, i, c, u)), t.look === "silhouette" || !r || n.nail < 0.25) return;
|
|
402
|
+
const d = i[i.length - 2], f = Ro({ x: h.x - d.x, y: h.y - d.y }) ?? {
|
|
402
403
|
x: 0,
|
|
403
404
|
y: -1
|
|
404
405
|
}, p = {
|
|
@@ -407,7 +408,7 @@ function xo(e, t, n, s, o, r) {
|
|
|
407
408
|
};
|
|
408
409
|
t.ellipse(p.x, p.y, u * 0.24 * Math.max(0.35, n.nail), u * 0.19, Math.atan2(f.y, f.x), "#f8e3d3", o * 0.45);
|
|
409
410
|
}
|
|
410
|
-
function
|
|
411
|
+
function Fo(e, t) {
|
|
411
412
|
let n = e;
|
|
412
413
|
for (let s = 0; s < t; s++) {
|
|
413
414
|
if (n.length < 3) return n;
|
|
@@ -420,10 +421,10 @@ function Ko(e, t) {
|
|
|
420
421
|
}
|
|
421
422
|
return n;
|
|
422
423
|
}
|
|
423
|
-
const
|
|
424
|
+
const Ro = (e) => {
|
|
424
425
|
const t = Math.hypot(e.x, e.y);
|
|
425
426
|
return t > 1e-6 ? { x: e.x / t, y: e.y / t } : null;
|
|
426
|
-
},
|
|
427
|
+
}, Ee = {
|
|
427
428
|
walk: { swing: 24, knee: 30, arm: 22, elbow: 28, lean: 4 },
|
|
428
429
|
bouncy: { swing: 26, knee: 45, arm: 34, elbow: 30, lean: 2, bend: -4, bounce: 0.035, squash: 0.06 },
|
|
429
430
|
doubleBounce: { swing: 22, knee: 40, arm: 26, elbow: 24, lean: 3, bounce: 0.02, bounces: 2, squash: 0.04 },
|
|
@@ -431,20 +432,20 @@ const Po = (e) => {
|
|
|
431
432
|
strut: { swing: 26, knee: 30, arm: 30, elbow: 20, lean: -4, bend: -10, headTilt: -6, sway: 4, bounce: 0.01 },
|
|
432
433
|
tired: { swing: 14, knee: 14, arm: 6, elbow: 6, lean: 10, bend: 16, headTilt: 12 },
|
|
433
434
|
run: { swing: 40, knee: 95, arm: 45, elbow: 0, forearm: 90, lean: 16, bend: 6, bounce: 0.05, squash: 0.06 }
|
|
434
|
-
},
|
|
435
|
-
function
|
|
436
|
-
return e === void 0 ?
|
|
437
|
-
}
|
|
438
|
-
function
|
|
439
|
-
const o =
|
|
440
|
-
if (o ===
|
|
441
|
-
const r = t * Math.PI * 2, l = Math.sin(r) * s, i = Math.cos(r) * s, a = (b) => b <=
|
|
435
|
+
}, No = 40;
|
|
436
|
+
function ot(e) {
|
|
437
|
+
return e === void 0 ? Ee.walk : typeof e == "string" ? Ee[e] ?? Ee.walk : e;
|
|
438
|
+
}
|
|
439
|
+
function Lo(e, t, n = B, s = 1) {
|
|
440
|
+
const o = ot(e);
|
|
441
|
+
if (o === Ee.walk) return Do(t, n, s);
|
|
442
|
+
const r = t * Math.PI * 2, l = Math.sin(r) * s, i = Math.cos(r) * s, a = (b) => b <= No, h = o.shoulder ?? 0, c = (b, S) => a(b) ? S * h + o.arm * l : b, u = o.forearm ?? 0, d = a(n.leftShoulder) ? n.leftElbow - u - o.elbow * Math.max(0, -l) : n.leftElbow, f = a(n.rightShoulder) ? n.rightElbow + u + o.elbow * Math.max(0, l) : n.rightElbow, p = o.bounces ?? 1, g = (1 + Math.cos(r * 2 * p)) / 2, m = o.crouch ?? 0;
|
|
442
443
|
return {
|
|
443
444
|
...n,
|
|
444
445
|
lean: n.lean + o.lean * s + (o.sway ?? 0) * Math.sin(r) * (1 - (n.turn ?? 0)),
|
|
445
446
|
bend: (n.bend ?? 0) + (o.bend ?? 0),
|
|
446
447
|
headTilt: n.headTilt - o.lean * 0.5 * s + (o.headTilt ?? 0),
|
|
447
|
-
leftElbow:
|
|
448
|
+
leftElbow: d,
|
|
448
449
|
rightElbow: f,
|
|
449
450
|
// A crouch brings both thighs forward and folds both shins back.
|
|
450
451
|
leftHip: -o.swing * l - m * 0.5,
|
|
@@ -457,15 +458,15 @@ function Oo(e, t, n = _, s = 1) {
|
|
|
457
458
|
rightAnkle: (n.rightAnkle ?? 0) + (o.tiptoe ?? 0),
|
|
458
459
|
leftShoulder: c(n.leftShoulder, -1),
|
|
459
460
|
rightShoulder: c(n.rightShoulder, 1),
|
|
460
|
-
rise: (n.rise ?? 0) + (o.bounce ?? 0) * s *
|
|
461
|
-
stretch: n.stretch * (1 + (o.squash ?? 0) * (
|
|
461
|
+
rise: (n.rise ?? 0) + (o.bounce ?? 0) * s * g,
|
|
462
|
+
stretch: n.stretch * (1 + (o.squash ?? 0) * (g - 0.5))
|
|
462
463
|
};
|
|
463
464
|
}
|
|
464
|
-
function
|
|
465
|
-
const s =
|
|
466
|
-
return
|
|
465
|
+
function Yo(e, t, n = 1) {
|
|
466
|
+
const s = ot(e), o = Ee.walk.swing, r = (l) => Math.sin(l * Math.PI / 180);
|
|
467
|
+
return Xo(t, n) * r(s.swing * n) / r(o * n);
|
|
467
468
|
}
|
|
468
|
-
const
|
|
469
|
+
const B = {
|
|
469
470
|
lean: 0,
|
|
470
471
|
bend: 0,
|
|
471
472
|
headTilt: 0,
|
|
@@ -500,10 +501,10 @@ const _ = {
|
|
|
500
501
|
spin: 0,
|
|
501
502
|
rise: 0
|
|
502
503
|
};
|
|
503
|
-
function
|
|
504
|
-
return { ...
|
|
504
|
+
function V(e) {
|
|
505
|
+
return { ...B, ...e };
|
|
505
506
|
}
|
|
506
|
-
const
|
|
507
|
+
const An = {
|
|
507
508
|
mouth: 0,
|
|
508
509
|
smile: 0,
|
|
509
510
|
mouthWidth: 1,
|
|
@@ -514,70 +515,70 @@ const yn = {
|
|
|
514
515
|
browTilt: 0,
|
|
515
516
|
lookX: 0,
|
|
516
517
|
lookY: 0
|
|
517
|
-
},
|
|
518
|
-
neutral:
|
|
519
|
-
happy:
|
|
520
|
-
joyful:
|
|
521
|
-
sad:
|
|
522
|
-
crying:
|
|
523
|
-
surprised:
|
|
524
|
-
shocked:
|
|
525
|
-
angry:
|
|
526
|
-
furious:
|
|
527
|
-
worried:
|
|
528
|
-
scared:
|
|
529
|
-
confused:
|
|
530
|
-
skeptical:
|
|
531
|
-
thinking:
|
|
532
|
-
sleepy:
|
|
533
|
-
disgusted:
|
|
534
|
-
smug:
|
|
535
|
-
wink:
|
|
518
|
+
}, D = (e) => ({ ...An, ...e }), X = {
|
|
519
|
+
neutral: An,
|
|
520
|
+
happy: D({ smile: 0.9, leftBrow: 0.2, rightBrow: 0.2 }),
|
|
521
|
+
joyful: D({ mouth: 0.6, smile: 1, mouthWidth: 1.2, leftEye: 0, rightEye: 0, leftBrow: 0.4, rightBrow: 0.4 }),
|
|
522
|
+
sad: D({ smile: -0.8, leftEye: 0.8, rightEye: 0.8, browTilt: 0.9, leftBrow: -0.1, rightBrow: -0.1, lookY: 0.6 }),
|
|
523
|
+
crying: D({ mouth: 0.45, smile: -1, leftEye: 0, rightEye: 0, browTilt: 1, lookY: 0.4 }),
|
|
524
|
+
surprised: D({ mouth: 0.7, mouthWidth: 0.7, leftEye: 1.5, rightEye: 1.5, leftBrow: 1, rightBrow: 1 }),
|
|
525
|
+
shocked: D({ mouth: 1, mouthWidth: 0.8, leftEye: 1.6, rightEye: 1.6, leftBrow: 1, rightBrow: 1, browTilt: 0.4 }),
|
|
526
|
+
angry: D({ smile: -0.6, mouthWidth: 0.9, leftEye: 0.8, rightEye: 0.8, leftBrow: -0.6, rightBrow: -0.6, browTilt: -1 }),
|
|
527
|
+
furious: D({ mouth: 0.5, smile: -1, mouthWidth: 1.3, leftEye: 0.9, rightEye: 0.9, leftBrow: -0.9, rightBrow: -0.9, browTilt: -1 }),
|
|
528
|
+
worried: D({ smile: -0.3, mouthWidth: 0.8, leftEye: 1.1, rightEye: 1.1, leftBrow: 0.3, rightBrow: 0.3, browTilt: 0.8, lookX: -0.5 }),
|
|
529
|
+
scared: D({ mouth: 0.35, smile: -0.5, mouthWidth: 0.8, leftEye: 1.45, rightEye: 1.45, leftBrow: 0.8, rightBrow: 0.8, browTilt: 0.9 }),
|
|
530
|
+
confused: D({ smile: -0.2, mouthWidth: 0.8, leftEye: 0.9, rightEye: 1.15, leftBrow: -0.3, rightBrow: 0.8, lookX: 0.5, lookY: -0.4 }),
|
|
531
|
+
skeptical: D({ smile: -0.1, leftEye: 0.6, rightEye: 1, leftBrow: -0.4, rightBrow: 0.7, lookX: 0.4 }),
|
|
532
|
+
thinking: D({ smile: 0, mouthWidth: 0.7, leftBrow: 0.3, rightBrow: 0.5, lookX: 0.6, lookY: -0.8 }),
|
|
533
|
+
sleepy: D({ smile: 0.1, leftEye: 0.25, rightEye: 0.25, leftBrow: -0.3, rightBrow: -0.3, lookY: 0.5 }),
|
|
534
|
+
disgusted: D({ smile: -0.7, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.75, leftBrow: -0.5, rightBrow: -0.2, browTilt: -0.4, lookX: -0.6 }),
|
|
535
|
+
smug: D({ smile: 0.6, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.6, leftBrow: 0.1, rightBrow: 0.5, lookX: 0.5 }),
|
|
536
|
+
wink: D({ smile: 0.9, leftEye: 0, rightEye: 1, leftBrow: -0.2, rightBrow: 0.3 })
|
|
536
537
|
};
|
|
537
|
-
function
|
|
538
|
-
return { ...e, ...typeof t == "string" ?
|
|
539
|
-
}
|
|
540
|
-
const
|
|
541
|
-
rest:
|
|
542
|
-
wave:
|
|
543
|
-
cheer:
|
|
544
|
-
shrug:
|
|
545
|
-
point:
|
|
538
|
+
function We(e, t) {
|
|
539
|
+
return { ...e, ...typeof t == "string" ? X[t] : t };
|
|
540
|
+
}
|
|
541
|
+
const Be = {
|
|
542
|
+
rest: B,
|
|
543
|
+
wave: V({ rightShoulder: 135, rightElbow: 30, headTilt: 6, ...X.happy }),
|
|
544
|
+
cheer: V({ leftShoulder: 125, leftElbow: 20, rightShoulder: 125, rightElbow: 20, ...X.joyful }),
|
|
545
|
+
shrug: V({ leftShoulder: 30, leftElbow: 85, rightShoulder: 30, rightElbow: 85, headTilt: -10, ...X.confused, lookX: 0, lookY: 0 }),
|
|
546
|
+
point: V({ rightShoulder: 90, rightElbow: 0, lean: 4, smile: 0.4 }),
|
|
546
547
|
// The forearm passes 180° to fold back in, so the hand reaches the chin.
|
|
547
|
-
think:
|
|
548
|
-
handsOnHips:
|
|
549
|
-
sad:
|
|
550
|
-
surprised:
|
|
548
|
+
think: V({ rightShoulder: 60, rightElbow: 150, headTilt: 10, ...X.thinking }),
|
|
549
|
+
handsOnHips: V({ leftShoulder: 45, leftElbow: -100, rightShoulder: 45, rightElbow: -100, leftHip: 14, rightHip: 14, smile: 0.8 }),
|
|
550
|
+
sad: V({ leftShoulder: 14, rightShoulder: 14, leftElbow: -4, rightElbow: -4, headTilt: -14, lean: -3, ...X.sad }),
|
|
551
|
+
surprised: V({ leftShoulder: 70, leftElbow: 60, rightShoulder: 70, rightElbow: 60, ...X.surprised }),
|
|
551
552
|
// Squash and stretch: the wind-up before a jump (or the landing), and the jump itself.
|
|
552
|
-
crouch:
|
|
553
|
+
crouch: V({ stretch: 0.72, leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50, leftHip: 22, rightHip: 22, headTilt: -4 }),
|
|
553
554
|
// Seated, hands resting on the knees. Arm angles spread outward per side, so
|
|
554
555
|
// reaching forward (+x, the way the figure faces) is negative for the left arm.
|
|
555
|
-
sit:
|
|
556
|
-
jump:
|
|
556
|
+
sit: V({ sit: 1, turn: 0.5, leftShoulder: -25, rightShoulder: 25, leftElbow: -55, rightElbow: 55 }),
|
|
557
|
+
jump: V({ stretch: 1.22, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4, ...X.joyful }),
|
|
557
558
|
// Full splits: legs flat along the floor, so the planted feet bring the hips right down to it.
|
|
558
559
|
// Side (straddle) split, seen front-on: each leg straight out to its side, toes pointed.
|
|
559
|
-
sideSplit:
|
|
560
|
+
sideSplit: V({ leftHip: 90, rightHip: 90, leftAnkle: -45, rightAnkle: -45, leftShoulder: 120, rightShoulder: 120, leftElbow: 10, rightElbow: 10, ...X.happy }),
|
|
560
561
|
// Front split, in profile: the left leg forward (+x), the right leg back.
|
|
561
|
-
frontSplit:
|
|
562
|
-
},
|
|
563
|
-
function
|
|
562
|
+
frontSplit: V({ turn: 1, leftHip: -90, rightHip: -90, leftAnkle: -45, rightAnkle: -45, leftShoulder: -150, rightShoulder: 150, leftElbow: 10, rightElbow: -10, ...X.happy })
|
|
563
|
+
}, xn = Object.keys(B);
|
|
564
|
+
function _e(e, t, n) {
|
|
564
565
|
const s = { ...e };
|
|
565
|
-
for (const o of
|
|
566
|
+
for (const o of xn) s[o] = e[o] + (t[o] - e[o]) * n;
|
|
566
567
|
return s;
|
|
567
568
|
}
|
|
568
|
-
const
|
|
569
|
-
function
|
|
570
|
-
const s = Math.sin(e * Math.PI * 2) * n, o = Math.cos(e * Math.PI * 2) * n, r = (h) => h <=
|
|
569
|
+
const kt = 24, Ut = 4, zt = 28, Co = 40;
|
|
570
|
+
function Do(e, t = B, n = 1) {
|
|
571
|
+
const s = Math.sin(e * Math.PI * 2) * n, o = Math.cos(e * Math.PI * 2) * n, r = (h) => h <= Co, l = (h) => r(h) ? 22 * s : h, i = r(t.leftShoulder) ? t.leftElbow - zt * Math.max(0, -s) : t.leftElbow, a = r(t.rightShoulder) ? t.rightElbow + zt * Math.max(0, s) : t.rightElbow;
|
|
571
572
|
return {
|
|
572
573
|
...t,
|
|
573
574
|
// Lean into the walk, and keep the head a little more level than the body.
|
|
574
|
-
lean: t.lean +
|
|
575
|
-
headTilt: t.headTilt -
|
|
575
|
+
lean: t.lean + Ut * n,
|
|
576
|
+
headTilt: t.headTilt - Ut * 0.5 * n,
|
|
576
577
|
leftElbow: i,
|
|
577
578
|
rightElbow: a,
|
|
578
579
|
// Left foot forward while swing > 0, right foot back; then the other way.
|
|
579
|
-
leftHip: -
|
|
580
|
-
rightHip: -
|
|
580
|
+
leftHip: -kt * s,
|
|
581
|
+
rightHip: -kt * s,
|
|
581
582
|
// The leg swinging forward lifts, its shin trailing backward (-x). A positive
|
|
582
583
|
// knee folds toward the centre, which is backward only for the right leg.
|
|
583
584
|
leftKnee: -30 * Math.max(0, o),
|
|
@@ -587,146 +588,146 @@ function $o(e, t = _, n = 1) {
|
|
|
587
588
|
rightShoulder: l(t.rightShoulder)
|
|
588
589
|
};
|
|
589
590
|
}
|
|
590
|
-
function
|
|
591
|
-
return 4 * ((
|
|
591
|
+
function Xo(e, t = 1) {
|
|
592
|
+
return 4 * ((St + Ve) * e) * Math.sin(kt * t * Math.PI / 180);
|
|
592
593
|
}
|
|
593
|
-
function
|
|
594
|
+
function qo(e) {
|
|
594
595
|
const t = Math.abs(Math.sin(e / 65)), n = 0.55 + 0.45 * Math.sin(e / 310);
|
|
595
596
|
return t * n;
|
|
596
597
|
}
|
|
597
|
-
const
|
|
598
|
-
function
|
|
599
|
-
return
|
|
598
|
+
const Pn = 0.12, Vt = 0.46, Go = 1 - 2 * Pn, Uo = 0.1, zo = 0.21, Vo = 0.19, St = 0.24, Ve = 0.22, Kn = 0.12, jo = 0.14, Wn = 0.33, jt = 0.7, Jt = 0.3, Jo = 0.35, Zo = [1.7, 1.05], Qo = [1.3, 0.75], Zt = [1.45, 0.85], es = [1.15, 0.75], Qt = 0.06, ts = 0.7, ns = 0.65, On = 0.075, os = 0.3, ss = 0.02, rs = 0.012, is = 12, ls = 0.25, Fe = 90, as = 0.25, hs = 0.04, In = 0.01, de = (e) => Math.min(1, Math.max(0, e ?? 0));
|
|
599
|
+
function xi(e, t = 1) {
|
|
600
|
+
return Ve * e * t;
|
|
600
601
|
}
|
|
601
|
-
const
|
|
602
|
-
function
|
|
603
|
-
const l = Math.max(1, Math.min(r * 0.6,
|
|
602
|
+
const Et = -0.12, _n = 0.4, ne = (e) => e * Math.PI / 180, cs = (e, t) => ({ x: t * Math.sin(ne(e)), y: Math.cos(ne(e)) }), $n = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), Bn = (e, t, n, s) => e - 0.3 * t - n * 0.14 * t - Math.max(0, s - 1) * 0.12 * t;
|
|
603
|
+
function fs(e, t, n, s, o, r) {
|
|
604
|
+
const l = Math.max(1, Math.min(r * 0.6, jo * n)), i = de(t.turn), a = (Kn + Wn * i) * n, h = s + Et * n, c = a + t.lookX * 0.08 * n, u = t.lookY * 0.07 * n, d = [
|
|
604
605
|
// The left eye is on the far side; turning closes it up more than the near one.
|
|
605
|
-
{ x: -0.34 * n * (1 -
|
|
606
|
-
{ x: 0.34 * n * (1 -
|
|
606
|
+
{ x: -0.34 * n * (1 - jt * i), squeeze: 1 - jt * i, open: t.leftEye, brow: t.leftBrow, side: -1 },
|
|
607
|
+
{ x: 0.34 * n * (1 - Jt * i), squeeze: 1 - Jt * i, open: t.rightEye, brow: t.rightBrow, side: 1 }
|
|
607
608
|
];
|
|
608
609
|
e.fillStyle = o, e.strokeStyle = o, e.lineWidth = l;
|
|
609
|
-
for (const b of
|
|
610
|
-
const
|
|
611
|
-
if (
|
|
612
|
-
const
|
|
613
|
-
e.beginPath(), e.moveTo(b.x + a - 0.12 * n, h), e.quadraticCurveTo(b.x + a, h +
|
|
610
|
+
for (const b of d) {
|
|
611
|
+
const S = $n(b.open, t.blink);
|
|
612
|
+
if (S < 0.2) {
|
|
613
|
+
const T = t.smile > 0.5 ? -0.12 * n : 0.06 * n;
|
|
614
|
+
e.beginPath(), e.moveTo(b.x + a - 0.12 * n, h), e.quadraticCurveTo(b.x + a, h + T, b.x + a + 0.12 * n, h), e.stroke();
|
|
614
615
|
} else {
|
|
615
|
-
if (
|
|
616
|
-
const
|
|
617
|
-
e.beginPath(), e.ellipse(b.x + a, h,
|
|
616
|
+
if (S > 1.2) {
|
|
617
|
+
const M = 0.13 * n * S;
|
|
618
|
+
e.beginPath(), e.ellipse(b.x + a, h, M * 0.85, M, 0, 0, Math.PI * 2), e.fillStyle = "#ffffff", e.fill(), e.stroke(), e.fillStyle = o;
|
|
618
619
|
}
|
|
619
|
-
const
|
|
620
|
-
e.beginPath(), e.ellipse(b.x + c, h + u,
|
|
620
|
+
const T = S > 1.2 ? 0.075 * n : 0.1 * n;
|
|
621
|
+
e.beginPath(), e.ellipse(b.x + c, h + u, T, T * 1.1 * Math.min(S, 1), 0, 0, Math.PI * 2), e.fill();
|
|
621
622
|
}
|
|
622
|
-
const
|
|
623
|
-
e.beginPath(), e.moveTo(
|
|
623
|
+
const k = Bn(h, n, b.brow, S), v = b.x + a - b.side * 0.13 * n * b.squeeze, H = b.x + a + b.side * 0.13 * n * b.squeeze;
|
|
624
|
+
e.beginPath(), e.moveTo(H, k), e.lineTo(v, k - t.browTilt * 0.1 * n), e.stroke();
|
|
624
625
|
}
|
|
625
|
-
const f = s +
|
|
626
|
-
if (e.beginPath(),
|
|
626
|
+
const f = s + _n * n, p = 0.25 * n * Math.max(0.3, t.mouthWidth) * (1 - Jo * i), g = Math.min(1, Math.max(0, t.mouth));
|
|
627
|
+
if (e.beginPath(), g <= 0.05) {
|
|
627
628
|
e.moveTo(a - p, f), e.quadraticCurveTo(a, f + t.smile * 0.25 * n, a + p, f), e.stroke();
|
|
628
629
|
return;
|
|
629
630
|
}
|
|
630
|
-
const m = 0.3 * n *
|
|
631
|
+
const m = 0.3 * n * g;
|
|
631
632
|
t.smile > 0.3 ? (e.moveTo(a - p, f - 0.05 * n), e.lineTo(a + p, f - 0.05 * n), e.quadraticCurveTo(a, f + m * 2, a - p, f - 0.05 * n)) : t.smile < -0.3 ? (e.moveTo(a - p, f + m * 0.6), e.lineTo(a + p, f + m * 0.6), e.quadraticCurveTo(a, f - m * 1.4, a - p, f + m * 0.6)) : e.ellipse(a, f, p * 0.8, m, 0, 0, Math.PI * 2), e.fill();
|
|
632
633
|
}
|
|
633
|
-
function
|
|
634
|
-
const n = t.height ?? 300, s = Math.min(3, Math.max(0.3, e.stretch ?? 1)), o = Math.sqrt(s), r = (t.headSize ?? 2 *
|
|
635
|
-
const
|
|
636
|
-
return f ? { x: 0, y: 0 } : { x: Math.cos(
|
|
634
|
+
function Fn(e, t) {
|
|
635
|
+
const n = t.height ?? 300, s = Math.min(3, Math.max(0.3, e.stretch ?? 1)), o = Math.sqrt(s), r = (t.headSize ?? 2 * Pn) / 2, l = t.headSize === void 0 ? Go : 1 - 2 * r, i = r * n, a = de(e.sit), h = e.leftHip + (-Fe - e.leftHip) * a, c = e.leftKnee + (-Fe - e.leftKnee) * a, u = e.rightHip + (Fe - e.rightHip) * a, d = e.rightKnee + (Fe - e.rightKnee) * a, f = t.classic === !0, p = de(e.turn), g = (W, I, N, F, R) => {
|
|
636
|
+
const z = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, Math.abs(ne(I - N) / 2) + ne(F))), se = Math.max(-1, Math.min(1, ts + R)), st = p + (1 - p) * W * se;
|
|
637
|
+
return f ? { x: 0, y: 0 } : { x: Math.cos(z) * Qt * st, y: Math.sin(z) * Qt };
|
|
637
638
|
}, m = { left: e.leftAnkle ?? 0, right: e.rightAnkle ?? 0 }, b = { left: e.leftFootOut ?? 0, right: e.rightFootOut ?? 0 };
|
|
638
|
-
let
|
|
639
|
+
let S = 0;
|
|
639
640
|
if (a > 0 || !f) {
|
|
640
|
-
const W = (
|
|
641
|
+
const W = (R, z, se, st, ao) => St * Math.cos(ne(z)) + Ve * Math.cos(ne(z - se)) + Math.max(0, g(R, z, se, st, ao).y), I = Math.max(
|
|
641
642
|
W(-1, h, c, m.left, b.left),
|
|
642
|
-
W(1, u,
|
|
643
|
-
),
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
const
|
|
647
|
-
let
|
|
648
|
-
if (
|
|
649
|
-
|
|
650
|
-
for (let W = 0; W <=
|
|
651
|
-
const
|
|
652
|
-
|
|
643
|
+
W(1, u, d, m.right, b.right)
|
|
644
|
+
), N = 1 - de((e.rise ?? 0) / hs), F = (f ? Math.min(1, a / as) : 1) * N;
|
|
645
|
+
S = (Vt - I) * F * n * s;
|
|
646
|
+
}
|
|
647
|
+
const k = -Vt * n * s + S, v = -l * n * s + S, H = f ? 0 : (ss * de(e.turn) + rs * a) * n * s, T = ne(e.bend ?? 0), M = { end: tn(k, v, T, 1), bend: T };
|
|
648
|
+
let w;
|
|
649
|
+
if (T !== 0) {
|
|
650
|
+
w = [];
|
|
651
|
+
for (let W = 0; W <= en; W++) {
|
|
652
|
+
const I = W / en, N = tn(k, v, T, I);
|
|
653
|
+
w.push({ x: N.x - H * Math.sin(Math.PI * I), y: N.y });
|
|
653
654
|
}
|
|
654
655
|
} else
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
const
|
|
658
|
-
return { x: W +
|
|
659
|
-
},
|
|
660
|
-
const
|
|
661
|
-
return { root: { x: 0, y:
|
|
662
|
-
},
|
|
663
|
-
const
|
|
664
|
-
return { root:
|
|
665
|
-
},
|
|
666
|
-
const
|
|
667
|
-
return { x:
|
|
668
|
-
},
|
|
669
|
-
left:
|
|
670
|
-
right:
|
|
656
|
+
w = H === 0 ? [{ x: 0, y: k }, { x: 0, y: v }] : He({ x: 0, y: k }, { x: -H, y: (k + v) / 2 }, { x: 0, y: v }, 1, 8);
|
|
657
|
+
const y = v + Uo * n * s, A = (t.shoulderWidth ?? 0) * n * Math.cos(p * Math.PI / 2), x = (W, I, N, F, R) => {
|
|
658
|
+
const z = cs(N, F);
|
|
659
|
+
return { x: W + z.x * R * n, y: I + z.y * R * n };
|
|
660
|
+
}, E = (W, I, N) => {
|
|
661
|
+
const F = x(0, k, I, W, St * s);
|
|
662
|
+
return { root: { x: 0, y: k }, joint: F, end: x(F.x, F.y, I - N, W, Ve * s) };
|
|
663
|
+
}, P = (W, I, N) => {
|
|
664
|
+
const F = { x: W * A, y }, R = x(F.x, F.y, I, W, zo * o);
|
|
665
|
+
return { root: F, joint: R, end: x(R.x, R.y, I + N, W, Vo * o) };
|
|
666
|
+
}, K = { left: E(-1, h, c), right: E(1, u, d) }, _ = (W, I, N, F, R, z) => {
|
|
667
|
+
const se = g(W, N, F, R, z);
|
|
668
|
+
return { x: I.end.x + se.x * n * s, y: I.end.y + se.y * n * s };
|
|
669
|
+
}, $ = (W, I, N, F, R) => x(I.end.x, I.end.y, N + F + R, W, On * o), G = {
|
|
670
|
+
left: P(-1, e.leftShoulder, e.leftElbow),
|
|
671
|
+
right: P(1, e.rightShoulder, e.rightElbow)
|
|
671
672
|
};
|
|
672
673
|
return {
|
|
673
674
|
height: n,
|
|
674
675
|
facing: (t.facing ?? 1) < 0 ? -1 : 1,
|
|
675
676
|
stretch: s,
|
|
676
677
|
lineWidth: t.lineWidth ?? n * 0.025,
|
|
677
|
-
rubber: Math.min(1, Math.max(f ? 0 :
|
|
678
|
+
rubber: Math.min(1, Math.max(f ? 0 : os, t.rubber ?? 0)),
|
|
678
679
|
r: i,
|
|
679
680
|
// The head keeps its area: taller and narrower when stretched.
|
|
680
681
|
headRx: i / Math.sqrt(s),
|
|
681
682
|
headRy: i * Math.sqrt(s),
|
|
682
|
-
hipY:
|
|
683
|
-
neckY:
|
|
684
|
-
drop:
|
|
685
|
-
lean: f ? e.lean : e.lean +
|
|
683
|
+
hipY: k,
|
|
684
|
+
neckY: v,
|
|
685
|
+
drop: S,
|
|
686
|
+
lean: f ? e.lean : e.lean + is * Math.sin(Math.PI * a),
|
|
686
687
|
classic: f,
|
|
687
|
-
legs:
|
|
688
|
+
legs: K,
|
|
688
689
|
toes: {
|
|
689
|
-
left:
|
|
690
|
-
right:
|
|
690
|
+
left: _(-1, K.left, h, c, m.left, b.left),
|
|
691
|
+
right: _(1, K.right, u, d, m.right, b.right)
|
|
691
692
|
},
|
|
692
|
-
spine:
|
|
693
|
-
chest:
|
|
693
|
+
spine: w,
|
|
694
|
+
chest: M,
|
|
694
695
|
arms: G,
|
|
695
696
|
handTips: {
|
|
696
|
-
left:
|
|
697
|
-
right:
|
|
697
|
+
left: $(-1, G.left, e.leftShoulder, e.leftElbow, e.leftWrist ?? 0),
|
|
698
|
+
right: $(1, G.right, e.rightShoulder, e.rightElbow, e.rightWrist ?? 0)
|
|
698
699
|
}
|
|
699
700
|
};
|
|
700
701
|
}
|
|
701
|
-
const
|
|
702
|
-
function
|
|
702
|
+
const en = 10;
|
|
703
|
+
function tn(e, t, n, s) {
|
|
703
704
|
const o = e - t, r = n * s;
|
|
704
705
|
if (Math.abs(n) < 1e-9) return { x: 0, y: e - o * s };
|
|
705
706
|
const l = o / n;
|
|
706
707
|
return { x: l * (1 - Math.cos(r)), y: e - l * Math.sin(r) };
|
|
707
708
|
}
|
|
708
|
-
function
|
|
709
|
+
function us(e, t) {
|
|
709
710
|
if (e.chest.bend === 0) return t;
|
|
710
|
-
const n =
|
|
711
|
+
const n = $e(t, { x: 0, y: e.neckY }, e.chest.bend);
|
|
711
712
|
return { x: n.x + e.chest.end.x, y: n.y + e.chest.end.y - e.neckY };
|
|
712
713
|
}
|
|
713
|
-
const
|
|
714
|
-
function
|
|
714
|
+
const xe = (e, t) => t === 0 ? [e.root, e.joint, e.end] : He(e.root, e.joint, e.end, t);
|
|
715
|
+
function $e(e, t, n) {
|
|
715
716
|
const s = Math.cos(n), o = Math.sin(n), r = e.x - t.x, l = e.y - t.y;
|
|
716
717
|
return { x: t.x + r * s - l * o, y: t.y + r * o + l * s };
|
|
717
718
|
}
|
|
718
|
-
function
|
|
719
|
-
const s =
|
|
720
|
-
return n && (o !== 0 || r !== 0) ?
|
|
719
|
+
function Rn(e, t, n = !0) {
|
|
720
|
+
const s = gs(e, t), o = t.spin ?? 0, r = t.rise ?? 0;
|
|
721
|
+
return n && (o !== 0 || r !== 0) ? ds(s, e, o, r) : s;
|
|
721
722
|
}
|
|
722
|
-
function
|
|
723
|
-
return { pivot: { x: 0, y: e.hipY }, angle: e.facing *
|
|
723
|
+
function Nn(e, t, n) {
|
|
724
|
+
return { pivot: { x: 0, y: e.hipY }, angle: e.facing * ne(t), lift: n * e.height };
|
|
724
725
|
}
|
|
725
|
-
function
|
|
726
|
-
const { pivot: o, angle: r, lift: l } =
|
|
727
|
-
const f =
|
|
726
|
+
function ds(e, t, n, s) {
|
|
727
|
+
const { pivot: o, angle: r, lift: l } = Nn(t, n, s), i = (d) => {
|
|
728
|
+
const f = $e(d, o, r);
|
|
728
729
|
return { x: f.x, y: f.y - l };
|
|
729
|
-
}, a = (
|
|
730
|
+
}, a = (d) => ({ left: i(d.left), right: i(d.right) }), h = { left: Math.max(i(e.feet.left).y, i(e.toes.left).y), right: Math.max(i(e.feet.right).y, i(e.toes.right).y) }, c = Math.max(h.left, h.right), u = In * t.height;
|
|
730
731
|
return {
|
|
731
732
|
...e,
|
|
732
733
|
hip: i(e.hip),
|
|
@@ -751,20 +752,20 @@ function rs(e, t, n, s) {
|
|
|
751
752
|
head: { ...e.head, center: i(e.head.center), angle: e.head.angle + r }
|
|
752
753
|
};
|
|
753
754
|
}
|
|
754
|
-
function
|
|
755
|
-
const n =
|
|
756
|
-
const [
|
|
757
|
-
return u(
|
|
755
|
+
function gs(e, t) {
|
|
756
|
+
const n = ne(e.lean), s = ne(t.headTilt), o = { x: 0, y: e.hipY }, r = (v) => ({ x: e.facing * v.x, y: v.y }), l = (v) => r($e(v, o, n)), i = (v) => l(us(e, v)), a = (v) => i($e({ x: v.x, y: v.y + e.neckY }, { x: 0, y: e.neckY }, s)), h = xe(e.arms.left, e.rubber).map(i), c = xe(e.arms.right, e.rubber).map(i), u = (v, H) => Math.atan2(H.y - v.y, H.x - v.x), d = { left: i(e.handTips.left), right: i(e.handTips.right) }, f = (v, H) => {
|
|
757
|
+
const [T, M] = v.slice(-2), w = e.arms[H], y = u(i(w.end), d[H]) - u(i(w.joint), i(w.end));
|
|
758
|
+
return u(T, M) + y;
|
|
758
759
|
};
|
|
759
760
|
let p = 1 / 0;
|
|
760
|
-
for (const [
|
|
761
|
+
for (const [v, H] of [
|
|
761
762
|
[t.leftBrow, t.leftEye],
|
|
762
763
|
[t.rightBrow, t.rightEye]
|
|
763
764
|
]) {
|
|
764
|
-
const
|
|
765
|
-
p = Math.min(p,
|
|
765
|
+
const T = Bn(Et, 1, v, $n(H, t.blink));
|
|
766
|
+
p = Math.min(p, T, T - t.browTilt * 0.1);
|
|
766
767
|
}
|
|
767
|
-
const
|
|
768
|
+
const g = { left: r(e.legs.left.end), right: r(e.legs.right.end) }, m = { left: r(e.toes.left), right: r(e.toes.right) }, b = { left: Math.max(g.left.y, m.left.y), right: Math.max(g.right.y, m.right.y) }, S = Math.max(b.left, b.right), k = In * e.height;
|
|
768
769
|
return {
|
|
769
770
|
facing: e.facing,
|
|
770
771
|
height: e.height,
|
|
@@ -776,17 +777,17 @@ function is(e, t) {
|
|
|
776
777
|
elbows: { left: i(e.arms.left.joint), right: i(e.arms.right.joint) },
|
|
777
778
|
hands: { left: i(e.arms.left.end), right: i(e.arms.right.end) },
|
|
778
779
|
knees: { left: r(e.legs.left.joint), right: r(e.legs.right.joint) },
|
|
779
|
-
feet:
|
|
780
|
+
feet: g,
|
|
780
781
|
toes: m,
|
|
781
|
-
feetY:
|
|
782
|
-
grounded: { left: b.left >=
|
|
783
|
-
fingertips:
|
|
782
|
+
feetY: S,
|
|
783
|
+
grounded: { left: b.left >= S - k, right: b.right >= S - k },
|
|
784
|
+
fingertips: d,
|
|
784
785
|
handAngle: { left: f(h, "left"), right: f(c, "right") },
|
|
785
786
|
limbs: {
|
|
786
787
|
leftArm: h,
|
|
787
788
|
rightArm: c,
|
|
788
|
-
leftLeg:
|
|
789
|
-
rightLeg:
|
|
789
|
+
leftLeg: xe(e.legs.left, e.rubber).map(r),
|
|
790
|
+
rightLeg: xe(e.legs.right, e.rubber).map(r),
|
|
790
791
|
spine: e.spine.map(l)
|
|
791
792
|
},
|
|
792
793
|
head: {
|
|
@@ -795,20 +796,20 @@ function is(e, t) {
|
|
|
795
796
|
ry: e.headRy,
|
|
796
797
|
// Mirroring a turn reverses it.
|
|
797
798
|
angle: e.facing * (n + e.chest.bend + s),
|
|
798
|
-
eyeY:
|
|
799
|
+
eyeY: Et,
|
|
799
800
|
browTopY: p,
|
|
800
|
-
mouthY:
|
|
801
|
-
faceX: e.facing * (
|
|
801
|
+
mouthY: _n,
|
|
802
|
+
faceX: e.facing * (Kn + Wn * de(t.turn))
|
|
802
803
|
}
|
|
803
804
|
};
|
|
804
805
|
}
|
|
805
|
-
function
|
|
806
|
-
return
|
|
806
|
+
function ps(e, t = {}) {
|
|
807
|
+
return Rn(Fn(e, t), e);
|
|
807
808
|
}
|
|
808
|
-
function
|
|
809
|
-
return
|
|
809
|
+
function Pi(e, t, n) {
|
|
810
|
+
return $e({ x: e.center.x + t * e.rx, y: e.center.y + n * e.ry }, e.center, e.angle);
|
|
810
811
|
}
|
|
811
|
-
function
|
|
812
|
+
function ms(e, t, n) {
|
|
812
813
|
const s = (r) => ({ x: r.x + t, y: r.y + n }), o = (r) => ({ left: s(r.left), right: s(r.right) });
|
|
813
814
|
return {
|
|
814
815
|
...e,
|
|
@@ -833,118 +834,118 @@ function as(e, t, n) {
|
|
|
833
834
|
head: { ...e.head, center: s(e.head.center) }
|
|
834
835
|
};
|
|
835
836
|
}
|
|
836
|
-
function
|
|
837
|
-
const o =
|
|
838
|
-
e.save(),
|
|
839
|
-
}, u = (
|
|
840
|
-
|
|
841
|
-
},
|
|
842
|
-
|
|
837
|
+
function bs(e, t, n = {}, s = 0) {
|
|
838
|
+
const o = Fn(t, n), r = n.color ?? "#1e293b", l = n.layers ?? {}, i = n.layers ? Rn(o, t, !1) : void 0, a = n.sketch ? mt(e, n.sketch, s) : void 0, h = n.sketch && n.layers ? mt(e, n.sketch, s) : void 0, c = (M) => {
|
|
839
|
+
e.save(), M(), e.restore();
|
|
840
|
+
}, u = (M) => {
|
|
841
|
+
M && i && c(() => M(e, i, s, h));
|
|
842
|
+
}, d = () => e.scale(o.facing, 1), f = () => {
|
|
843
|
+
d(), e.translate(0, o.hipY), e.rotate(ne(o.lean)), e.translate(0, -o.hipY);
|
|
843
844
|
}, p = () => {
|
|
844
845
|
f(), o.chest.bend !== 0 && (e.translate(o.chest.end.x, o.chest.end.y), e.rotate(o.chest.bend), e.translate(0, -o.neckY));
|
|
845
|
-
},
|
|
846
|
-
if (a) return
|
|
846
|
+
}, g = (M, w, y) => {
|
|
847
|
+
if (a) return w ? a.curve(M) : a.line(M);
|
|
847
848
|
if (o.classic) {
|
|
848
|
-
e.beginPath(), e.moveTo(
|
|
849
|
-
for (const
|
|
849
|
+
e.beginPath(), e.moveTo(M[0].x, M[0].y);
|
|
850
|
+
for (const A of M.slice(1)) e.lineTo(A.x, A.y);
|
|
850
851
|
e.stroke();
|
|
851
852
|
return;
|
|
852
853
|
}
|
|
853
|
-
|
|
854
|
-
}, m = (
|
|
855
|
-
o.classic ||
|
|
856
|
-
},
|
|
857
|
-
if (n.hands && !o.classic) return
|
|
854
|
+
Pt(e, M, y[0] * o.lineWidth, y[1] * o.lineWidth);
|
|
855
|
+
}, m = (M, w) => g(xe(M, o.rubber), o.rubber > 0, w), b = (M) => {
|
|
856
|
+
o.classic || g([o.legs[M].end, o.toes[M]], !1, es);
|
|
857
|
+
}, S = (M) => {
|
|
858
|
+
if (n.hands && !o.classic) return v(M);
|
|
858
859
|
if (o.classic || a) return;
|
|
859
|
-
const
|
|
860
|
-
e.beginPath(), e.arc(
|
|
860
|
+
const w = o.arms[M].end;
|
|
861
|
+
e.beginPath(), e.arc(w.x, w.y, ns * o.lineWidth, 0, Math.PI * 2), e.fill();
|
|
861
862
|
};
|
|
862
863
|
e.save(), e.strokeStyle = r, e.fillStyle = r, e.lineWidth = o.lineWidth, e.lineCap = "round", e.lineJoin = "round";
|
|
863
|
-
const
|
|
864
|
-
(
|
|
865
|
-
function
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
side:
|
|
864
|
+
const k = Nn(o, t.spin ?? 0, t.rise ?? 0);
|
|
865
|
+
(k.angle !== 0 || k.lift !== 0) && (e.translate(0, -k.lift), e.translate(k.pivot.x, k.pivot.y), e.rotate(k.angle), e.translate(-k.pivot.x, -k.pivot.y));
|
|
866
|
+
function v(M) {
|
|
867
|
+
const w = n.hands ?? {}, y = o.arms[M].end, A = o.handTips[M], x = n.headFill ?? "#ffffff";
|
|
868
|
+
Kt(e, y, w[M] ?? Y, {
|
|
869
|
+
side: M,
|
|
869
870
|
// Degrees clockwise from straight up, in the frame the hand is drawn in.
|
|
870
|
-
angle: Math.atan2(
|
|
871
|
-
size: (
|
|
872
|
-
skin:
|
|
871
|
+
angle: Math.atan2(A.x - y.x, y.y - A.y) * 180 / Math.PI,
|
|
872
|
+
size: (w.size ?? On) * o.height * Math.sqrt(o.stretch),
|
|
873
|
+
skin: w.skin ?? (x === "none" ? void 0 : x),
|
|
873
874
|
ink: r,
|
|
874
875
|
lineWidth: o.lineWidth * 0.45,
|
|
875
|
-
fingers:
|
|
876
|
-
plump:
|
|
876
|
+
fingers: w.fingers,
|
|
877
|
+
plump: w.plump,
|
|
877
878
|
look: n.sketch ? "pencil" : "clean",
|
|
878
879
|
seed: n.sketch?.seed
|
|
879
880
|
}, s);
|
|
880
881
|
}
|
|
881
|
-
const
|
|
882
|
+
const H = (M) => {
|
|
882
883
|
c(() => {
|
|
883
|
-
p(), m(o.arms[
|
|
884
|
+
p(), m(o.arms[M], Qo), S(M);
|
|
884
885
|
});
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
},
|
|
886
|
+
const w = l.sleeve;
|
|
887
|
+
w && i && c(() => w(e, i, M, s, h));
|
|
888
|
+
}, T = de(t.turn) > ls;
|
|
888
889
|
u(l.behind), c(() => {
|
|
889
|
-
|
|
890
|
-
}),
|
|
891
|
-
f(),
|
|
890
|
+
d(), m(o.legs.left, Zt), b("left"), m(o.legs.right, Zt), b("right");
|
|
891
|
+
}), T && H("left"), c(() => {
|
|
892
|
+
f(), g(o.spine, o.spine.length > 2, Zo);
|
|
892
893
|
}), c(() => {
|
|
893
894
|
p();
|
|
894
|
-
const { left:
|
|
895
|
-
if (
|
|
896
|
-
if (o.classic)
|
|
895
|
+
const { left: M, right: w } = { left: o.arms.left.root, right: o.arms.right.root };
|
|
896
|
+
if (M.x !== w.x)
|
|
897
|
+
if (o.classic) g([M, w], !1, [1, 1]);
|
|
897
898
|
else {
|
|
898
|
-
const
|
|
899
|
-
|
|
899
|
+
const y = { x: (M.x + w.x) / 2, y: M.y - 0.3 * Math.abs(w.x - M.x) };
|
|
900
|
+
g(He(M, y, w, 1, 8), !0, [1.1, 1.1]);
|
|
900
901
|
}
|
|
901
|
-
}), u(l.body),
|
|
902
|
-
p(), e.translate(0, o.neckY), e.rotate(
|
|
903
|
-
const
|
|
904
|
-
e.beginPath(), e.ellipse(0,
|
|
905
|
-
const
|
|
906
|
-
if (
|
|
907
|
-
a.ellipse(0,
|
|
908
|
-
const
|
|
909
|
-
e.translate(
|
|
902
|
+
}), u(l.body), T || H("left"), H("right"), u(l.behindHead), c(() => {
|
|
903
|
+
p(), e.translate(0, o.neckY), e.rotate(ne(t.headTilt));
|
|
904
|
+
const M = -o.headRy;
|
|
905
|
+
e.beginPath(), e.ellipse(0, M, o.headRx, o.headRy, 0, 0, Math.PI * 2);
|
|
906
|
+
const w = n.headFill ?? "#ffffff";
|
|
907
|
+
if (w !== "none" && (e.fillStyle = w, e.fill()), a) {
|
|
908
|
+
a.ellipse(0, M, o.headRx, o.headRy);
|
|
909
|
+
const y = a.nudge();
|
|
910
|
+
e.translate(y.x, y.y);
|
|
910
911
|
} else
|
|
911
912
|
e.stroke();
|
|
912
|
-
e.translate(0,
|
|
913
|
+
e.translate(0, M), e.scale(o.headRx / o.r, o.headRy / o.r), fs(e, t, o.r, 0, r, o.lineWidth);
|
|
913
914
|
}), u(l.overHead), u(l.front), e.restore(), n.label && (e.save(), e.fillStyle = r, e.font = n.labelFont ?? `700 ${Math.round(o.height * 0.11)}px sans-serif`, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(n.label, 0, -o.height * o.stretch - 0.04 * o.height + o.drop), e.restore());
|
|
914
915
|
}
|
|
915
|
-
function
|
|
916
|
+
function Ln(e, t, n) {
|
|
916
917
|
const s = { ...e };
|
|
917
|
-
let o = e.walking > 0 ?
|
|
918
|
+
let o = e.walking > 0 ? _e(s, Lo(e.gait, e.walk, s), e.walking) : s, r = ys(e);
|
|
918
919
|
const l = e.dancing ?? 0;
|
|
919
920
|
if (n && l > 0) {
|
|
920
921
|
const i = n(e.beat ?? 0);
|
|
921
|
-
if (o =
|
|
922
|
-
const a = (h, c) => c ?
|
|
922
|
+
if (o = _e(o, i.pose, l), i.hands) {
|
|
923
|
+
const a = (h, c) => c ? Ie(h ?? Y, c, l) : h;
|
|
923
924
|
r = { left: a(r?.left, i.hands.left), right: a(r?.right, i.hands.right) };
|
|
924
925
|
}
|
|
925
926
|
}
|
|
926
|
-
return e.talk > 0 && (o = { ...o, mouth: Math.max(o.mouth, e.talk *
|
|
927
|
+
return e.talk > 0 && (o = { ...o, mouth: Math.max(o.mouth, e.talk * qo(t)) }), { pose: o, hands: r };
|
|
927
928
|
}
|
|
928
|
-
function
|
|
929
|
-
return
|
|
929
|
+
function ws(e, t, n) {
|
|
930
|
+
return Ln(e, t, n).pose;
|
|
930
931
|
}
|
|
931
|
-
const
|
|
932
|
-
function
|
|
932
|
+
const Yn = (e, t) => (e.facing ?? t.facing ?? 1) < 0 ? -1 : 1, je = (e, t) => `hand.${e}.${t}`;
|
|
933
|
+
function ys(e) {
|
|
933
934
|
const t = (o) => {
|
|
934
|
-
if (typeof e[
|
|
935
|
-
return Object.fromEntries(Object.keys(
|
|
935
|
+
if (typeof e[je(o, "spread")] == "number")
|
|
936
|
+
return Object.fromEntries(Object.keys(Y).map((r) => [r, e[je(o, r)]]));
|
|
936
937
|
}, n = t("left"), s = t("right");
|
|
937
938
|
return n || s ? { left: n, right: s } : void 0;
|
|
938
939
|
}
|
|
939
|
-
function
|
|
940
|
+
function ks(e, t) {
|
|
940
941
|
return !t || !e.hands ? e : { ...e, hands: { ...e.hands, left: t.left ?? e.hands.left, right: t.right ?? e.hands.right } };
|
|
941
942
|
}
|
|
942
|
-
function
|
|
943
|
-
const t = e.style ?? {}, n = t.height ?? 300, s = n * 0.8, o = { ...
|
|
943
|
+
function Ki(e) {
|
|
944
|
+
const t = e.style ?? {}, n = t.height ?? 300, s = n * 0.8, o = { ...V(e.pose ?? {}), walk: 0, walking: 0, gait: "walk", facing: (t.facing ?? 1) < 0 ? -1 : 1, talk: 0, rubber: t.rubber ?? 0, beat: 0, dancing: 0 }, r = {};
|
|
944
945
|
if (t.hands)
|
|
945
946
|
for (const l of ["left", "right"]) {
|
|
946
|
-
const i = t.hands[l] ??
|
|
947
|
-
for (const a of Object.keys(
|
|
947
|
+
const i = t.hands[l] ?? Y;
|
|
948
|
+
for (const a of Object.keys(Y)) r[je(l, a)] = i[a] ?? Y[a];
|
|
948
949
|
}
|
|
949
950
|
return {
|
|
950
951
|
type: "custom",
|
|
@@ -956,31 +957,31 @@ function mi(e) {
|
|
|
956
957
|
figureStyle: t,
|
|
957
958
|
figureDance: e.dance,
|
|
958
959
|
draw(l, i, a) {
|
|
959
|
-
const h = i.props, c =
|
|
960
|
-
l.translate(s / 2, n),
|
|
960
|
+
const h = i.props, c = Ln(h, a, e.dance);
|
|
961
|
+
l.translate(s / 2, n), bs(l, c.pose, ks({ ...t, rubber: h.rubber, facing: Yn(h, t) }, c.hands), a);
|
|
961
962
|
}
|
|
962
963
|
};
|
|
963
964
|
}
|
|
964
|
-
function
|
|
965
|
+
function Ss(e, t, n) {
|
|
965
966
|
const s = e.figureStyle;
|
|
966
967
|
if (!s) throw new Error("stickFigureAt: the target was not made by stickFigureTarget");
|
|
967
968
|
const o = { ...e.props };
|
|
968
969
|
let r = 0, l = 0;
|
|
969
970
|
for (const [h, c] of t.state?.values.get(n) ?? [])
|
|
970
971
|
h === "gait" && typeof c == "string" && (o.gait = c), typeof c == "number" && (h === "x" || h === "motionPathX" ? r = c : h === "y" || h === "motionPathY" ? l = c : h in o && (o[h] = c));
|
|
971
|
-
const i =
|
|
972
|
-
return { pose: i, joints:
|
|
972
|
+
const i = ws(o, t.time, e.figureDance), a = ps(i, { ...s, rubber: o.rubber, facing: Yn(o, s) });
|
|
973
|
+
return { pose: i, joints: ms(a, e.x + r + e.width / 2, e.y + l + e.height) };
|
|
973
974
|
}
|
|
974
|
-
function
|
|
975
|
+
function Cn(e) {
|
|
975
976
|
const t = [];
|
|
976
977
|
return e.forEach((n, s) => {
|
|
977
|
-
const o = s === 0 ?
|
|
978
|
-
t.push(n.expression ?
|
|
978
|
+
const o = s === 0 ? B : t[s - 1], r = typeof n.pose == "string" ? Be[n.pose] : { ...o, ...n.pose };
|
|
979
|
+
t.push(n.expression ? We(r, n.expression) : r);
|
|
979
980
|
}), t;
|
|
980
981
|
}
|
|
981
|
-
function
|
|
982
|
-
const n =
|
|
983
|
-
return
|
|
982
|
+
function Wi(e, t) {
|
|
983
|
+
const n = Cn(t);
|
|
984
|
+
return xn.filter((s) => n.some((o) => o[s] !== B[s])).map((s) => ({
|
|
984
985
|
id: `${e}-${s}`,
|
|
985
986
|
target: e,
|
|
986
987
|
property: s,
|
|
@@ -991,53 +992,53 @@ function bi(e, t) {
|
|
|
991
992
|
}))
|
|
992
993
|
}));
|
|
993
994
|
}
|
|
994
|
-
const
|
|
995
|
+
const rt = 0.5, nn = {
|
|
995
996
|
/** Flag: fingers together and straight, thumb bent in */
|
|
996
|
-
pataka:
|
|
997
|
+
pataka: L({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0, turn: 2 }),
|
|
997
998
|
/** Pataka with the ring finger bent */
|
|
998
|
-
tripataka:
|
|
999
|
+
tripataka: L({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 1, "pinky.curl": 0, spread: 0, turn: 2 }),
|
|
999
1000
|
/** Lotus in bloom: fingers fanned, each a little more curled than the last */
|
|
1000
|
-
alapadma:
|
|
1001
|
+
alapadma: L({ "thumb.curl": 0.1, "thumb.across": 0, "index.curl": 0.05, "middle.curl": 0.15, "ring.curl": 0.25, "pinky.curl": 0.35, spread: 1, turn: 2 }),
|
|
1001
1002
|
/** Fist */
|
|
1002
|
-
mushti:
|
|
1003
|
+
mushti: q.fist,
|
|
1003
1004
|
/** Fist, thumb up */
|
|
1004
|
-
shikhara:
|
|
1005
|
+
shikhara: q.thumbsUp,
|
|
1005
1006
|
/** Swan's beak: thumb and index touch, the others fanned */
|
|
1006
|
-
hamsasya:
|
|
1007
|
+
hamsasya: L({ "thumb.curl": 0.15, "thumb.across": 0.6, "index.curl": 0.6, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0.7, turn: 2 }),
|
|
1007
1008
|
/** Bracelet: thumb, index and middle meet, ring and little finger out */
|
|
1008
|
-
katakamukha:
|
|
1009
|
+
katakamukha: L({ "thumb.curl": 0.2, "thumb.across": 0.6, "index.curl": 0.65, "middle.curl": 0.7, "ring.curl": 0, "pinky.curl": 0, spread: 0.4, turn: 2 })
|
|
1009
1010
|
};
|
|
1010
|
-
function
|
|
1011
|
-
return typeof e != "string" ? e : e in
|
|
1011
|
+
function Je(e) {
|
|
1012
|
+
return typeof e != "string" ? e : e in nn ? nn[e] : q[e];
|
|
1012
1013
|
}
|
|
1013
|
-
function
|
|
1014
|
+
function Dn(e, t, n) {
|
|
1014
1015
|
const s = [];
|
|
1015
1016
|
for (const o of e.keys) {
|
|
1016
1017
|
const r = s[s.length - 1], l = !r || o.reset ? { pose: t, ...n } : r;
|
|
1017
1018
|
s.push({
|
|
1018
1019
|
beat: o.beat,
|
|
1019
1020
|
pose: { ...l.pose, ...o.pose },
|
|
1020
|
-
left: o.hands?.left ?
|
|
1021
|
-
right: o.hands?.right ?
|
|
1021
|
+
left: o.hands?.left ? Je(o.hands.left) : l.left,
|
|
1022
|
+
right: o.hands?.right ? Je(o.hands.right) : l.right,
|
|
1022
1023
|
easing: o.easing ?? e.easing
|
|
1023
1024
|
});
|
|
1024
1025
|
}
|
|
1025
1026
|
return s;
|
|
1026
1027
|
}
|
|
1027
|
-
const
|
|
1028
|
-
function
|
|
1029
|
-
const o =
|
|
1028
|
+
const Wt = (e, t) => (e % t + t) % t;
|
|
1029
|
+
function Es(e, t, n, s) {
|
|
1030
|
+
const o = Dn(e, n, s);
|
|
1030
1031
|
if (o.length === 0) return { pose: n, hands: s };
|
|
1031
|
-
const r =
|
|
1032
|
+
const r = Wt(t, e.beats);
|
|
1032
1033
|
let l = o.length - 1;
|
|
1033
1034
|
for (let f = 0; f < o.length; f++) o[f].beat <= r && (l = f);
|
|
1034
|
-
const i = o[l], a = o[(l + 1) % o.length], h = i.beat <= r ? i.beat : i.beat - e.beats, c = a.beat > h ? a.beat : a.beat + e.beats, u = c > h ? (r - h) / (c - h) : 0,
|
|
1035
|
+
const i = o[l], a = o[(l + 1) % o.length], h = i.beat <= r ? i.beat : i.beat - e.beats, c = a.beat > h ? a.beat : a.beat + e.beats, u = c > h ? (r - h) / (c - h) : 0, d = nt(a.easing ?? "ease-in-out")(Math.min(1, Math.max(0, u)));
|
|
1035
1036
|
return {
|
|
1036
|
-
pose:
|
|
1037
|
-
hands: { left:
|
|
1037
|
+
pose: _e(i.pose, a.pose, d),
|
|
1038
|
+
hands: { left: Ie(i.left, a.left, d), right: Ie(i.right, a.right, d) }
|
|
1038
1039
|
};
|
|
1039
1040
|
}
|
|
1040
|
-
const
|
|
1041
|
+
const Ms = [
|
|
1041
1042
|
["leftShoulder", "rightShoulder"],
|
|
1042
1043
|
["leftElbow", "rightElbow"],
|
|
1043
1044
|
["leftWrist", "rightWrist"],
|
|
@@ -1047,19 +1048,19 @@ const ps = [
|
|
|
1047
1048
|
["leftFootOut", "rightFootOut"],
|
|
1048
1049
|
["leftEye", "rightEye"],
|
|
1049
1050
|
["leftBrow", "rightBrow"]
|
|
1050
|
-
],
|
|
1051
|
-
function
|
|
1051
|
+
], Hs = ["lean", "headTilt", "lookX", "spin"], vs = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
|
|
1052
|
+
function Ts(e) {
|
|
1052
1053
|
const t = { ...e }, n = (e.turn ?? 0) >= 0.5;
|
|
1053
|
-
for (const [s, o] of
|
|
1054
|
-
const r = n &&
|
|
1054
|
+
for (const [s, o] of Ms) {
|
|
1055
|
+
const r = n && vs.has(s) ? -1 : 1;
|
|
1055
1056
|
t[s] = r * e[o], t[o] = r * e[s];
|
|
1056
1057
|
}
|
|
1057
|
-
if (!n) for (const s of
|
|
1058
|
+
if (!n) for (const s of Hs) t[s] = -e[s];
|
|
1058
1059
|
return t;
|
|
1059
1060
|
}
|
|
1060
|
-
const
|
|
1061
|
-
function
|
|
1062
|
-
const s =
|
|
1061
|
+
const As = (e) => Math.min(1, Math.max(-1, (0.5 - e) * 4));
|
|
1062
|
+
function xs(e, t, n) {
|
|
1063
|
+
const s = Wt(n, 1), o = (1 + Math.cos(2 * Math.PI * s)) / 2, r = t.bounce * (t.accent === "up" ? 1 - o : o), l = Math.min(1, Math.max(0, e.turn ?? 0)), i = As(l);
|
|
1063
1064
|
return {
|
|
1064
1065
|
...e,
|
|
1065
1066
|
leftHip: e.leftHip + i * r / 2,
|
|
@@ -1069,128 +1070,128 @@ function ks(e, t, n) {
|
|
|
1069
1070
|
lean: e.lean + (t.sway ?? 0) * (1 - l) * Math.sin(Math.PI * n)
|
|
1070
1071
|
};
|
|
1071
1072
|
}
|
|
1072
|
-
function
|
|
1073
|
-
const t = { ...
|
|
1074
|
-
return e.expression ?
|
|
1073
|
+
function Mt(e) {
|
|
1074
|
+
const t = { ...B, ...e.stance };
|
|
1075
|
+
return e.expression ? We(t, e.expression) : t;
|
|
1075
1076
|
}
|
|
1076
|
-
function
|
|
1077
|
+
function Xn(e) {
|
|
1077
1078
|
return {
|
|
1078
|
-
left: e.hands?.left ?
|
|
1079
|
-
right: e.hands?.right ?
|
|
1079
|
+
left: e.hands?.left ? Je(e.hands.left) : Y,
|
|
1080
|
+
right: e.hands?.right ? Je(e.hands.right) : Y
|
|
1080
1081
|
};
|
|
1081
1082
|
}
|
|
1082
|
-
function
|
|
1083
|
+
function it(e, t, n) {
|
|
1083
1084
|
const s = e.moves[t.move];
|
|
1084
1085
|
if (!s) throw new Error(`dance: "${e.label}" has no move "${t.move}"`);
|
|
1085
|
-
const o =
|
|
1086
|
-
return t.mirror ? { pose:
|
|
1086
|
+
const o = Es(s, n, Mt(e), Xn(e));
|
|
1087
|
+
return t.mirror ? { pose: Ts(o.pose), hands: { left: o.hands?.right, right: o.hands?.left } } : o;
|
|
1087
1088
|
}
|
|
1088
|
-
function
|
|
1089
|
-
const s = typeof e == "string" ?
|
|
1089
|
+
function Ot(e, t, n = {}) {
|
|
1090
|
+
const s = typeof e == "string" ? ve[e] : e;
|
|
1090
1091
|
let o;
|
|
1091
1092
|
if (n.move)
|
|
1092
|
-
o =
|
|
1093
|
+
o = it(s, { move: n.move, mirror: n.mirror }, t);
|
|
1093
1094
|
else {
|
|
1094
|
-
const r = s.routine, l = r.reduce((u,
|
|
1095
|
+
const r = s.routine, l = r.reduce((u, d) => u + d.beats, 0), i = Wt(t, l);
|
|
1095
1096
|
let a = 0, h = 0;
|
|
1096
1097
|
for (; h < r.length - 1 && i >= a + r[h].beats; ) a += r[h++].beats;
|
|
1097
1098
|
const c = i - a;
|
|
1098
|
-
if (o =
|
|
1099
|
-
const u = r[(h - 1 + r.length) % r.length],
|
|
1099
|
+
if (o = it(s, r[h], c), c < rt && r.length > 1 && t >= rt) {
|
|
1100
|
+
const u = r[(h - 1 + r.length) % r.length], d = it(s, u, u.beats + c), f = nt("ease-in-out")(c / rt);
|
|
1100
1101
|
o = {
|
|
1101
|
-
pose:
|
|
1102
|
-
hands: { left:
|
|
1102
|
+
pose: _e(d.pose, o.pose, f),
|
|
1103
|
+
hands: { left: Ie(d.hands.left, o.hands.left, f), right: Ie(d.hands.right, o.hands.right, f) }
|
|
1103
1104
|
};
|
|
1104
1105
|
}
|
|
1105
1106
|
}
|
|
1106
|
-
return { ...o, pose:
|
|
1107
|
+
return { ...o, pose: xs(o.pose, s.groove, t) };
|
|
1107
1108
|
}
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1109
|
+
function Oi(e, t, n = {}) {
|
|
1110
|
+
return Ot(e, t, n).pose;
|
|
1110
1111
|
}
|
|
1111
|
-
function
|
|
1112
|
-
return (typeof e == "string" ?
|
|
1112
|
+
function It(e) {
|
|
1113
|
+
return (typeof e == "string" ? ve[e] : e).routine.reduce((n, s) => n + s.beats, 0);
|
|
1113
1114
|
}
|
|
1114
|
-
const
|
|
1115
|
-
function
|
|
1115
|
+
const Ps = { leftToe: "rightToe", rightToe: "leftToe", leftHeel: "rightHeel", rightHeel: "leftHeel" };
|
|
1116
|
+
function on(e, t, n, s, o, r, l) {
|
|
1116
1117
|
for (let i = 0; i * e.beats < n; i++)
|
|
1117
1118
|
for (const a of e.keys) {
|
|
1118
1119
|
const h = i * e.beats + a.beat, c = t + h;
|
|
1119
1120
|
if (!(h >= n || c < r || c >= l))
|
|
1120
|
-
for (const u of a.taps ?? []) o.push({ beat: c, tap: s ?
|
|
1121
|
+
for (const u of a.taps ?? []) o.push({ beat: c, tap: s ? Ps[u] : u });
|
|
1121
1122
|
}
|
|
1122
1123
|
}
|
|
1123
|
-
function
|
|
1124
|
-
const o = typeof e == "string" ?
|
|
1124
|
+
function Ii(e, t, n, s = {}) {
|
|
1125
|
+
const o = typeof e == "string" ? ve[e] : e, r = [];
|
|
1125
1126
|
if (n <= t) return r;
|
|
1126
1127
|
if (s.move) {
|
|
1127
1128
|
const l = o.moves[s.move], i = Math.floor(t / l.beats) * l.beats;
|
|
1128
|
-
|
|
1129
|
+
on(l, i, Math.ceil((n - i) / l.beats) * l.beats, s.mirror, r, t, n);
|
|
1129
1130
|
} else {
|
|
1130
|
-
const l =
|
|
1131
|
+
const l = It(o);
|
|
1131
1132
|
for (let i = Math.floor(t / l) * l; i < n; i += l) {
|
|
1132
1133
|
let a = i;
|
|
1133
1134
|
for (const h of o.routine)
|
|
1134
|
-
|
|
1135
|
+
on(o.moves[h.move], a, h.beats, h.mirror, r, t, n), a += h.beats;
|
|
1135
1136
|
}
|
|
1136
1137
|
}
|
|
1137
1138
|
return r.sort((l, i) => l.beat - i.beat);
|
|
1138
1139
|
}
|
|
1139
|
-
function
|
|
1140
|
+
function sn(e, t) {
|
|
1140
1141
|
const n = e.moves[t.move];
|
|
1141
1142
|
if (!n?.travel) return 0;
|
|
1142
1143
|
const s = n.travel / n.beats;
|
|
1143
|
-
return t.mirror ? (
|
|
1144
|
+
return t.mirror ? (Dn(n, Mt(e), Xn(e))[0]?.pose.turn ?? Mt(e).turn ?? 0) >= 0.5 ? s : -s : s;
|
|
1144
1145
|
}
|
|
1145
|
-
function
|
|
1146
|
+
function qn(e, t) {
|
|
1146
1147
|
return t.move ? [{ move: t.move, beats: e.moves[t.move].beats, mirror: t.mirror }] : e.routine;
|
|
1147
1148
|
}
|
|
1148
|
-
function
|
|
1149
|
-
const s = typeof e == "string" ?
|
|
1149
|
+
function lt(e, t, n = {}) {
|
|
1150
|
+
const s = typeof e == "string" ? ve[e] : e, o = qn(s, n), r = o.reduce((c, u) => c + u.beats, 0), l = o.reduce((c, u) => c + sn(s, u) * u.beats, 0), i = Math.floor(t / r);
|
|
1150
1151
|
let a = i * l, h = t - i * r;
|
|
1151
1152
|
for (const c of o) {
|
|
1152
1153
|
const u = Math.min(c.beats, h);
|
|
1153
|
-
if (a +=
|
|
1154
|
+
if (a += sn(s, c) * u, h -= u, h <= 0) break;
|
|
1154
1155
|
}
|
|
1155
1156
|
return a;
|
|
1156
1157
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const s =
|
|
1158
|
+
function Ks(e, t, n) {
|
|
1159
|
+
const s = qn(e, n), o = [0];
|
|
1159
1160
|
let r = 0;
|
|
1160
1161
|
for (let l = 0; r < t; l = (l + 1) % s.length)
|
|
1161
1162
|
r += s[l].beats, o.push(Math.min(r, t));
|
|
1162
1163
|
return o;
|
|
1163
1164
|
}
|
|
1164
|
-
const
|
|
1165
|
-
function
|
|
1166
|
-
const s = typeof t == "string" ?
|
|
1167
|
-
if (l.every((b) =>
|
|
1168
|
-
const i = Math.min(n.fade ?? 1, r / 2), a =
|
|
1165
|
+
const Ws = 8;
|
|
1166
|
+
function Os(e, t, n) {
|
|
1167
|
+
const s = typeof t == "string" ? ve[t] : t, o = n.bpm ?? s.bpm, r = n.beats ?? (n.move ? s.moves[n.move].beats : It(s)), l = Ks(s, r, n);
|
|
1168
|
+
if (l.every((b) => lt(s, b, n) === 0)) return;
|
|
1169
|
+
const i = Math.min(n.fade ?? 1, r / 2), a = nt("ease-in-out"), h = (b) => i <= 0 ? 1 : Math.min(a(Math.min(1, b / i)), a(Math.min(1, (r - b) / i))), c = Math.ceil(i * Ws), u = i <= 0 ? [] : Array.from({ length: c + 1 }, (b, S) => [S / c * i, r - S / c * i]).flat(), d = [.../* @__PURE__ */ new Set([...l, ...u])].sort((b, S) => b - S);
|
|
1169
1170
|
let f = 0;
|
|
1170
|
-
const p =
|
|
1171
|
-
if (
|
|
1172
|
-
const
|
|
1173
|
-
for (let
|
|
1174
|
-
const
|
|
1175
|
-
f += (
|
|
1171
|
+
const p = d.map((b, S) => {
|
|
1172
|
+
if (S > 0) {
|
|
1173
|
+
const k = d[S - 1], v = Math.max(1, Math.ceil((b - k) * 16));
|
|
1174
|
+
for (let H = 0; H < v; H++) {
|
|
1175
|
+
const T = k + (b - k) * H / v, M = k + (b - k) * (H + 1) / v;
|
|
1176
|
+
f += (lt(s, M, n) - lt(s, T, n)) * h((T + M) / 2);
|
|
1176
1177
|
}
|
|
1177
1178
|
}
|
|
1178
1179
|
return { beat: b, travel: f };
|
|
1179
|
-
}),
|
|
1180
|
+
}), g = n.start ?? 0, m = n.x ?? 0;
|
|
1180
1181
|
return {
|
|
1181
1182
|
id: `${e}-x`,
|
|
1182
1183
|
target: e,
|
|
1183
1184
|
property: "x",
|
|
1184
|
-
keyframes: p.map((b) => ({ time:
|
|
1185
|
+
keyframes: p.map((b) => ({ time: g + b.beat * 6e4 / o, value: m + n.height * b.travel, easing: "linear" }))
|
|
1185
1186
|
};
|
|
1186
1187
|
}
|
|
1187
|
-
function
|
|
1188
|
+
function _i(e, t, n = 0) {
|
|
1188
1189
|
return (e - n) * t / 6e4;
|
|
1189
1190
|
}
|
|
1190
|
-
function
|
|
1191
|
-
return (n) =>
|
|
1191
|
+
function $i(e, t = {}) {
|
|
1192
|
+
return (n) => Ot(e, n, t);
|
|
1192
1193
|
}
|
|
1193
|
-
function
|
|
1194
|
+
function Bi(e, t) {
|
|
1194
1195
|
const n = t.start ?? 0, s = 6e4 / t.bpm, o = n + t.beats * s, r = Math.min((t.fade ?? 1) * s, (o - n) / 2);
|
|
1195
1196
|
return [
|
|
1196
1197
|
{
|
|
@@ -1215,26 +1216,26 @@ function Ei(e, t) {
|
|
|
1215
1216
|
}
|
|
1216
1217
|
];
|
|
1217
1218
|
}
|
|
1218
|
-
function
|
|
1219
|
-
const s = typeof t == "string" ?
|
|
1219
|
+
function Fi(e, t, n = {}) {
|
|
1220
|
+
const s = typeof t == "string" ? ve[t] : t, o = n.bpm ?? s.bpm, r = n.beats ?? (n.move ? s.moves[n.move].beats : It(s)), l = n.samplesPerBeat ?? 4, i = n.start ?? 0, a = Math.round(r * l), h = Array.from({ length: a + 1 }, (g, m) => {
|
|
1220
1221
|
const b = m / l;
|
|
1221
|
-
return { time: i + b * 6e4 / o, frame:
|
|
1222
|
-
}), c = (
|
|
1223
|
-
id: `${e}-${
|
|
1222
|
+
return { time: i + b * 6e4 / o, frame: Ot(s, b, n) };
|
|
1223
|
+
}), c = (g, m) => ({
|
|
1224
|
+
id: `${e}-${g}`,
|
|
1224
1225
|
target: e,
|
|
1225
|
-
property:
|
|
1226
|
+
property: g,
|
|
1226
1227
|
keyframes: h.map((b) => ({ time: b.time, value: m(b.frame) }))
|
|
1227
|
-
}),
|
|
1228
|
-
if (f &&
|
|
1228
|
+
}), d = Object.keys(B).filter((g) => h.some((m) => m.frame.pose[g] !== h[0].frame.pose[g]) || h[0].frame.pose[g] !== B[g]).map((g) => c(g, (m) => m.pose[g])), f = n.height === void 0 ? void 0 : Os(e, s, { ...n, bpm: o, beats: r, start: i, height: n.height, fade: 0 });
|
|
1229
|
+
if (f && d.push(f), n.hands === !1) return d;
|
|
1229
1230
|
const p = [];
|
|
1230
|
-
for (const
|
|
1231
|
-
for (const m of Object.keys(
|
|
1232
|
-
const b = (
|
|
1233
|
-
h.some((
|
|
1231
|
+
for (const g of ["left", "right"])
|
|
1232
|
+
for (const m of Object.keys(Y)) {
|
|
1233
|
+
const b = (S) => S.hands?.[g]?.[m] ?? Y[m];
|
|
1234
|
+
h.some((S) => b(S.frame) !== Y[m]) && p.push(c(je(g, m), b));
|
|
1234
1235
|
}
|
|
1235
|
-
return [...
|
|
1236
|
+
return [...d, ...p];
|
|
1236
1237
|
}
|
|
1237
|
-
const
|
|
1238
|
+
const Oe = { type: "back", mode: "out", overshoot: 1.1 }, j = "ease-out-cubic", Is = {
|
|
1238
1239
|
label: "Disco",
|
|
1239
1240
|
bpm: 120,
|
|
1240
1241
|
stance: { leftHip: 10, rightHip: 10, leftKnee: 6, rightKnee: 6 },
|
|
@@ -1244,7 +1245,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1244
1245
|
point: {
|
|
1245
1246
|
label: "The point",
|
|
1246
1247
|
beats: 2,
|
|
1247
|
-
easing:
|
|
1248
|
+
easing: j,
|
|
1248
1249
|
keys: [
|
|
1249
1250
|
{
|
|
1250
1251
|
beat: 0,
|
|
@@ -1269,9 +1270,9 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1269
1270
|
label: "Bump and clap",
|
|
1270
1271
|
beats: 4,
|
|
1271
1272
|
keys: [
|
|
1272
|
-
{ beat: 0, pose: { lean: -10, rightHip: 22, leftHip: 4, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing:
|
|
1273
|
+
{ beat: 0, pose: { lean: -10, rightHip: 22, leftHip: 4, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing: j },
|
|
1273
1274
|
{ beat: 1, pose: { lean: 0, rightHip: 10, leftHip: 10, leftShoulder: 168, rightShoulder: 168, leftElbow: 22, rightElbow: 22, leftWrist: 0, rightWrist: 0 }, hands: { left: "flat", right: "flat" } },
|
|
1274
|
-
{ beat: 2, pose: { lean: 10, rightHip: 4, leftHip: 22, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing:
|
|
1275
|
+
{ beat: 2, pose: { lean: 10, rightHip: 4, leftHip: 22, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing: j },
|
|
1275
1276
|
{ beat: 3, pose: { lean: 0, rightHip: 10, leftHip: 10, leftShoulder: 168, rightShoulder: 168, leftElbow: 22, rightElbow: 22, leftWrist: 0, rightWrist: 0 }, hands: { left: "flat", right: "flat" } }
|
|
1276
1277
|
]
|
|
1277
1278
|
}
|
|
@@ -1282,7 +1283,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1282
1283
|
{ move: "point", beats: 8, mirror: !0 },
|
|
1283
1284
|
{ move: "bump", beats: 8 }
|
|
1284
1285
|
]
|
|
1285
|
-
},
|
|
1286
|
+
}, _s = {
|
|
1286
1287
|
label: "Hip hop",
|
|
1287
1288
|
bpm: 95,
|
|
1288
1289
|
stance: { leftHip: 14, rightHip: 14, leftKnee: 20, rightKnee: 20, leftShoulder: 22, rightShoulder: 22, leftElbow: -30, rightElbow: -30, leftFootOut: 0.15, rightFootOut: 0.15 },
|
|
@@ -1334,7 +1335,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1334
1335
|
{ move: "armWave", beats: 8 },
|
|
1335
1336
|
{ move: "bounce", beats: 4 }
|
|
1336
1337
|
]
|
|
1337
|
-
},
|
|
1338
|
+
}, $s = {
|
|
1338
1339
|
label: "Breaking (toprock)",
|
|
1339
1340
|
bpm: 110,
|
|
1340
1341
|
stance: { leftHip: 14, rightHip: 14, leftKnee: 14, rightKnee: 14, leftShoulder: 35, rightShoulder: 35, leftElbow: -90, rightElbow: -90 },
|
|
@@ -1346,9 +1347,9 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1346
1347
|
label: "Toprock (Indian step)",
|
|
1347
1348
|
beats: 4,
|
|
1348
1349
|
keys: [
|
|
1349
|
-
{ beat: 0, pose: { rightHip: -24, rightKnee: 10, leftHip: 10, leftShoulder: 80, leftElbow: 40, rightShoulder: 55, rightElbow: -50, lean: 6, headTilt: -6 }, easing:
|
|
1350
|
+
{ beat: 0, pose: { rightHip: -24, rightKnee: 10, leftHip: 10, leftShoulder: 80, leftElbow: 40, rightShoulder: 55, rightElbow: -50, lean: 6, headTilt: -6 }, easing: j },
|
|
1350
1351
|
{ beat: 1, reset: !0, pose: { leftHip: 18, rightHip: 18 } },
|
|
1351
|
-
{ beat: 2, pose: { leftHip: -24, leftKnee: 10, rightHip: 10, rightShoulder: 80, rightElbow: 40, leftShoulder: 55, leftElbow: -50, lean: -6, headTilt: 6 }, easing:
|
|
1352
|
+
{ beat: 2, pose: { leftHip: -24, leftKnee: 10, rightHip: 10, rightShoulder: 80, rightElbow: 40, leftShoulder: 55, leftElbow: -50, lean: -6, headTilt: 6 }, easing: j },
|
|
1352
1353
|
{ beat: 3, reset: !0, pose: { leftHip: 18, rightHip: 18 } }
|
|
1353
1354
|
]
|
|
1354
1355
|
},
|
|
@@ -1356,7 +1357,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1356
1357
|
label: "Kick out",
|
|
1357
1358
|
beats: 2,
|
|
1358
1359
|
keys: [
|
|
1359
|
-
{ beat: 0, pose: { rightHip: 72, rightKnee: 4, rightAnkle: -20, leftHip: 4, lean: -12, leftShoulder: 100, leftElbow: 20 }, easing:
|
|
1360
|
+
{ beat: 0, pose: { rightHip: 72, rightKnee: 4, rightAnkle: -20, leftHip: 4, lean: -12, leftShoulder: 100, leftElbow: 20 }, easing: j },
|
|
1360
1361
|
{ beat: 1, reset: !0 }
|
|
1361
1362
|
]
|
|
1362
1363
|
},
|
|
@@ -1364,7 +1365,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1364
1365
|
label: "B-boy stance",
|
|
1365
1366
|
beats: 4,
|
|
1366
1367
|
keys: [
|
|
1367
|
-
{ beat: 0, reset: !0, pose: { leftShoulder: 26, leftElbow: -122, rightShoulder: 22, rightElbow: -118, leftHip: 18, rightHip: 18, leftKnee: 6, rightKnee: 6, lean: -4, headTilt: 10, smile: 0.6, leftEye: 0.6, rightEye: 0.6 }, easing:
|
|
1368
|
+
{ beat: 0, reset: !0, pose: { leftShoulder: 26, leftElbow: -122, rightShoulder: 22, rightElbow: -118, leftHip: 18, rightHip: 18, leftKnee: 6, rightKnee: 6, lean: -4, headTilt: 10, smile: 0.6, leftEye: 0.6, rightEye: 0.6 }, easing: Oe },
|
|
1368
1369
|
{ beat: 2, pose: { headTilt: 14, lean: -6 } }
|
|
1369
1370
|
]
|
|
1370
1371
|
}
|
|
@@ -1376,7 +1377,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1376
1377
|
{ move: "kick", beats: 4, mirror: !0 },
|
|
1377
1378
|
{ move: "freeze", beats: 4 }
|
|
1378
1379
|
]
|
|
1379
|
-
},
|
|
1380
|
+
}, Bs = {
|
|
1380
1381
|
label: "Jazz",
|
|
1381
1382
|
bpm: 130,
|
|
1382
1383
|
stance: { leftHip: 10, rightHip: 10 },
|
|
@@ -1392,14 +1393,14 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1392
1393
|
beat: e,
|
|
1393
1394
|
// The hands shimmer: the wrists flick a little each quarter beat.
|
|
1394
1395
|
pose: { leftShoulder: 128, rightShoulder: 128, leftElbow: 8, rightElbow: 8, leftWrist: t % 2 ? 4 : 26, rightWrist: t % 2 ? 26 : 4, leftHip: 16, rightHip: 16, leftKnee: e < 1 ? 26 : 8, rightKnee: e < 1 ? 26 : 8 },
|
|
1395
|
-
hands: t === 0 ? { left: { ...
|
|
1396
|
+
hands: t === 0 ? { left: { ...q.spread, turn: 2 }, right: { ...q.spread, turn: 2 } } : void 0
|
|
1396
1397
|
}))
|
|
1397
1398
|
},
|
|
1398
1399
|
kickBallChange: {
|
|
1399
1400
|
label: "Kick ball change",
|
|
1400
1401
|
beats: 2,
|
|
1401
1402
|
keys: [
|
|
1402
|
-
{ beat: 0, reset: !0, pose: { rightHip: 88, rightKnee: 0, rightAnkle: 55, leftHip: 4, lean: -12, leftShoulder: 112, rightShoulder: 112, leftWrist: 15, rightWrist: 15 }, hands: { left: "flat", right: "flat" }, easing:
|
|
1403
|
+
{ beat: 0, reset: !0, pose: { rightHip: 88, rightKnee: 0, rightAnkle: 55, leftHip: 4, lean: -12, leftShoulder: 112, rightShoulder: 112, leftWrist: 15, rightWrist: 15 }, hands: { left: "flat", right: "flat" }, easing: j },
|
|
1403
1404
|
{ beat: 1, reset: !0, pose: { rightHip: 10, rightKnee: 24, rightAnkle: 45, leftShoulder: 60, rightShoulder: 60, leftElbow: -20, rightElbow: -20 } },
|
|
1404
1405
|
{ beat: 1.5, pose: { rightAnkle: 0, rightKnee: 6, leftAnkle: 45, leftKnee: 20 } }
|
|
1405
1406
|
]
|
|
@@ -1437,7 +1438,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1437
1438
|
{ move: "jazzHands", beats: 4 },
|
|
1438
1439
|
{ move: "splitDrop", beats: 8 }
|
|
1439
1440
|
]
|
|
1440
|
-
},
|
|
1441
|
+
}, Fs = {
|
|
1441
1442
|
label: "K-pop",
|
|
1442
1443
|
bpm: 125,
|
|
1443
1444
|
stance: { leftHip: 9, rightHip: 9, leftKnee: 4, rightKnee: 4 },
|
|
@@ -1447,7 +1448,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1447
1448
|
pointCombo: {
|
|
1448
1449
|
label: "Point combo",
|
|
1449
1450
|
beats: 4,
|
|
1450
|
-
easing:
|
|
1451
|
+
easing: Oe,
|
|
1451
1452
|
keys: [
|
|
1452
1453
|
{ beat: 0, reset: !0, pose: { rightShoulder: 142, rightElbow: 0, leftShoulder: 25, leftElbow: -125, headTilt: 6, lean: -3, lookX: 0.6, lookY: -0.6 }, hands: { right: "point", left: "flat" } },
|
|
1453
1454
|
{ beat: 1, pose: { rightShoulder: -38, headTilt: -6, lean: 3, lookX: -0.3, lookY: 0.5, rightHip: 18 } },
|
|
@@ -1459,16 +1460,16 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1459
1460
|
label: "Big heart, finger heart",
|
|
1460
1461
|
beats: 4,
|
|
1461
1462
|
keys: [
|
|
1462
|
-
{ beat: 0, reset: !0, pose: { leftShoulder: 165, rightShoulder: 165, leftElbow: 46, rightElbow: 46, headTilt: -8, lean: -4 }, hands: { left: "cupped", right: "cupped" }, easing:
|
|
1463
|
+
{ beat: 0, reset: !0, pose: { leftShoulder: 165, rightShoulder: 165, leftElbow: 46, rightElbow: 46, headTilt: -8, lean: -4 }, hands: { left: "cupped", right: "cupped" }, easing: Oe },
|
|
1463
1464
|
{ beat: 1, pose: { headTilt: 8, lean: 4 } },
|
|
1464
|
-
{ beat: 2, reset: !0, pose: { rightShoulder: 32, rightElbow: 112, rightWrist: 10, leftShoulder: 20, leftElbow: -30, headTilt: 10, leftEye: 0, smile: 1 }, hands: { right: "pinch", left: "relaxed" }, easing:
|
|
1465
|
+
{ beat: 2, reset: !0, pose: { rightShoulder: 32, rightElbow: 112, rightWrist: 10, leftShoulder: 20, leftElbow: -30, headTilt: 10, leftEye: 0, smile: 1 }, hands: { right: "pinch", left: "relaxed" }, easing: Oe },
|
|
1465
1466
|
{ beat: 3, pose: { headTilt: 4 } }
|
|
1466
1467
|
]
|
|
1467
1468
|
},
|
|
1468
1469
|
isolations: {
|
|
1469
1470
|
label: "Isolations",
|
|
1470
1471
|
beats: 2,
|
|
1471
|
-
easing:
|
|
1472
|
+
easing: j,
|
|
1472
1473
|
keys: [
|
|
1473
1474
|
{ beat: 0, reset: !0, pose: { lean: -9, headTilt: 11, leftShoulder: 55, leftElbow: -112, rightShoulder: 55, rightElbow: -112, rightHip: 18 }, hands: { left: "fist", right: "fist" } },
|
|
1474
1475
|
{ beat: 0.5, pose: { lean: 0, headTilt: 0, rightHip: 9 } },
|
|
@@ -1484,7 +1485,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1484
1485
|
{ move: "pointCombo", beats: 8, mirror: !0 },
|
|
1485
1486
|
{ move: "isolations", beats: 4 }
|
|
1486
1487
|
]
|
|
1487
|
-
},
|
|
1488
|
+
}, Rs = {
|
|
1488
1489
|
label: "Bollywood",
|
|
1489
1490
|
bpm: 120,
|
|
1490
1491
|
stance: { leftHip: 10, rightHip: 10 },
|
|
@@ -1495,19 +1496,19 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1495
1496
|
label: "Screw the bulb, pat the dog",
|
|
1496
1497
|
beats: 2,
|
|
1497
1498
|
keys: [
|
|
1498
|
-
{ beat: 0, reset: !0, pose: { rightShoulder: 160, rightElbow: 12, rightWrist: -15, leftShoulder: 40, leftElbow: -12, leftWrist: -45, lean: -4, rightHip: 16, lookX: 0.5, lookY: -0.6 }, hands: { right: { ...
|
|
1499
|
-
{ beat: 0.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...
|
|
1500
|
-
{ beat: 1, pose: { rightWrist: -15, rightElbow: 12, leftWrist: -45, lean: -4, rightHip: 16, leftHip: 6 }, hands: { right: { ...
|
|
1501
|
-
{ beat: 1.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...
|
|
1499
|
+
{ beat: 0, reset: !0, pose: { rightShoulder: 160, rightElbow: 12, rightWrist: -15, leftShoulder: 40, leftElbow: -12, leftWrist: -45, lean: -4, rightHip: 16, lookX: 0.5, lookY: -0.6 }, hands: { right: { ...q.cupped, roll: -30 }, left: { ...q.flat, turn: 0 } } },
|
|
1500
|
+
{ beat: 0.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...q.cupped, roll: 30 } } },
|
|
1501
|
+
{ beat: 1, pose: { rightWrist: -15, rightElbow: 12, leftWrist: -45, lean: -4, rightHip: 16, leftHip: 6 }, hands: { right: { ...q.cupped, roll: -30 } } },
|
|
1502
|
+
{ beat: 1.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...q.cupped, roll: 30 } } }
|
|
1502
1503
|
]
|
|
1503
1504
|
},
|
|
1504
1505
|
thumka: {
|
|
1505
1506
|
label: "Thumka",
|
|
1506
1507
|
beats: 2,
|
|
1507
1508
|
keys: [
|
|
1508
|
-
{ beat: 0, reset: !0, pose: { lean: -11, rightHip: 22, leftHip: 2, leftKnee: 14, rightShoulder: 45, rightElbow: -105, leftShoulder: 128, leftElbow: 18, leftWrist: 35, headTilt: 10, lookX: -0.5 }, hands: { right: "fist", left: { ...
|
|
1509
|
+
{ beat: 0, reset: !0, pose: { lean: -11, rightHip: 22, leftHip: 2, leftKnee: 14, rightShoulder: 45, rightElbow: -105, leftShoulder: 128, leftElbow: 18, leftWrist: 35, headTilt: 10, lookX: -0.5 }, hands: { right: "fist", left: { ...q.open, turn: 2 } }, easing: j },
|
|
1509
1510
|
{ beat: 0.5, pose: { lean: -4, rightHip: 12, headTilt: 6 } },
|
|
1510
|
-
{ beat: 1, pose: { lean: -11, rightHip: 22, headTilt: 10 }, easing:
|
|
1511
|
+
{ beat: 1, pose: { lean: -11, rightHip: 22, headTilt: 10 }, easing: j },
|
|
1511
1512
|
{ beat: 1.5, pose: { lean: -4, rightHip: 12, headTilt: 6 } }
|
|
1512
1513
|
]
|
|
1513
1514
|
},
|
|
@@ -1516,9 +1517,9 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1516
1517
|
beats: 4,
|
|
1517
1518
|
keys: [
|
|
1518
1519
|
{ beat: 0, reset: !0, pose: { leftShoulder: 22, rightShoulder: 22, leftElbow: -62, rightElbow: -62, leftHip: 16, rightHip: 16, leftKnee: 26, rightKnee: 26 }, hands: { left: "fist", right: "fist" } },
|
|
1519
|
-
{ beat: 1, pose: { leftShoulder: 132, rightShoulder: 132, leftElbow: 0, rightElbow: 0, leftWrist: 30, rightWrist: 30, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10, stretch: 1.03 }, hands: { left: "spread", right: "spread" }, easing:
|
|
1520
|
+
{ beat: 1, pose: { leftShoulder: 132, rightShoulder: 132, leftElbow: 0, rightElbow: 0, leftWrist: 30, rightWrist: 30, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10, stretch: 1.03 }, hands: { left: "spread", right: "spread" }, easing: j },
|
|
1520
1521
|
{ beat: 2, pose: { leftShoulder: 22, rightShoulder: 22, leftElbow: -62, rightElbow: -62, leftWrist: 0, rightWrist: 0, leftHip: 16, rightHip: 16, leftKnee: 26, rightKnee: 26, stretch: 1 }, hands: { left: "fist", right: "fist" } },
|
|
1521
|
-
{ beat: 3, pose: { leftShoulder: 62, rightShoulder: 62, leftElbow: 0, rightElbow: 0, leftWrist: 35, rightWrist: 35, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10 }, hands: { left: "spread", right: "spread" }, easing:
|
|
1522
|
+
{ beat: 3, pose: { leftShoulder: 62, rightShoulder: 62, leftElbow: 0, rightElbow: 0, leftWrist: 35, rightWrist: 35, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10 }, hands: { left: "spread", right: "spread" }, easing: j }
|
|
1522
1523
|
]
|
|
1523
1524
|
}
|
|
1524
1525
|
},
|
|
@@ -1529,7 +1530,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1529
1530
|
{ move: "thumka", beats: 4, mirror: !0 },
|
|
1530
1531
|
{ move: "lightBulb", beats: 8, mirror: !0 }
|
|
1531
1532
|
]
|
|
1532
|
-
},
|
|
1533
|
+
}, Ns = {
|
|
1533
1534
|
label: "Bhangra",
|
|
1534
1535
|
bpm: 100,
|
|
1535
1536
|
stance: { leftShoulder: 150, rightShoulder: 150, leftElbow: 18, rightElbow: 18, leftHip: 10, rightHip: 10 },
|
|
@@ -1564,11 +1565,11 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1564
1565
|
{ move: "basic", beats: 8 },
|
|
1565
1566
|
{ move: "dhamaal", beats: 4 }
|
|
1566
1567
|
]
|
|
1567
|
-
},
|
|
1568
|
+
}, Ls = { leftHip: 42, rightHip: 42, leftKnee: 82, rightKnee: 82, leftFootOut: 0.3, rightFootOut: 0.3 }, Ys = {
|
|
1568
1569
|
label: "Bharatanatyam",
|
|
1569
1570
|
bpm: 80,
|
|
1570
1571
|
// Natyarambhe: arms out at shoulder height, hands raised in pataka.
|
|
1571
|
-
stance: { ...
|
|
1572
|
+
stance: { ...Ls, leftShoulder: 90, rightShoulder: 90, leftElbow: 0, rightElbow: 0, leftWrist: 75, rightWrist: 75 },
|
|
1572
1573
|
expression: { smile: 0.5, leftEye: 1.2, rightEye: 1.2, leftBrow: 0.3, rightBrow: 0.3 },
|
|
1573
1574
|
hands: { left: "pataka", right: "pataka" },
|
|
1574
1575
|
groove: { bounce: 0 },
|
|
@@ -1610,21 +1611,21 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1610
1611
|
{ move: "alapadma", beats: 8 },
|
|
1611
1612
|
{ move: "tatta", beats: 4 }
|
|
1612
1613
|
]
|
|
1613
|
-
},
|
|
1614
|
+
}, Cs = {
|
|
1614
1615
|
label: "Charleston",
|
|
1615
1616
|
bpm: 150,
|
|
1616
1617
|
stance: { leftHip: 10, rightHip: 10, leftKnee: 10, rightKnee: 10, leftShoulder: 30, rightShoulder: 30, leftElbow: 20, rightElbow: 20 },
|
|
1617
1618
|
expression: { mouth: 0.4, smile: 1, leftBrow: 0.5, rightBrow: 0.5 },
|
|
1618
|
-
hands: { left: { ...
|
|
1619
|
+
hands: { left: { ...q.spread, turn: 2 }, right: { ...q.spread, turn: 2 } },
|
|
1619
1620
|
groove: { bounce: 8, accent: "down" },
|
|
1620
1621
|
moves: {
|
|
1621
1622
|
basic: {
|
|
1622
1623
|
label: "Kick forward, kick back",
|
|
1623
1624
|
beats: 4,
|
|
1624
1625
|
keys: [
|
|
1625
|
-
{ beat: 0, reset: !0, pose: { rightHip: 48, rightKnee: 8, rightAnkle: 45, leftShoulder: 75, rightShoulder: 15, leftElbow: 30, rightElbow: -10, lean: -7, headTilt: -5 }, easing:
|
|
1626
|
+
{ beat: 0, reset: !0, pose: { rightHip: 48, rightKnee: 8, rightAnkle: 45, leftShoulder: 75, rightShoulder: 15, leftElbow: 30, rightElbow: -10, lean: -7, headTilt: -5 }, easing: j },
|
|
1626
1627
|
{ beat: 1, reset: !0 },
|
|
1627
|
-
{ beat: 2, reset: !0, pose: { leftHip: 18, leftKnee: 85, leftAnkle: 35, rightShoulder: 75, leftShoulder: 15, rightElbow: 30, leftElbow: -10, lean: 7, headTilt: 5 }, easing:
|
|
1628
|
+
{ beat: 2, reset: !0, pose: { leftHip: 18, leftKnee: 85, leftAnkle: 35, rightShoulder: 75, leftShoulder: 15, rightElbow: 30, leftElbow: -10, lean: 7, headTilt: 5 }, easing: j },
|
|
1628
1629
|
{ beat: 3, reset: !0 }
|
|
1629
1630
|
]
|
|
1630
1631
|
},
|
|
@@ -1660,7 +1661,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1660
1661
|
{ move: "basic", beats: 8, mirror: !0 },
|
|
1661
1662
|
{ move: "twist", beats: 4 }
|
|
1662
1663
|
]
|
|
1663
|
-
},
|
|
1664
|
+
}, Ds = {
|
|
1664
1665
|
label: "Tap",
|
|
1665
1666
|
bpm: 120,
|
|
1666
1667
|
// Three-quarters to side-on, so shuffles read as brushes forward and back. Side-on,
|
|
@@ -1746,7 +1747,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1746
1747
|
{ beat: 0.75, pose: { rightAnkle: 0, rise: 0 }, taps: ["rightHeel"] },
|
|
1747
1748
|
{ beat: 0.875, pose: { leftAnkle: 0 }, taps: ["leftHeel"] },
|
|
1748
1749
|
// Arms flare on the finish: one up in front, one up behind.
|
|
1749
|
-
{ beat: 1, pose: { rightShoulder: 135, leftShoulder: 125, leftElbow: 0, rightElbow: 0, leftWrist: 0, rightWrist: 30, rightKnee: 8, leftKnee: -8, rightHip: 4, leftHip: -4 }, hands: { left: { ...
|
|
1750
|
+
{ beat: 1, pose: { rightShoulder: 135, leftShoulder: 125, leftElbow: 0, rightElbow: 0, leftWrist: 0, rightWrist: 30, rightKnee: 8, leftKnee: -8, rightHip: 4, leftHip: -4 }, hands: { left: { ...q.spread, turn: 2 }, right: { ...q.spread, turn: 2 } } },
|
|
1750
1751
|
{ beat: 1.75, reset: !0 }
|
|
1751
1752
|
]
|
|
1752
1753
|
}
|
|
@@ -1758,7 +1759,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1758
1759
|
{ move: "heelToe", beats: 8 },
|
|
1759
1760
|
{ move: "crampRoll", beats: 4 }
|
|
1760
1761
|
]
|
|
1761
|
-
},
|
|
1762
|
+
}, Xs = {
|
|
1762
1763
|
label: "Popping (glides, moonwalk)",
|
|
1763
1764
|
bpm: 100,
|
|
1764
1765
|
stance: { leftHip: 9, rightHip: 9, leftShoulder: 16, rightShoulder: 16, leftElbow: -24, rightElbow: -24 },
|
|
@@ -1818,7 +1819,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1818
1819
|
reset: !0,
|
|
1819
1820
|
pose: { leftHip: 6, rightHip: 6, leftKnee: 0, rightKnee: 0, leftAnkle: 65, rightAnkle: 65, rightShoulder: 150, rightElbow: 75, leftShoulder: 30, leftElbow: 20, headTilt: -10, lookY: 0.4 },
|
|
1820
1821
|
hands: { right: "fist", left: "fist" },
|
|
1821
|
-
easing:
|
|
1822
|
+
easing: Oe
|
|
1822
1823
|
},
|
|
1823
1824
|
{ beat: 2, pose: { headTilt: -14, lean: -2 } }
|
|
1824
1825
|
]
|
|
@@ -1831,55 +1832,55 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
|
|
|
1831
1832
|
{ move: "forwardGlide", beats: 8 },
|
|
1832
1833
|
{ move: "toeStand", beats: 4 }
|
|
1833
1834
|
]
|
|
1834
|
-
},
|
|
1835
|
-
disco:
|
|
1836
|
-
hipHop:
|
|
1837
|
-
breaking:
|
|
1838
|
-
jazz:
|
|
1839
|
-
kpop:
|
|
1840
|
-
bollywood:
|
|
1841
|
-
bhangra:
|
|
1842
|
-
bharatanatyam:
|
|
1843
|
-
charleston:
|
|
1844
|
-
tap:
|
|
1845
|
-
popping:
|
|
1846
|
-
},
|
|
1847
|
-
function
|
|
1848
|
-
const t = { ...
|
|
1835
|
+
}, ve = {
|
|
1836
|
+
disco: Is,
|
|
1837
|
+
hipHop: _s,
|
|
1838
|
+
breaking: $s,
|
|
1839
|
+
jazz: Bs,
|
|
1840
|
+
kpop: Fs,
|
|
1841
|
+
bollywood: Rs,
|
|
1842
|
+
bhangra: Ns,
|
|
1843
|
+
bharatanatyam: Ys,
|
|
1844
|
+
charleston: Cs,
|
|
1845
|
+
tap: Ds,
|
|
1846
|
+
popping: Xs
|
|
1847
|
+
}, Ze = (e) => Math.min(1, Math.max(0, e));
|
|
1848
|
+
function qs(e) {
|
|
1849
|
+
const t = { ...B, turn: e.view }, n = [];
|
|
1849
1850
|
for (const s of e.keys) {
|
|
1850
1851
|
const o = n[n.length - 1], r = !o || s.reset ? t : o.pose;
|
|
1851
1852
|
n.push({ at: s.at, pose: { ...r, ...s.pose }, easing: s.easing });
|
|
1852
1853
|
}
|
|
1853
1854
|
return n;
|
|
1854
1855
|
}
|
|
1855
|
-
function
|
|
1856
|
-
return e -
|
|
1856
|
+
function Gs(e) {
|
|
1857
|
+
return e - Us * Math.sin(2 * Math.PI * e) / (2 * Math.PI);
|
|
1857
1858
|
}
|
|
1858
|
-
const
|
|
1859
|
-
function
|
|
1859
|
+
const Us = 0.5;
|
|
1860
|
+
function zs(e, t) {
|
|
1860
1861
|
if (!(t <= e.takeoff || t >= e.landing))
|
|
1861
1862
|
return (t - e.takeoff) / (e.landing - e.takeoff);
|
|
1862
1863
|
}
|
|
1863
|
-
function
|
|
1864
|
-
const n = typeof e == "string" ?
|
|
1864
|
+
function Vs(e, t) {
|
|
1865
|
+
const n = typeof e == "string" ? _t[e] : e, s = qs(n), o = Ze(t);
|
|
1865
1866
|
let r = 0;
|
|
1866
1867
|
for (let u = 0; u < s.length; u++) s[u].at <= o && (r = u);
|
|
1867
|
-
const l = s[r], i = s[Math.min(r + 1, s.length - 1)], a = i.at > l.at ? (o - l.at) / (i.at - l.at) : 0, h =
|
|
1868
|
+
const l = s[r], i = s[Math.min(r + 1, s.length - 1)], a = i.at > l.at ? (o - l.at) / (i.at - l.at) : 0, h = _e(l.pose, i.pose, nt(i.easing ?? "ease-in-out")(Ze(a))), c = zs(n, o);
|
|
1868
1869
|
return c === void 0 ? { ...h, spin: 0, rise: 0 } : {
|
|
1869
1870
|
...h,
|
|
1870
|
-
spin: n.spin *
|
|
1871
|
+
spin: n.spin * Gs(c),
|
|
1871
1872
|
rise: 4 * n.height * c * (1 - c)
|
|
1872
1873
|
};
|
|
1873
1874
|
}
|
|
1874
|
-
function
|
|
1875
|
-
const s = typeof e == "string" ?
|
|
1875
|
+
function js(e, t, n) {
|
|
1876
|
+
const s = typeof e == "string" ? _t[e] : e, o = Ze(t), r = Ze((o - s.takeoff) / (s.landing - s.takeoff));
|
|
1876
1877
|
return s.travel * n * r;
|
|
1877
1878
|
}
|
|
1878
|
-
function
|
|
1879
|
-
const s = typeof t == "string" ?
|
|
1880
|
-
const
|
|
1881
|
-
return { time: o +
|
|
1882
|
-
}), h = Object.keys(
|
|
1879
|
+
function Ri(e, t, n = {}) {
|
|
1880
|
+
const s = typeof t == "string" ? _t[t] : t, o = n.start ?? 0, r = n.duration ?? s.duration, l = n.samples ?? 48, i = Array.from({ length: l + 1 }, (c, u) => {
|
|
1881
|
+
const d = u / l;
|
|
1882
|
+
return { time: o + d * r, progress: d, pose: Vs(s, d) };
|
|
1883
|
+
}), h = Object.keys(B).filter((c) => i.some((u) => u.pose[c] !== B[c])).map((c) => ({
|
|
1883
1884
|
id: `${e}-${c}`,
|
|
1884
1885
|
target: e,
|
|
1885
1886
|
property: c,
|
|
@@ -1891,12 +1892,12 @@ function Hi(e, t, n = {}) {
|
|
|
1891
1892
|
id: `${e}-x`,
|
|
1892
1893
|
target: e,
|
|
1893
1894
|
property: "x",
|
|
1894
|
-
keyframes: i.map((u) => ({ time: u.time, value: (n.x ?? 0) + c *
|
|
1895
|
+
keyframes: i.map((u) => ({ time: u.time, value: (n.x ?? 0) + c * js(s, u.progress, n.height) }))
|
|
1895
1896
|
});
|
|
1896
1897
|
}
|
|
1897
1898
|
return h;
|
|
1898
1899
|
}
|
|
1899
|
-
const
|
|
1900
|
+
const Js = {
|
|
1900
1901
|
leftHip: -55,
|
|
1901
1902
|
leftKnee: -95,
|
|
1902
1903
|
rightHip: 55,
|
|
@@ -1908,7 +1909,7 @@ const Ds = {
|
|
|
1908
1909
|
lean: 22,
|
|
1909
1910
|
stretch: 0.94,
|
|
1910
1911
|
headTilt: 6
|
|
1911
|
-
},
|
|
1912
|
+
}, Zs = {
|
|
1912
1913
|
leftHip: 0,
|
|
1913
1914
|
leftKnee: 0,
|
|
1914
1915
|
rightHip: 0,
|
|
@@ -1922,7 +1923,7 @@ const Ds = {
|
|
|
1922
1923
|
lean: 0,
|
|
1923
1924
|
stretch: 1.08,
|
|
1924
1925
|
headTilt: 0
|
|
1925
|
-
},
|
|
1926
|
+
}, Re = {
|
|
1926
1927
|
leftHip: -128,
|
|
1927
1928
|
leftKnee: -152,
|
|
1928
1929
|
rightHip: 128,
|
|
@@ -1936,7 +1937,7 @@ const Ds = {
|
|
|
1936
1937
|
lean: 26,
|
|
1937
1938
|
stretch: 1,
|
|
1938
1939
|
headTilt: 14
|
|
1939
|
-
},
|
|
1940
|
+
}, Qs = {
|
|
1940
1941
|
leftHip: -22,
|
|
1941
1942
|
leftKnee: -30,
|
|
1942
1943
|
rightHip: 22,
|
|
@@ -1949,7 +1950,7 @@ const Ds = {
|
|
|
1949
1950
|
rightElbow: 0,
|
|
1950
1951
|
lean: 8,
|
|
1951
1952
|
headTilt: 0
|
|
1952
|
-
},
|
|
1953
|
+
}, er = {
|
|
1953
1954
|
leftHip: -58,
|
|
1954
1955
|
leftKnee: -100,
|
|
1955
1956
|
rightHip: 58,
|
|
@@ -1963,7 +1964,7 @@ const Ds = {
|
|
|
1963
1964
|
lean: 20,
|
|
1964
1965
|
stretch: 0.93
|
|
1965
1966
|
};
|
|
1966
|
-
function
|
|
1967
|
+
function be(e, t, n, s, o, r = 1300) {
|
|
1967
1968
|
return {
|
|
1968
1969
|
label: e,
|
|
1969
1970
|
view: 1,
|
|
@@ -1975,30 +1976,30 @@ function pe(e, t, n, s, o, r = 1300) {
|
|
|
1975
1976
|
duration: r,
|
|
1976
1977
|
keys: [
|
|
1977
1978
|
{ at: 0, reset: !0 },
|
|
1978
|
-
{ at: 0.16, pose:
|
|
1979
|
-
{ at: 0.27, pose:
|
|
1979
|
+
{ at: 0.16, pose: Js },
|
|
1980
|
+
{ at: 0.27, pose: Zs, easing: "ease-out-quad" },
|
|
1980
1981
|
...o,
|
|
1981
|
-
{ at: 0.76, pose:
|
|
1982
|
-
{ at: 0.86, pose:
|
|
1982
|
+
{ at: 0.76, pose: Qs },
|
|
1983
|
+
{ at: 0.86, pose: er, easing: "ease-out-quad" },
|
|
1983
1984
|
{ at: 1, reset: !0 }
|
|
1984
1985
|
]
|
|
1985
1986
|
};
|
|
1986
1987
|
}
|
|
1987
|
-
const
|
|
1988
|
-
frontFlip:
|
|
1989
|
-
{ at: 0.38, pose:
|
|
1990
|
-
{ at: 0.64, pose:
|
|
1988
|
+
const _t = {
|
|
1989
|
+
frontFlip: be("Front flip (tuck)", 360, 0.56, 0.35, [
|
|
1990
|
+
{ at: 0.38, pose: Re, easing: "ease-out-cubic" },
|
|
1991
|
+
{ at: 0.64, pose: Re }
|
|
1991
1992
|
]),
|
|
1992
|
-
backFlip:
|
|
1993
|
-
{ at: 0.36, pose: { ...
|
|
1994
|
-
{ at: 0.64, pose: { ...
|
|
1993
|
+
backFlip: be("Back flip (tuck)", -360, 0.58, -0.15, [
|
|
1994
|
+
{ at: 0.36, pose: { ...Re, lean: 18 }, easing: "ease-out-cubic" },
|
|
1995
|
+
{ at: 0.64, pose: { ...Re, lean: 18 } }
|
|
1995
1996
|
]),
|
|
1996
|
-
layout:
|
|
1997
|
+
layout: be("Back layout (straight body)", -360, 0.66, -0.2, [
|
|
1997
1998
|
// Arched, arms overhead, legs together and long.
|
|
1998
1999
|
{ at: 0.4, pose: { leftHip: 8, rightHip: -8, leftKnee: 0, rightKnee: 0, leftAnkle: 60, rightAnkle: 60, leftShoulder: -178, rightShoulder: 178, lean: -18, headTilt: -14 } },
|
|
1999
2000
|
{ at: 0.64, pose: { leftHip: -4, rightHip: 4, lean: -6, headTilt: -4, leftShoulder: -150, rightShoulder: 150 } }
|
|
2000
2001
|
], 1400),
|
|
2001
|
-
scissorFlip:
|
|
2002
|
+
scissorFlip: be("Scissor flip", 360, 0.6, 0.45, [
|
|
2002
2003
|
// The legs scissor through the turn: left kicks high, then they switch.
|
|
2003
2004
|
{ at: 0.36, pose: { leftHip: -105, leftKnee: 0, rightHip: -40, rightKnee: -20, leftAnkle: 50, rightAnkle: 50, leftShoulder: -150, rightShoulder: 150, leftElbow: 0, rightElbow: 0, lean: 12 }, easing: "ease-out-cubic" },
|
|
2004
2005
|
{ at: 0.52, pose: { leftHip: 40, leftKnee: 20, rightHip: 105, rightKnee: 0, leftShoulder: -140, rightShoulder: 140 } },
|
|
@@ -2044,7 +2045,7 @@ const Pt = {
|
|
|
2044
2045
|
]
|
|
2045
2046
|
},
|
|
2046
2047
|
// Leaps: no turn, the shape is the trick.
|
|
2047
|
-
splitLeap:
|
|
2048
|
+
splitLeap: be("Split leap (grand jeté)", 0, 0.36, 0.9, [
|
|
2048
2049
|
// A front split in the air: front leg reaching, back leg long, arms open.
|
|
2049
2050
|
{ at: 0.4, pose: { leftHip: -96, rightHip: -84, leftKnee: 0, rightKnee: 0, leftAnkle: 55, rightAnkle: 55, leftShoulder: -130, rightShoulder: -105, leftElbow: 0, rightElbow: 0, lean: 4, headTilt: -6 }, easing: "ease-out-cubic" },
|
|
2050
2051
|
{ at: 0.64, pose: { lean: 2 } }
|
|
@@ -2070,14 +2071,15 @@ const Pt = {
|
|
|
2070
2071
|
{ at: 1, reset: !0 }
|
|
2071
2072
|
]
|
|
2072
2073
|
},
|
|
2073
|
-
backHandspring:
|
|
2074
|
+
backHandspring: be("Back handspring", -360, 0.16, -0.7, [
|
|
2074
2075
|
// Arms reach back overhead to the ground, legs snap over.
|
|
2075
2076
|
{ at: 0.38, pose: { leftHip: 10, rightHip: -10, leftKnee: 0, rightKnee: 0, leftShoulder: -178, rightShoulder: 178, lean: -26, headTilt: -20 } },
|
|
2076
2077
|
{ at: 0.6, pose: { leftHip: -40, rightHip: 40, leftKnee: -20, rightKnee: 20, lean: 6, headTilt: 0 } }
|
|
2077
2078
|
], 1200)
|
|
2078
|
-
},
|
|
2079
|
+
}, at = 0.215, ht = 0.205, tr = 0.065, rn = 0.035, nr = 0.165, or = 0.155, sr = 12, rr = 0.3, ir = 0.7, lr = 0.35, ar = (e) => e * Math.PI / 180, C = {
|
|
2079
2080
|
turn: 0,
|
|
2080
2081
|
lean: 0,
|
|
2082
|
+
bend: 0,
|
|
2081
2083
|
side: 0,
|
|
2082
2084
|
"head.turn": 0,
|
|
2083
2085
|
"head.nod": 0,
|
|
@@ -2117,33 +2119,33 @@ const Pt = {
|
|
|
2117
2119
|
lookX: 0,
|
|
2118
2120
|
lookY: 0
|
|
2119
2121
|
};
|
|
2120
|
-
function
|
|
2121
|
-
return { ...
|
|
2122
|
+
function te(e = {}) {
|
|
2123
|
+
return { ...C, ...e };
|
|
2122
2124
|
}
|
|
2123
|
-
const
|
|
2124
|
-
function
|
|
2125
|
+
const hr = /* @__PURE__ */ new Set(["turn", "side", "head.turn", "head.tilt", "roll", "lookX"]);
|
|
2126
|
+
function Ni(e) {
|
|
2125
2127
|
const t = {};
|
|
2126
2128
|
for (const [n, s] of Object.entries(e)) {
|
|
2127
2129
|
const o = n.replace(/(^|\.)(left|right)(\.|$)/, (r, l, i, a) => `${l}${i === "left" ? "right" : "left"}${a}`);
|
|
2128
|
-
t[o] =
|
|
2130
|
+
t[o] = hr.has(n) ? -s : s;
|
|
2129
2131
|
}
|
|
2130
2132
|
return t;
|
|
2131
2133
|
}
|
|
2132
|
-
function
|
|
2134
|
+
function ee(e, t) {
|
|
2133
2135
|
const n = {};
|
|
2134
2136
|
for (const s of ["left", "right"]) for (const [o, r] of Object.entries(t)) n[`${e}.${s}.${o}`] = r;
|
|
2135
2137
|
return n;
|
|
2136
2138
|
}
|
|
2137
|
-
const
|
|
2138
|
-
rest:
|
|
2139
|
-
wave:
|
|
2140
|
-
cheer:
|
|
2141
|
-
point:
|
|
2142
|
-
handsOnHips:
|
|
2143
|
-
think:
|
|
2144
|
-
shrug:
|
|
2145
|
-
sit:
|
|
2146
|
-
kneel:
|
|
2139
|
+
const cr = {
|
|
2140
|
+
rest: C,
|
|
2141
|
+
wave: te({ "arm.right.spread": 115, "arm.right.bend": 55, "arm.right.elbow": 0, "head.tilt": -6, smile: 0.9 }),
|
|
2142
|
+
cheer: te({ ...ee("arm", { spread: 140, bend: 20, elbow: 0 }), mouth: 0.6, smile: 1, "eye.left": 0, "eye.right": 0 }),
|
|
2143
|
+
point: te({ "arm.right.spread": 88, "arm.right.elbow": 0, "arm.right.bend": 0, "head.turn": -20, smile: 0.4 }),
|
|
2144
|
+
handsOnHips: te({ ...ee("arm", { spread: 50, bend: -105, elbow: 0 }), ...ee("leg", { spread: 9 }), smile: 0.8 }),
|
|
2145
|
+
think: te({ "arm.right.spread": 22, "arm.right.bend": -150, "arm.right.elbow": 0, "head.tilt": 10, lookX: -0.5, lookY: -0.8, smile: 0 }),
|
|
2146
|
+
shrug: te({ ...ee("arm", { spread: 35, bend: 75, elbow: 0 }), "head.tilt": -10, smile: -0.2 }),
|
|
2147
|
+
sit: te({ ...ee("leg", { swing: 90, knee: 90, spread: 4 }), ...ee("arm", { swing: 25, elbow: 45, spread: 8 }) }),
|
|
2148
|
+
kneel: te({
|
|
2147
2149
|
"leg.left.swing": 90,
|
|
2148
2150
|
"leg.left.knee": 90,
|
|
2149
2151
|
// The back thigh leans back a little so its knee meets the ground beside the
|
|
@@ -2151,24 +2153,24 @@ const Qs = {
|
|
|
2151
2153
|
"leg.right.swing": -18,
|
|
2152
2154
|
"leg.right.knee": 108,
|
|
2153
2155
|
"leg.right.ankle": 16,
|
|
2154
|
-
...
|
|
2156
|
+
...ee("arm", { swing: 20, elbow: 30 })
|
|
2155
2157
|
}),
|
|
2156
|
-
crouch:
|
|
2158
|
+
crouch: te({ ...ee("leg", { swing: 75, knee: 140, spread: 6 }), lean: 25, ...ee("arm", { swing: 50, elbow: 40 }), "head.nod": -15 }),
|
|
2157
2159
|
// On hands and knees: the back nearly level, arms straight down, the toes
|
|
2158
2160
|
// pointed back along the ground.
|
|
2159
|
-
crawl:
|
|
2160
|
-
lieDown:
|
|
2161
|
+
crawl: te({ lean: 82, "head.nod": -35, ...ee("arm", { swing: 80, elbow: 0, spread: 4 }), ...ee("leg", { knee: 92, ankle: -88 }) }),
|
|
2162
|
+
lieDown: te({ roll: 90, ...ee("arm", { spread: 8 }), "head.nod": 0 })
|
|
2161
2163
|
};
|
|
2162
|
-
function
|
|
2163
|
-
const t = e.headSize ?? 0.3, n = e.shoulderWidth ?? 0.06, s = e.hipWidth ?? 0.022, o = Math.max(0.12, 1 - t -
|
|
2164
|
+
function fr(e = {}) {
|
|
2165
|
+
const t = e.headSize ?? 0.3, n = e.shoulderWidth ?? 0.06, s = e.hipWidth ?? 0.022, o = Math.max(0.12, 1 - t - rn - (at + ht)), r = (a) => ({
|
|
2164
2166
|
id: `arm.${a}`,
|
|
2165
2167
|
parent: "spine",
|
|
2166
2168
|
offset: [(a === "left" ? 1 : -1) * n, -0.035, 0],
|
|
2167
2169
|
rest: [0, -1, 0],
|
|
2168
2170
|
side: a === "left" ? 1 : -1,
|
|
2169
2171
|
bones: [
|
|
2170
|
-
{ length:
|
|
2171
|
-
{ length:
|
|
2172
|
+
{ length: nr, width: [1.25, 0.9] },
|
|
2173
|
+
{ length: or, width: [0.9, 0.75] }
|
|
2172
2174
|
]
|
|
2173
2175
|
}), l = (a) => ({
|
|
2174
2176
|
id: `leg.${a}`,
|
|
@@ -2177,14 +2179,14 @@ function er(e = {}) {
|
|
|
2177
2179
|
rest: [0, -1, 0],
|
|
2178
2180
|
side: a === "left" ? 1 : -1,
|
|
2179
2181
|
bones: [
|
|
2180
|
-
{ length:
|
|
2181
|
-
{ length:
|
|
2182
|
-
{ length:
|
|
2182
|
+
{ length: at, width: [1.45, 1.05] },
|
|
2183
|
+
{ length: ht, width: [1.05, 0.85] },
|
|
2184
|
+
{ length: tr, width: [0.95, 0.7] }
|
|
2183
2185
|
]
|
|
2184
|
-
}), i = (a, h) => a[h] ??
|
|
2186
|
+
}), i = (a, h) => a[h] ?? C[h] ?? 0;
|
|
2185
2187
|
return {
|
|
2186
2188
|
id: "human",
|
|
2187
|
-
hipHeight:
|
|
2189
|
+
hipHeight: at + ht,
|
|
2188
2190
|
// Tie order: legs, then the body, then the arms (in front of the chest unless turned away), then the head.
|
|
2189
2191
|
chains: [
|
|
2190
2192
|
l("left"),
|
|
@@ -2198,7 +2200,7 @@ function er(e = {}) {
|
|
|
2198
2200
|
{ length: o / 2, width: [1.4, 1.1] }
|
|
2199
2201
|
]
|
|
2200
2202
|
},
|
|
2201
|
-
{ id: "neck", parent: "spine", rest: [0, 1, 0], bones: [{ length:
|
|
2203
|
+
{ id: "neck", parent: "spine", rest: [0, 1, 0], bones: [{ length: rn, width: [1, 0.9] }] },
|
|
2202
2204
|
r("left"),
|
|
2203
2205
|
r("right")
|
|
2204
2206
|
],
|
|
@@ -2218,29 +2220,29 @@ function er(e = {}) {
|
|
|
2218
2220
|
],
|
|
2219
2221
|
angles(a, h) {
|
|
2220
2222
|
if (h.id === "spine") {
|
|
2221
|
-
const
|
|
2223
|
+
const g = -i(a, "lean") / 2, m = i(a, "side") / 2, b = -i(a, "bend");
|
|
2222
2224
|
return [
|
|
2223
|
-
{ swing:
|
|
2224
|
-
{ swing:
|
|
2225
|
+
{ swing: g + b * rr, spread: m },
|
|
2226
|
+
{ swing: g + b * ir, spread: m }
|
|
2225
2227
|
];
|
|
2226
2228
|
}
|
|
2227
|
-
if (h.id === "neck") return [{ swing:
|
|
2228
|
-
const [c, u] = h.id.split("."),
|
|
2229
|
+
if (h.id === "neck") return [{ swing: -i(a, "bend") * lr, spread: 0 }];
|
|
2230
|
+
const [c, u] = h.id.split("."), d = (g) => i(a, `${c}.${u}.${g}`);
|
|
2229
2231
|
if (c === "arm")
|
|
2230
2232
|
return [
|
|
2231
|
-
{ swing:
|
|
2232
|
-
{ swing:
|
|
2233
|
+
{ swing: d("swing"), spread: d("spread") },
|
|
2234
|
+
{ swing: d("elbow"), spread: d("bend") }
|
|
2233
2235
|
];
|
|
2234
|
-
const f = (h.side ?? 1) *
|
|
2236
|
+
const f = (h.side ?? 1) * d("rotate"), p = 1 - Math.cos(ar(d("rotate")));
|
|
2235
2237
|
return [
|
|
2236
|
-
{ swing:
|
|
2237
|
-
{ swing: -
|
|
2238
|
+
{ swing: d("swing"), spread: d("spread"), yaw: f },
|
|
2239
|
+
{ swing: -d("knee"), spread: 0, yaw: f },
|
|
2238
2240
|
// The foot points forward, square to the shin, turned out a little (more with `toeOut`).
|
|
2239
|
-
{ swing: 90 +
|
|
2241
|
+
{ swing: 90 + d("ankle") - p * (d("swing") - d("knee")), spread: 0, yaw: (sr + d("toeOut")) * (h.side ?? 1) }
|
|
2240
2242
|
];
|
|
2241
2243
|
},
|
|
2242
2244
|
withAngles(a, h, c) {
|
|
2243
|
-
const [u,
|
|
2245
|
+
const [u, d] = h.id.split("."), f = (p) => `${u}.${d}.${p}`;
|
|
2244
2246
|
return u === "arm" ? {
|
|
2245
2247
|
...a,
|
|
2246
2248
|
[f("swing")]: c[0].swing,
|
|
@@ -2283,7 +2285,7 @@ function er(e = {}) {
|
|
|
2283
2285
|
}
|
|
2284
2286
|
};
|
|
2285
2287
|
}
|
|
2286
|
-
function
|
|
2288
|
+
function Li(e) {
|
|
2287
2289
|
const t = e.split(".");
|
|
2288
2290
|
if (t[0] === "hand" && t.length >= 3) {
|
|
2289
2291
|
const s = `${t[1] === "left" ? "Left" : "Right"} hand`, o = { spread: "finger spread", turn: "wrist turn", bend: "wrist bend", tilt: "wrist tilt", roll: "roll" }, r = t.slice(2).join(".");
|
|
@@ -2305,6 +2307,7 @@ function Ti(e) {
|
|
|
2305
2307
|
return {
|
|
2306
2308
|
turn: "View (front → side → back)",
|
|
2307
2309
|
lean: "Lean forward / back",
|
|
2310
|
+
bend: "Back curve (line of action)",
|
|
2308
2311
|
side: "Lean sideways",
|
|
2309
2312
|
"head.turn": "Head · turn",
|
|
2310
2313
|
"head.nod": "Head · nod",
|
|
@@ -2325,181 +2328,181 @@ function Ti(e) {
|
|
|
2325
2328
|
lookY: "Look up / down"
|
|
2326
2329
|
}[e] ?? e;
|
|
2327
2330
|
}
|
|
2328
|
-
const
|
|
2331
|
+
const ur = {
|
|
2329
2332
|
leftEye: "eye.left",
|
|
2330
2333
|
rightEye: "eye.right",
|
|
2331
2334
|
leftBrow: "brow.left",
|
|
2332
2335
|
rightBrow: "brow.right"
|
|
2333
|
-
},
|
|
2334
|
-
Object.entries(
|
|
2336
|
+
}, dr = Object.fromEntries(
|
|
2337
|
+
Object.entries(X).map(([e, t]) => [
|
|
2335
2338
|
e,
|
|
2336
|
-
Object.fromEntries(Object.entries(t).map(([n, s]) => [
|
|
2339
|
+
Object.fromEntries(Object.entries(t).map(([n, s]) => [ur[n] ?? n, s]))
|
|
2337
2340
|
])
|
|
2338
2341
|
);
|
|
2339
|
-
function
|
|
2340
|
-
const n = Math.min(1, Math.max(0, e.turn ?? 0)), s = 1 - n, o = { ...
|
|
2342
|
+
function Yi(e, t) {
|
|
2343
|
+
const n = Math.min(1, Math.max(0, e.turn ?? 0)), s = 1 - n, o = { ...C, turn: n }, r = [
|
|
2341
2344
|
{ stick: "right", human: "left", s: 1 },
|
|
2342
2345
|
{ stick: "left", human: "right", s: -1 }
|
|
2343
2346
|
];
|
|
2344
2347
|
for (const { stick: i, human: a, s: h } of r) {
|
|
2345
2348
|
const c = e[`${i}Shoulder`], u = e[`${i}Elbow`];
|
|
2346
2349
|
o[`arm.${a}.spread`] = c * s, o[`arm.${a}.swing`] = h * c * n, o[`arm.${a}.bend`] = u * s, o[`arm.${a}.elbow`] = h * u * n;
|
|
2347
|
-
const
|
|
2348
|
-
o[`leg.${a}.rotate`] = 90 * s, o[`leg.${a}.spread`] = 0, o[`leg.${a}.swing`] =
|
|
2350
|
+
const d = e[`${i}Hip`], f = e[`${i}Knee`], p = s + h * n;
|
|
2351
|
+
o[`leg.${a}.rotate`] = 90 * s, o[`leg.${a}.spread`] = 0, o[`leg.${a}.swing`] = d * p, o[`leg.${a}.knee`] = f * p, o[`leg.${a}.ankle`] = -(e[`${i}Ankle`] ?? 0), o[`leg.${a}.toeOut`] = (e[`${i}FootOut`] ?? 0) * gr, o[`eye.${a}`] = e[`${i}Eye`], o[`brow.${a}`] = e[`${i}Brow`], t && Object.assign(o, pr(a, t[i] ?? Y, e[`${i}Wrist`] ?? 0, n));
|
|
2349
2352
|
}
|
|
2350
2353
|
const l = e.bend ?? 0;
|
|
2351
|
-
o.lean =
|
|
2354
|
+
o.lean = e.lean * n, o.bend = l * n, o.side = (e.lean + l * 0.5) * s, o["head.tilt"] = (e.headTilt + l * 0.5) * s, o["head.nod"] = e.headTilt * n;
|
|
2352
2355
|
for (const i of ["mouth", "smile", "mouthWidth", "blink", "browTilt", "lookX", "lookY", "stretch"]) o[i] = e[i];
|
|
2353
2356
|
return o.lift = e.rise ?? 0, o.roll = e.spin ?? 0, o;
|
|
2354
2357
|
}
|
|
2355
|
-
const
|
|
2356
|
-
function
|
|
2358
|
+
const gr = 70;
|
|
2359
|
+
function pr(e, t, n, s) {
|
|
2357
2360
|
const o = e === "right" ? 1 - s : 1 + s, r = {};
|
|
2358
|
-
for (const l of Object.keys(
|
|
2361
|
+
for (const l of Object.keys(Y)) r[`hand.${e}.${l}`] = t[l] ?? Y[l];
|
|
2359
2362
|
return r[`hand.${e}.turn`] = (t.turn ?? 0) - o, r[`hand.${e}.roll`] = (t.roll ?? 0) + n, r;
|
|
2360
2363
|
}
|
|
2361
|
-
const
|
|
2362
|
-
function
|
|
2364
|
+
const oe = (e) => e * Math.PI / 180;
|
|
2365
|
+
function Gn([e, t, n], s) {
|
|
2363
2366
|
const o = Math.cos(s), r = Math.sin(s);
|
|
2364
2367
|
return [e, t * o + n * r, -t * r + n * o];
|
|
2365
2368
|
}
|
|
2366
|
-
function
|
|
2369
|
+
function $t([e, t, n], s) {
|
|
2367
2370
|
const o = Math.cos(s), r = Math.sin(s);
|
|
2368
2371
|
return [e * o - t * r, e * r + t * o, n];
|
|
2369
2372
|
}
|
|
2370
|
-
function
|
|
2373
|
+
function me([e, t, n], s) {
|
|
2371
2374
|
const o = Math.cos(s), r = Math.sin(s);
|
|
2372
2375
|
return [e * o + n * r, t, -e * r + n * o];
|
|
2373
2376
|
}
|
|
2374
|
-
const
|
|
2375
|
-
function
|
|
2376
|
-
const n =
|
|
2377
|
+
const fe = (e, t) => [e[0] + t[0], e[1] + t[1], e[2] + t[2]], Qe = (e, t) => [e[0] * t, e[1] * t, e[2] * t], Ue = (e, t) => $t(Gn(e, t.swing), t.spread);
|
|
2378
|
+
function ct(e, t) {
|
|
2379
|
+
const n = me(e, t);
|
|
2377
2380
|
return { point: { x: n[0], y: -n[1] }, depth: n[2] };
|
|
2378
2381
|
}
|
|
2379
|
-
function
|
|
2382
|
+
function Bt(e, t, n) {
|
|
2380
2383
|
const s = n, r = [0, e.hipHeight * s * (e.boneScale?.(t, null) ?? 1), 0], l = {};
|
|
2381
|
-
for (const
|
|
2382
|
-
const m =
|
|
2383
|
-
if (
|
|
2384
|
-
const b =
|
|
2385
|
-
let
|
|
2386
|
-
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2391
|
-
}), l[
|
|
2392
|
-
}
|
|
2393
|
-
const i = l[e.head.on], a = e.headPose?.(t) ?? { yaw: 0, nod: 0, tilt: 0, sx: 1, sy: 1 }, h = i.frames[i.frames.length - 1], c = e.head.size / 2 * s, u = c * a.sx,
|
|
2394
|
-
return { height: s, root: r, chains: l, head: { center: p, rx: u, ry:
|
|
2395
|
-
}
|
|
2396
|
-
function
|
|
2397
|
-
const s = n.height, o =
|
|
2398
|
-
for (const
|
|
2399
|
-
const { joints3:
|
|
2400
|
-
|
|
2401
|
-
id:
|
|
2402
|
-
joints3:
|
|
2403
|
-
frames:
|
|
2404
|
-
points:
|
|
2405
|
-
depths:
|
|
2384
|
+
for (const g of e.chains) {
|
|
2385
|
+
const m = g.parent ? l[g.parent] : void 0;
|
|
2386
|
+
if (g.parent && !m) throw new Error(`body plan ${e.id}: chain ${g.id} comes before its parent ${g.parent}`);
|
|
2387
|
+
const b = g.at ?? (m ? m.joints3.length - 1 : 0), S = m ? m.joints3[b] : r, k = m ? m.frames[Math.max(0, b - 1)] : { swing: 0, spread: 0 }, v = g.offset ? fe(S, Ue(Qe(g.offset, s), k)) : S, H = g.side ?? 1, T = e.boneScale?.(t, g) ?? 1, M = e.angles(t, g), w = [v], y = [];
|
|
2388
|
+
let A = k.swing, x = k.spread;
|
|
2389
|
+
g.bones.forEach((E, P) => {
|
|
2390
|
+
const K = M[P] ?? { swing: 0, spread: 0 };
|
|
2391
|
+
A += oe(K.swing), x += oe(K.spread) * H, y.push({ swing: A, spread: x });
|
|
2392
|
+
const _ = me(Ue(g.rest, { swing: A, spread: x }), oe(K.yaw ?? 0));
|
|
2393
|
+
w.push(fe(w[P], Qe(_, E.length * s * T)));
|
|
2394
|
+
}), l[g.id] = { joints3: w, frames: y };
|
|
2395
|
+
}
|
|
2396
|
+
const i = l[e.head.on], a = e.headPose?.(t) ?? { yaw: 0, nod: 0, tilt: 0, sx: 1, sy: 1 }, h = i.frames[i.frames.length - 1], c = e.head.size / 2 * s, u = c * a.sx, d = c * a.sy, f = (g) => Ue(me(Gn($t(g, -oe(a.tilt)), -oe(a.nod)), oe(a.yaw)), h), p = fe(i.joints3[i.joints3.length - 1], f([0, d, 0]));
|
|
2397
|
+
return { height: s, root: r, chains: l, head: { center: p, rx: u, ry: d, toBody: f } };
|
|
2398
|
+
}
|
|
2399
|
+
function Ft(e, t, n) {
|
|
2400
|
+
const s = n.height, o = oe(90 * (t.turn ?? 0)), r = Bt(e, t, s), { root: l } = r, i = r.chains, { rx: a, ry: h } = r.head, c = r.head.toBody, u = r.head.center, d = {};
|
|
2401
|
+
for (const y of e.chains) {
|
|
2402
|
+
const { joints3: A, frames: x } = i[y.id], E = A.map((P) => ct(P, o));
|
|
2403
|
+
d[y.id] = {
|
|
2404
|
+
id: y.id,
|
|
2405
|
+
joints3: A,
|
|
2406
|
+
frames: x,
|
|
2407
|
+
points: E.map((P) => P.point),
|
|
2408
|
+
depths: E.map((P) => P.depth)
|
|
2406
2409
|
};
|
|
2407
2410
|
}
|
|
2408
|
-
const f =
|
|
2409
|
-
const
|
|
2410
|
-
return { x:
|
|
2411
|
-
},
|
|
2412
|
-
for (const
|
|
2413
|
-
const
|
|
2411
|
+
const f = ct(u, o), p = [[1, 0, 0], [0, 1, 0], [0, 0, 1]].map((y) => me(c(y), o)), g = ct(l, o).point, m = oe(t.roll ?? 0), b = (y) => {
|
|
2412
|
+
const A = y.x - g.x, x = y.y - g.y;
|
|
2413
|
+
return { x: g.x + A * Math.cos(m) - x * Math.sin(m), y: g.y + A * Math.sin(m) + x * Math.cos(m) };
|
|
2414
|
+
}, S = ([y, A, x]) => [y * Math.cos(m) + A * Math.sin(m), -y * Math.sin(m) + A * Math.cos(m), x];
|
|
2415
|
+
for (const y of Object.values(d)) y.points = y.points.map(b);
|
|
2416
|
+
const k = {
|
|
2414
2417
|
center: b(f.point),
|
|
2415
2418
|
depth: f.depth,
|
|
2416
2419
|
rx: a,
|
|
2417
2420
|
ry: h,
|
|
2418
2421
|
angle: 0,
|
|
2419
|
-
axes: p.map(
|
|
2420
|
-
},
|
|
2421
|
-
|
|
2422
|
-
const
|
|
2423
|
-
if ("head" in
|
|
2424
|
-
const
|
|
2425
|
-
return
|
|
2422
|
+
axes: p.map(S)
|
|
2423
|
+
}, v = k.axes[1];
|
|
2424
|
+
k.angle = Math.atan2(v[0], v[1]);
|
|
2425
|
+
const H = (y) => {
|
|
2426
|
+
if ("head" in y) return { x: k.center.x + v[0] * h, y: k.center.y - v[1] * h };
|
|
2427
|
+
const A = d[y.chain];
|
|
2428
|
+
return A.points[Math.min(y.joint, A.points.length - 1)];
|
|
2426
2429
|
};
|
|
2427
|
-
let
|
|
2428
|
-
(n.contact ?? "ground") === "ground" && (
|
|
2429
|
-
const
|
|
2430
|
-
for (const
|
|
2431
|
-
|
|
2432
|
-
const
|
|
2430
|
+
let T = 0;
|
|
2431
|
+
(n.contact ?? "ground") === "ground" && (T = -Math.max(...e.contacts.map((y) => H(y).y))), T -= (t.lift ?? 0) * s;
|
|
2432
|
+
const M = (y) => ({ x: y.x, y: y.y + T });
|
|
2433
|
+
for (const y of Object.values(d)) y.points = y.points.map(M);
|
|
2434
|
+
k.center = M(k.center);
|
|
2435
|
+
const w = e.contacts.map((y) => ({ spec: y, point: H(y) }));
|
|
2433
2436
|
return {
|
|
2434
2437
|
height: s,
|
|
2435
2438
|
view: o,
|
|
2436
|
-
chains:
|
|
2437
|
-
head:
|
|
2438
|
-
hip:
|
|
2439
|
-
contacts:
|
|
2440
|
-
groundY: Math.max(...
|
|
2439
|
+
chains: d,
|
|
2440
|
+
head: k,
|
|
2441
|
+
hip: M(b(g)),
|
|
2442
|
+
contacts: w,
|
|
2443
|
+
groundY: Math.max(...w.map((y) => y.point.y))
|
|
2441
2444
|
};
|
|
2442
2445
|
}
|
|
2443
|
-
const
|
|
2446
|
+
const Ht = (e, t) => [e[0] - t[0], e[1] - t[1], e[2] - t[2]], Un = (e) => {
|
|
2444
2447
|
const t = Math.hypot(e[0], e[1], e[2]) || 1;
|
|
2445
2448
|
return [e[0] / t, e[1] / t, e[2] / t];
|
|
2446
2449
|
};
|
|
2447
|
-
function
|
|
2448
|
-
const s = n.height, o =
|
|
2450
|
+
function zn(e, t, n) {
|
|
2451
|
+
const s = n.height, o = oe(90 * (t.turn ?? 0)), r = oe(t.roll ?? 0), l = Bt(e, t, s), i = me(l.root, o), a = (m) => fe($t(Ht(me(m, o), i), -r), i), h = {};
|
|
2449
2452
|
for (const m of e.chains) h[m.id] = l.chains[m.id].joints3.map(a);
|
|
2450
|
-
const c = a(l.head.center), u = (m) =>
|
|
2451
|
-
if ("head" in m) return
|
|
2453
|
+
const c = a(l.head.center), u = (m) => Un(Ht(a(fe(l.head.center, l.head.toBody(m))), c)), d = [u([1, 0, 0]), u([0, 1, 0]), u([0, 0, 1])], f = (m) => {
|
|
2454
|
+
if ("head" in m) return fe(c, Qe(d[1], l.head.ry));
|
|
2452
2455
|
const b = h[m.chain];
|
|
2453
2456
|
return b[Math.min(m.joint, b.length - 1)];
|
|
2454
2457
|
};
|
|
2455
2458
|
let p = 0;
|
|
2456
2459
|
(n.contact ?? "ground") === "ground" && (p = -Math.min(...e.contacts.map((m) => f(m)[1]))), p += (t.lift ?? 0) * s;
|
|
2457
|
-
const
|
|
2460
|
+
const g = (m) => [m[0], m[1] + p, m[2]];
|
|
2458
2461
|
return {
|
|
2459
2462
|
height: s,
|
|
2460
|
-
hip:
|
|
2461
|
-
chains: Object.fromEntries(Object.entries(h).map(([m, b]) => [m, b.map(
|
|
2462
|
-
head: { center:
|
|
2463
|
+
hip: g(i),
|
|
2464
|
+
chains: Object.fromEntries(Object.entries(h).map(([m, b]) => [m, b.map(g)])),
|
|
2465
|
+
head: { center: g(c), rx: l.head.rx, ry: l.head.ry, axes: d }
|
|
2463
2466
|
};
|
|
2464
2467
|
}
|
|
2465
|
-
function
|
|
2466
|
-
const o = n.height, r =
|
|
2467
|
-
if ("head" in
|
|
2468
|
-
const
|
|
2469
|
-
return
|
|
2470
|
-
},
|
|
2471
|
-
const
|
|
2472
|
-
return { point: s.toScreen(
|
|
2468
|
+
function Vn(e, t, n, s) {
|
|
2469
|
+
const o = n.height, r = oe(90 * (t.turn ?? 0)), l = Bt(e, t, o), i = zn(e, t, n), a = i.hip, h = i.chains, c = i.head.center, u = (y) => {
|
|
2470
|
+
if ("head" in y) return fe(c, Qe(i.head.axes[1], i.head.ry));
|
|
2471
|
+
const A = h[y.chain];
|
|
2472
|
+
return A[Math.min(y.joint, A.length - 1)];
|
|
2473
|
+
}, d = s.toView(a), f = s.toScreen(d), p = s.toScreen([d[0] + 1, d[1], d[2]]), g = Math.hypot(p.x - f.x, p.y - f.y), m = (y) => {
|
|
2474
|
+
const A = s.toView(y);
|
|
2475
|
+
return { point: s.toScreen(A), depth: A[2] * g };
|
|
2473
2476
|
}, b = {};
|
|
2474
|
-
for (const
|
|
2475
|
-
const
|
|
2476
|
-
b[
|
|
2477
|
-
id:
|
|
2478
|
-
joints3: l.chains[
|
|
2479
|
-
frames: l.chains[
|
|
2480
|
-
points:
|
|
2481
|
-
depths:
|
|
2477
|
+
for (const y of e.chains) {
|
|
2478
|
+
const A = h[y.id].map(m);
|
|
2479
|
+
b[y.id] = {
|
|
2480
|
+
id: y.id,
|
|
2481
|
+
joints3: l.chains[y.id].joints3,
|
|
2482
|
+
frames: l.chains[y.id].frames,
|
|
2483
|
+
points: A.map((x) => x.point),
|
|
2484
|
+
depths: A.map((x) => x.depth)
|
|
2482
2485
|
};
|
|
2483
2486
|
}
|
|
2484
|
-
const
|
|
2485
|
-
center:
|
|
2486
|
-
depth:
|
|
2487
|
-
rx: l.head.rx *
|
|
2488
|
-
ry: l.head.ry *
|
|
2489
|
-
angle: Math.atan2(
|
|
2490
|
-
axes:
|
|
2491
|
-
},
|
|
2487
|
+
const S = s.toView(c), k = s.toScreen(S), v = s.toScreen([S[0] + 1, S[1], S[2]]), H = Math.hypot(v.x - k.x, v.y - k.y), T = i.head.axes.map((y) => Un(Ht(s.toView(fe(c, y)), S))), M = {
|
|
2488
|
+
center: k,
|
|
2489
|
+
depth: S[2] * g,
|
|
2490
|
+
rx: l.head.rx * H,
|
|
2491
|
+
ry: l.head.ry * H,
|
|
2492
|
+
angle: Math.atan2(T[1][0], T[1][1]),
|
|
2493
|
+
axes: T
|
|
2494
|
+
}, w = e.contacts.map((y) => ({ spec: y, point: m(u(y)).point }));
|
|
2492
2495
|
return {
|
|
2493
|
-
height: o *
|
|
2496
|
+
height: o * g,
|
|
2494
2497
|
view: r,
|
|
2495
2498
|
chains: b,
|
|
2496
|
-
head:
|
|
2499
|
+
head: M,
|
|
2497
2500
|
hip: f,
|
|
2498
|
-
contacts:
|
|
2499
|
-
groundY: Math.max(...
|
|
2501
|
+
contacts: w,
|
|
2502
|
+
groundY: Math.max(...w.map((y) => y.point.y))
|
|
2500
2503
|
};
|
|
2501
2504
|
}
|
|
2502
|
-
function
|
|
2505
|
+
function jn(e, [t, n, s]) {
|
|
2503
2506
|
const [o, r, l] = e.axes, i = [
|
|
2504
2507
|
o[0] * t * e.rx + r[0] * n * e.ry + l[0] * s * e.rx,
|
|
2505
2508
|
o[1] * t * e.rx + r[1] * n * e.ry + l[1] * s * e.rx,
|
|
@@ -2507,93 +2510,93 @@ function Cn(e, [t, n, s]) {
|
|
|
2507
2510
|
], a = Math.hypot(t, n, s) || 1, h = (o[2] * t + r[2] * n + l[2] * s) / a;
|
|
2508
2511
|
return { point: { x: e.center.x + i[0], y: e.center.y - i[1] }, depth: e.depth + i[2], facing: h };
|
|
2509
2512
|
}
|
|
2510
|
-
const
|
|
2511
|
-
const t =
|
|
2513
|
+
const Ne = (e) => e * 180 / Math.PI, we = (e, t) => [e[0] - t[0], e[1] - t[1], e[2] - t[2]], ft = (e, t) => e[0] * t[0] + e[1] * t[1] + e[2] * t[2], Pe = (e) => Math.hypot(e[0], e[1], e[2]), vt = (e) => {
|
|
2514
|
+
const t = Pe(e) || 1;
|
|
2512
2515
|
return [e[0] / t, e[1] / t, e[2] / t];
|
|
2513
|
-
},
|
|
2514
|
-
function
|
|
2515
|
-
const [t, n, s] =
|
|
2516
|
+
}, Le = (e) => Math.atan2(Math.sin(e), Math.cos(e));
|
|
2517
|
+
function ln(e) {
|
|
2518
|
+
const [t, n, s] = vt(e);
|
|
2516
2519
|
return { swing: Math.asin(Math.max(-1, Math.min(1, s))), spread: Math.atan2(t, -n) };
|
|
2517
2520
|
}
|
|
2518
|
-
function
|
|
2519
|
-
const r = e.chains.find((
|
|
2521
|
+
function mr(e, t, n, s, o) {
|
|
2522
|
+
const r = e.chains.find((A) => A.id === n);
|
|
2520
2523
|
if (!r) throw new Error(`reach: no chain ${n} in ${e.id}`);
|
|
2521
2524
|
if (r.bones.length < 2 || r.rest[1] > -0.99) throw new Error(`reach: ${n} is not a hanging limb of two bones or more`);
|
|
2522
2525
|
if (!e.withAngles) throw new Error(`reach: the ${e.id} plan cannot set angles`);
|
|
2523
|
-
const l =
|
|
2524
|
-
let b =
|
|
2525
|
-
|
|
2526
|
-
const
|
|
2527
|
-
a[0] + h * (
|
|
2528
|
-
a[1] + h * (
|
|
2529
|
-
a[2] + h * (
|
|
2530
|
-
],
|
|
2531
|
-
{ swing:
|
|
2532
|
-
{ swing:
|
|
2526
|
+
const l = Ft(e, { ...t, turn: 0, roll: 0, lift: 0 }, { height: o.height, contact: "none" }), i = l.chains[n], a = i.joints3[0], h = Pe(we(i.joints3[1], i.joints3[0])), c = Pe(we(i.joints3[2], i.joints3[1])), u = r.parent ? l.chains[r.parent].frames[Math.max(0, (r.at ?? l.chains[r.parent].joints3.length - 1) - 1)] : { swing: 0, spread: 0 }, d = we(s, a), f = Math.min(h + c - 1e-6, Math.max(Math.abs(h - c) + 1e-6, Pe(d))), p = vt(d), g = r.parent !== null, m = Ue(r.pole ?? (g ? [0, -0.35, -1] : [0, 0, 1]), u);
|
|
2527
|
+
let b = we(m, [p[0] * ft(m, p), p[1] * ft(m, p), p[2] * ft(m, p)]);
|
|
2528
|
+
Pe(b) < 1e-6 && (b = me([1, 0, 0], 0)), b = vt(b);
|
|
2529
|
+
const S = (h * h + f * f - c * c) / (2 * h * f), k = Math.sqrt(Math.max(0, 1 - S * S)), v = [
|
|
2530
|
+
a[0] + h * (S * p[0] + k * b[0]),
|
|
2531
|
+
a[1] + h * (S * p[1] + k * b[1]),
|
|
2532
|
+
a[2] + h * (S * p[2] + k * b[2])
|
|
2533
|
+
], H = [a[0] + p[0] * f, a[1] + p[1] * f, a[2] + p[2] * f], T = r.side ?? 1, M = ln(we(v, a)), w = ln(we(H, v)), y = [
|
|
2534
|
+
{ swing: Ne(Le(M.swing - u.swing)), spread: Ne(Le(M.spread - u.spread)) * T },
|
|
2535
|
+
{ swing: Ne(Le(w.swing - M.swing)), spread: Ne(Le(w.spread - M.spread)) * T }
|
|
2533
2536
|
];
|
|
2534
|
-
return e.withAngles(t, r,
|
|
2537
|
+
return e.withAngles(t, r, y);
|
|
2535
2538
|
}
|
|
2536
|
-
const
|
|
2537
|
-
function
|
|
2538
|
-
const s = (f) => Math.sqrt(Math.max(0, 1 - f.x * f.x - f.y * f.y)), o =
|
|
2539
|
+
const br = 0.34, ae = 0.12, re = -0.4, le = (e, t, n) => e[t] ?? n, wr = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), yr = 0.45, kr = 0.35, Sr = 0.7;
|
|
2540
|
+
function et(e, t, n) {
|
|
2541
|
+
const s = (f) => Math.sqrt(Math.max(0, 1 - f.x * f.x - f.y * f.y)), o = jn(e, [n.x, n.y, s(n)]).facing, r = e.axes[2], l = Math.atan2(r[0], r[2]), i = Math.cos(l), a = i >= 0 ? 1 : -1, h = a * Math.max(kr, Math.abs(i)), c = a * Math.max(Sr, Math.abs(i)), u = Math.cos(e.angle), d = Math.sin(e.angle);
|
|
2539
2542
|
return {
|
|
2540
2543
|
facing: o,
|
|
2541
2544
|
points: t.map((f) => {
|
|
2542
|
-
const p =
|
|
2543
|
-
return { x: e.center.x + m * u + b *
|
|
2545
|
+
const p = yr * Math.sin(l) + n.x * h + (f.x - n.x) * c, g = f.y + r[1] * s(f), m = p * e.rx, b = g * e.ry;
|
|
2546
|
+
return { x: e.center.x + m * u + b * d, y: e.center.y + m * d - b * u };
|
|
2544
2547
|
})
|
|
2545
2548
|
};
|
|
2546
2549
|
}
|
|
2547
|
-
const
|
|
2550
|
+
const Ye = (e, t, n, s = 12) => Array.from({ length: s + 1 }, (o, r) => {
|
|
2548
2551
|
const l = r / s, i = 1 - l;
|
|
2549
2552
|
return { x: i * i * e.x + 2 * i * l * t.x + l * l * n.x, y: i * i * e.y + 2 * i * l * t.y + l * l * n.y };
|
|
2550
|
-
}),
|
|
2553
|
+
}), ut = (e, t, n, s, o = 16) => Array.from({ length: o }, (r, l) => {
|
|
2551
2554
|
const i = Math.PI * 2 * l / o;
|
|
2552
2555
|
return { x: e + Math.cos(i) * n, y: t + Math.sin(i) * s };
|
|
2553
|
-
}),
|
|
2554
|
-
function
|
|
2555
|
-
const o = Math.max(1, Math.min(s * 0.6, 0.14 * t.rx)), r = (b,
|
|
2556
|
+
}), an = 0.05;
|
|
2557
|
+
function Er(e, t, n, s) {
|
|
2558
|
+
const o = Math.max(1, Math.min(s * 0.6, 0.14 * t.rx)), r = (b, S) => et(t, b, S).points, l = (b, S) => et(t, [], { x: b, y: S }).facing, i = le(n, "smile", 0), a = le(n, "blink", 0), h = le(n, "lookX", 0), c = le(n, "lookY", 0), u = le(n, "browTilt", 0);
|
|
2556
2559
|
for (const b of [1, -1]) {
|
|
2557
|
-
const
|
|
2558
|
-
if (l(
|
|
2559
|
-
const
|
|
2560
|
-
if (
|
|
2561
|
-
const
|
|
2562
|
-
e.line(r(
|
|
2560
|
+
const S = b === 1 ? "left" : "right", k = br * b;
|
|
2561
|
+
if (l(k, ae) < an) continue;
|
|
2562
|
+
const v = { x: k, y: ae }, H = wr(le(n, `eye.${S}`, 1), a);
|
|
2563
|
+
if (H < 0.2) {
|
|
2564
|
+
const y = i > 0.5 ? 0.12 : -0.06;
|
|
2565
|
+
e.line(r(Ye({ x: k - 0.12, y: ae }, { x: k, y: ae + y }, { x: k + 0.12, y: ae }), v), o);
|
|
2563
2566
|
} else {
|
|
2564
|
-
if (
|
|
2565
|
-
const
|
|
2566
|
-
e.shape(r(
|
|
2567
|
+
if (H > 1.2) {
|
|
2568
|
+
const E = 0.13 * H;
|
|
2569
|
+
e.shape(r(ut(k, ae, E * 0.85, E), v), "#ffffff", o);
|
|
2567
2570
|
}
|
|
2568
|
-
const
|
|
2569
|
-
e.shape(r(
|
|
2571
|
+
const y = H > 1.2 ? 0.075 : 0.1, A = k + h * 0.08, x = ae - c * 0.07;
|
|
2572
|
+
e.shape(r(ut(A, x, y, y * 1.1 * Math.min(H, 1)), v), e.ink, 0);
|
|
2570
2573
|
}
|
|
2571
|
-
const
|
|
2572
|
-
e.line(r([
|
|
2574
|
+
const T = ae + 0.3 + le(n, `brow.${S}`, 0) * 0.14 + Math.max(0, H - 1) * 0.12, M = { x: k + b * 0.13, y: T }, w = { x: k - b * 0.13, y: T + u * 0.1 };
|
|
2575
|
+
e.line(r([M, { x: (M.x + w.x) / 2, y: (M.y + w.y) / 2 }, w], { x: k, y: T }), o);
|
|
2573
2576
|
}
|
|
2574
|
-
const
|
|
2575
|
-
if (l(0,
|
|
2576
|
-
const f = 0.25 * Math.max(0.3,
|
|
2577
|
+
const d = { x: 0, y: re };
|
|
2578
|
+
if (l(0, re) < -an) return;
|
|
2579
|
+
const f = 0.25 * Math.max(0.3, le(n, "mouthWidth", 1)), p = Math.min(1, Math.max(0, le(n, "mouth", 0)));
|
|
2577
2580
|
if (p <= 0.05) {
|
|
2578
|
-
e.line(r(
|
|
2581
|
+
e.line(r(Ye({ x: -f, y: re }, { x: 0, y: re - i * 0.25 }, { x: f, y: re }), d), o);
|
|
2579
2582
|
return;
|
|
2580
2583
|
}
|
|
2581
|
-
const
|
|
2584
|
+
const g = 0.3 * p;
|
|
2582
2585
|
let m;
|
|
2583
2586
|
if (i > 0.3) {
|
|
2584
|
-
const b =
|
|
2585
|
-
m = [...
|
|
2587
|
+
const b = re + 0.05;
|
|
2588
|
+
m = [...Ye({ x: f, y: b }, { x: 0, y: re - g * 2 }, { x: -f, y: b })];
|
|
2586
2589
|
} else if (i < -0.3) {
|
|
2587
|
-
const b =
|
|
2588
|
-
m = [...
|
|
2590
|
+
const b = re - g * 0.6;
|
|
2591
|
+
m = [...Ye({ x: f, y: b }, { x: 0, y: re + g * 1.4 }, { x: -f, y: b })];
|
|
2589
2592
|
} else
|
|
2590
|
-
m =
|
|
2591
|
-
e.shape(r(m,
|
|
2593
|
+
m = ut(0, re, f * 0.8, g);
|
|
2594
|
+
e.shape(r(m, d), e.ink, 0);
|
|
2592
2595
|
}
|
|
2593
|
-
function
|
|
2596
|
+
function Mr(e = {}) {
|
|
2594
2597
|
const t = (e.proportions ?? "bold") === "bold", n = e.figure ?? "fluid", s = e.look ?? "clean", o = e.height ?? 300, r = n === "stick";
|
|
2595
2598
|
return {
|
|
2596
|
-
plan: e.plan ??
|
|
2599
|
+
plan: e.plan ?? fr({
|
|
2597
2600
|
headSize: e.headSize ?? (t ? 0.3 : 0.24),
|
|
2598
2601
|
shoulderWidth: r ? 0 : e.shoulderWidth ?? 0.06,
|
|
2599
2602
|
hipWidth: r ? 0 : e.hipWidth ?? 0.022
|
|
@@ -2613,33 +2616,33 @@ function fr(e = {}) {
|
|
|
2613
2616
|
handSize: e.handSize ?? (e.handStyle === "natural" ? 0.14 : 0.17)
|
|
2614
2617
|
};
|
|
2615
2618
|
}
|
|
2616
|
-
function
|
|
2617
|
-
const { point: o, facing: r } =
|
|
2619
|
+
function Ci(e, t, n, s) {
|
|
2620
|
+
const { point: o, facing: r } = jn(e, [t, n, s]);
|
|
2618
2621
|
return { point: o, facing: r };
|
|
2619
2622
|
}
|
|
2620
|
-
const
|
|
2621
|
-
function
|
|
2622
|
-
return e.figure === "stick" ?
|
|
2623
|
+
const Tt = (e) => e.rest[1] < -0.5, Hr = 0.3;
|
|
2624
|
+
function vr(e, t, n) {
|
|
2625
|
+
return e.figure === "stick" ? Tt(t) ? n.slice(0, 3) : n : Tt(t) && n.length >= 3 ? He(n[0], n[1], n[2], Hr) : n.length === 3 ? He(n[0], n[1], n[2], 1) : n;
|
|
2623
2626
|
}
|
|
2624
|
-
function
|
|
2625
|
-
const n = e.plan.id === "human" ? { ...
|
|
2626
|
-
return
|
|
2627
|
+
function Rt(e, t) {
|
|
2628
|
+
const n = e.plan.id === "human" ? { ...C, ...t } : t;
|
|
2629
|
+
return Nt(e, n, Ft(e.plan, n, { height: e.height, contact: e.contact }));
|
|
2627
2630
|
}
|
|
2628
|
-
function
|
|
2631
|
+
function Nt(e, t, n) {
|
|
2629
2632
|
const s = {}, o = {}, r = {}, l = 0.01 * e.height;
|
|
2630
|
-
e.plan.chains.forEach((
|
|
2631
|
-
const f = n.chains[
|
|
2632
|
-
s[
|
|
2633
|
-
const p = f.depths.reduce((
|
|
2634
|
-
r[
|
|
2633
|
+
e.plan.chains.forEach((d) => {
|
|
2634
|
+
const f = n.chains[d.id];
|
|
2635
|
+
s[d.id] = f.points;
|
|
2636
|
+
const p = f.depths.reduce((S, k) => S + k, 0) / f.depths.length, g = d.parent ? n.chains[d.parent] : void 0, m = g ? g.depths[d.at ?? g.depths.length - 1] : 0, b = p - m;
|
|
2637
|
+
r[d.id] = Math.abs(b) < l ? 0 : b, o[d.id] = { points: vr(e, d, f.points), depth: p };
|
|
2635
2638
|
}), o.head = { points: [n.head.center], depth: n.head.depth }, r.head = 0;
|
|
2636
|
-
const i = [...e.plan.chains.map((
|
|
2637
|
-
for (const [
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2639
|
+
const i = [...e.plan.chains.map((d) => d.id), "head"], a = [...i].sort((d, f) => r[d] - r[f] || i.indexOf(d) - i.indexOf(f)), h = { hip: n.hip };
|
|
2640
|
+
for (const [d, [f, p]] of Object.entries(e.plan.landmarks ?? {})) {
|
|
2641
|
+
const g = n.chains[f]?.points;
|
|
2642
|
+
g && (h[d] = g[Math.min(p, g.length - 1)]);
|
|
2640
2643
|
}
|
|
2641
2644
|
const c = {};
|
|
2642
|
-
for (const [
|
|
2645
|
+
for (const [d, f] of Object.entries(h)) c[d] = f.y >= n.groundY - 0.01 * e.height;
|
|
2643
2646
|
const u = {
|
|
2644
2647
|
height: e.height,
|
|
2645
2648
|
lineWidth: e.lineWidth,
|
|
@@ -2653,25 +2656,25 @@ function $t(e, t, n) {
|
|
|
2653
2656
|
};
|
|
2654
2657
|
return { skeleton: n, joints: u, order: a };
|
|
2655
2658
|
}
|
|
2656
|
-
function
|
|
2657
|
-
return
|
|
2659
|
+
function Tr(e, t) {
|
|
2660
|
+
return Rt(e, t).joints;
|
|
2658
2661
|
}
|
|
2659
|
-
function
|
|
2662
|
+
function Ar(e, t, n) {
|
|
2660
2663
|
const { head: s } = n;
|
|
2661
2664
|
e.guideEllipse(s.center.x, s.center.y, s.rx * 1.03, s.ry * 1.03, s.angle);
|
|
2662
|
-
const o = Array.from({ length: 13 }, (a, h) => ({ x: 0, y: -0.95 + 1.9 * h / 12 })), r = Array.from({ length: 13 }, (a, h) => ({ x: -0.95 + 1.9 * h / 12, y: 0.12 })), l =
|
|
2663
|
-
l.facing > 0 && e.guide(l.points), e.guide(
|
|
2665
|
+
const o = Array.from({ length: 13 }, (a, h) => ({ x: 0, y: -0.95 + 1.9 * h / 12 })), r = Array.from({ length: 13 }, (a, h) => ({ x: -0.95 + 1.9 * h / 12, y: 0.12 })), l = et(s, o, { x: 0, y: 0 });
|
|
2666
|
+
l.facing > 0 && e.guide(l.points), e.guide(et(s, r, { x: 0, y: 0.12 }).points), e.guide(n.chains.spine ?? []);
|
|
2664
2667
|
const i = t.lineWidth * 0.9;
|
|
2665
2668
|
for (const a of ["shoulder.left", "shoulder.right", "elbow.left", "elbow.right", "hip.left", "hip.right", "knee.left", "knee.right"]) {
|
|
2666
2669
|
const h = n.points[a];
|
|
2667
2670
|
h && e.guideEllipse(h.x, h.y, i, i, 0);
|
|
2668
2671
|
}
|
|
2669
2672
|
}
|
|
2670
|
-
function
|
|
2673
|
+
function xr(e, t, n, s, o, r) {
|
|
2671
2674
|
const l = n.lineWidth;
|
|
2672
2675
|
if (o === "head") {
|
|
2673
2676
|
const { head: f } = s, p = n.skin === "none" ? null : n.skin;
|
|
2674
|
-
t.ellipse(f.center.x, f.center.y, f.rx, f.ry, f.angle, p, l), t.look !== "silhouette" &&
|
|
2677
|
+
t.ellipse(f.center.x, f.center.y, f.rx, f.ry, f.angle, p, l), t.look !== "silhouette" && Er(t, f, r, l);
|
|
2675
2678
|
return;
|
|
2676
2679
|
}
|
|
2677
2680
|
const i = n.plan.chains.find((f) => f.id === o), a = s.chains[o], h = s.parts[o].points;
|
|
@@ -2682,39 +2685,39 @@ function mr(e, t, n, s, o, r) {
|
|
|
2682
2685
|
return;
|
|
2683
2686
|
}
|
|
2684
2687
|
const c = (f, p) => [i.bones[f].width[0] * l, i.bones[p].width[1] * l];
|
|
2685
|
-
if (
|
|
2688
|
+
if (Tt(i)) {
|
|
2686
2689
|
const [f, p] = c(0, 1);
|
|
2687
2690
|
if (t.limb(h, f, p), i.bones.length >= 3)
|
|
2688
2691
|
t.limb([a[2], a[3]], i.bones[2].width[0] * l, i.bones[2].width[1] * l);
|
|
2689
2692
|
else if (n.hands === "cartoon" && o.startsWith("arm."))
|
|
2690
|
-
|
|
2693
|
+
Kr(e, t, n, a, o.endsWith(".left") ? "left" : "right", r);
|
|
2691
2694
|
else {
|
|
2692
|
-
const
|
|
2693
|
-
t.dot(
|
|
2695
|
+
const g = a[a.length - 1];
|
|
2696
|
+
t.dot(g.x, g.y, l * 0.62);
|
|
2694
2697
|
}
|
|
2695
2698
|
return;
|
|
2696
2699
|
}
|
|
2697
2700
|
if (o === "spine") {
|
|
2698
2701
|
const f = s.points["hip.left"], p = s.points["hip.right"];
|
|
2699
2702
|
f && p && Math.hypot(f.x - p.x, f.y - p.y) > 0.5 && t.limb([f, p], l * 1.3, l * 1.3);
|
|
2700
|
-
const [
|
|
2701
|
-
t.limb(h,
|
|
2702
|
-
const b = s.points["shoulder.left"],
|
|
2703
|
-
b &&
|
|
2703
|
+
const [g, m] = c(0, i.bones.length - 1);
|
|
2704
|
+
t.limb(h, g, m);
|
|
2705
|
+
const b = s.points["shoulder.left"], S = s.points["shoulder.right"];
|
|
2706
|
+
b && S && Math.hypot(b.x - S.x, b.y - S.y) > 0.5 && t.limb(He(b, a[a.length - 1], S, 1, 10), l * 1.15, l * 1.15);
|
|
2704
2707
|
return;
|
|
2705
2708
|
}
|
|
2706
|
-
const [u,
|
|
2707
|
-
t.limb(h, u,
|
|
2709
|
+
const [u, d] = c(0, i.bones.length - 1);
|
|
2710
|
+
t.limb(h, u, d);
|
|
2708
2711
|
}
|
|
2709
|
-
function
|
|
2712
|
+
function Pr(e, t) {
|
|
2710
2713
|
const n = `hand.${t}.`, s = {};
|
|
2711
2714
|
for (const [l, i] of Object.entries(e)) l.startsWith(n) && (s[l.slice(n.length)] = i);
|
|
2712
2715
|
const o = e.turn ?? 0, r = t === "right" ? 1 - o : 1 + o;
|
|
2713
|
-
return { ...
|
|
2716
|
+
return { ...Y, ...s, turn: r + (s.turn ?? 0) };
|
|
2714
2717
|
}
|
|
2715
|
-
function
|
|
2718
|
+
function Kr(e, t, n, s, o, r) {
|
|
2716
2719
|
const l = s[s.length - 1], i = s[s.length - 2], a = Math.atan2(l.x - i.x, -(l.y - i.y)) * 180 / Math.PI;
|
|
2717
|
-
|
|
2720
|
+
Kt(e, l, Pr(r, o), {
|
|
2718
2721
|
size: n.handSize * n.height,
|
|
2719
2722
|
side: o,
|
|
2720
2723
|
angle: a,
|
|
@@ -2727,24 +2730,24 @@ function wr(e, t, n, s, o, r) {
|
|
|
2727
2730
|
lineWidth: n.lineWidth * 0.3
|
|
2728
2731
|
});
|
|
2729
2732
|
}
|
|
2730
|
-
function
|
|
2731
|
-
const o = t.plan.id === "human" ? { ...
|
|
2732
|
-
|
|
2733
|
+
function Wr(e, t, n, s = 0) {
|
|
2734
|
+
const o = t.plan.id === "human" ? { ...C, ...n } : n;
|
|
2735
|
+
Zn(e, t, o, Rt(t, o), s);
|
|
2733
2736
|
}
|
|
2734
|
-
function
|
|
2737
|
+
function Jn(e, t) {
|
|
2735
2738
|
const n = t / e.height;
|
|
2736
2739
|
return { ...e, height: t, lineWidth: e.lineWidth * n };
|
|
2737
2740
|
}
|
|
2738
|
-
function
|
|
2739
|
-
const o = e.plan.id === "human" ? { ...
|
|
2740
|
-
return
|
|
2741
|
+
function Di(e, t, n, s) {
|
|
2742
|
+
const o = e.plan.id === "human" ? { ...C, ...t } : t, r = Vn(e.plan, o, { height: s.height, contact: e.contact }, n);
|
|
2743
|
+
return Nt(Jn(e, r.height), o, r).joints;
|
|
2741
2744
|
}
|
|
2742
|
-
function
|
|
2743
|
-
const r = t.plan.id === "human" ? { ...
|
|
2744
|
-
|
|
2745
|
+
function Or(e, t, n, s, o) {
|
|
2746
|
+
const r = t.plan.id === "human" ? { ...C, ...n } : n, l = Vn(t.plan, r, { height: o.height, contact: t.contact }, s), i = Jn(t, l.height);
|
|
2747
|
+
Zn(e, i, r, Nt(i, r, l), o.time ?? 0);
|
|
2745
2748
|
}
|
|
2746
|
-
function
|
|
2747
|
-
const { joints: r, order: l } = s, i =
|
|
2749
|
+
function Zn(e, t, n, s, o) {
|
|
2750
|
+
const { joints: r, order: l } = s, i = Tn(e, {
|
|
2748
2751
|
look: t.look,
|
|
2749
2752
|
ink: t.ink,
|
|
2750
2753
|
lineWidth: t.lineWidth,
|
|
@@ -2754,14 +2757,14 @@ function Xn(e, t, n, s, o) {
|
|
|
2754
2757
|
}), a = (h) => {
|
|
2755
2758
|
h && (e.save(), h(e, r, i, o), e.restore());
|
|
2756
2759
|
};
|
|
2757
|
-
e.save(), e.lineCap = "round", e.lineJoin = "round", t.look === "pencil" && t.pencil.construction !== !1 &&
|
|
2760
|
+
e.save(), e.lineCap = "round", e.lineJoin = "round", t.look === "pencil" && t.pencil.construction !== !1 && Ar(i, t, r), a(t.layers.behind);
|
|
2758
2761
|
for (const h of l) {
|
|
2759
2762
|
const c = t.layers.parts?.[h];
|
|
2760
|
-
a(c?.under),
|
|
2763
|
+
a(c?.under), xr(e, i, t, r, h, n), a(c?.over);
|
|
2761
2764
|
}
|
|
2762
2765
|
a(t.layers.front), e.restore();
|
|
2763
2766
|
}
|
|
2764
|
-
function
|
|
2767
|
+
function Xi(e, t, n) {
|
|
2765
2768
|
const s = { ...e };
|
|
2766
2769
|
for (const [o, r] of Object.entries(t)) {
|
|
2767
2770
|
const l = e[o] ?? r;
|
|
@@ -2769,19 +2772,19 @@ function Wi(e, t, n) {
|
|
|
2769
2772
|
}
|
|
2770
2773
|
return s;
|
|
2771
2774
|
}
|
|
2772
|
-
function
|
|
2773
|
-
const o = e.plan.id === "human" ? { ...
|
|
2775
|
+
function qi(e, t, n, s) {
|
|
2776
|
+
const o = e.plan.id === "human" ? { ...C, ...t } : t;
|
|
2774
2777
|
let r;
|
|
2775
2778
|
if (Array.isArray(s))
|
|
2776
2779
|
r = s;
|
|
2777
2780
|
else {
|
|
2778
|
-
const { skeleton: l } =
|
|
2779
|
-
r = [u *
|
|
2781
|
+
const { skeleton: l } = Rt(e, o), i = Ft(e.plan, { ...o, roll: 0 }, { height: e.height, contact: "none" }), a = (o.roll ?? 0) * Math.PI / 180, h = s.x - l.hip.x, c = s.y - l.hip.y, u = i.hip.x + h * Math.cos(-a) - c * Math.sin(-a), d = i.hip.y + h * Math.sin(-a) + c * Math.cos(-a), f = Math.PI / 2 * (o.turn ?? 0), p = s.depth ?? l.chains[n].depths[l.chains[n].depths.length - 1], g = Math.cos(f), m = Math.sin(f);
|
|
2782
|
+
r = [u * g - p * m, -d, u * m + p * g];
|
|
2780
2783
|
}
|
|
2781
|
-
return
|
|
2784
|
+
return mr(e.plan, o, n, r, { height: e.height });
|
|
2782
2785
|
}
|
|
2783
|
-
function
|
|
2784
|
-
const { character: t } = e, n = t.height * 0.8, s = t.height, o = t.plan.id === "human" ?
|
|
2786
|
+
function Gi(e) {
|
|
2787
|
+
const { character: t } = e, n = t.height * 0.8, s = t.height, o = t.plan.id === "human" ? C : {};
|
|
2785
2788
|
return {
|
|
2786
2789
|
type: "custom",
|
|
2787
2790
|
x: e.x - n / 2,
|
|
@@ -2791,11 +2794,11 @@ function Ii(e) {
|
|
|
2791
2794
|
props: { ...o, ...e.pose },
|
|
2792
2795
|
character: t,
|
|
2793
2796
|
draw(r, l, i) {
|
|
2794
|
-
r.translate(n / 2, s),
|
|
2797
|
+
r.translate(n / 2, s), Wr(r, t, l.props, i);
|
|
2795
2798
|
}
|
|
2796
2799
|
};
|
|
2797
2800
|
}
|
|
2798
|
-
function
|
|
2801
|
+
function Ir(e, t, n) {
|
|
2799
2802
|
const s = (r) => ({ x: r.x + t, y: r.y + n }), o = (r) => Object.fromEntries(Object.entries(r).map(([l, i]) => [l, i.map(s)]));
|
|
2800
2803
|
return {
|
|
2801
2804
|
...e,
|
|
@@ -2806,25 +2809,25 @@ function Sr(e, t, n) {
|
|
|
2806
2809
|
groundY: e.groundY + n
|
|
2807
2810
|
};
|
|
2808
2811
|
}
|
|
2809
|
-
function
|
|
2812
|
+
function Ui(e, t, n) {
|
|
2810
2813
|
const s = e.character;
|
|
2811
2814
|
if (!s) throw new Error("characterAt: the target was not made by characterTarget");
|
|
2812
2815
|
const o = { ...e.props };
|
|
2813
2816
|
let r = 0, l = 0;
|
|
2814
2817
|
for (const [a, h] of t.state?.values.get(n) ?? [])
|
|
2815
2818
|
typeof h == "number" && (a === "x" || a === "motionPathX" ? r = h : a === "y" || a === "motionPathY" ? l = h : a in o && (o[a] = h));
|
|
2816
|
-
const i =
|
|
2817
|
-
return { pose: o, joints:
|
|
2819
|
+
const i = Tr(s, o);
|
|
2820
|
+
return { pose: o, joints: Ir(i, e.x + r + e.width / 2, e.y + l + e.height) };
|
|
2818
2821
|
}
|
|
2819
|
-
function
|
|
2822
|
+
function Qn(e, t = C) {
|
|
2820
2823
|
const n = [];
|
|
2821
2824
|
return e.forEach((s, o) => {
|
|
2822
|
-
const r = o === 0 ? t : n[o - 1], l = typeof s.pose == "string" ?
|
|
2825
|
+
const r = o === 0 ? t : n[o - 1], l = typeof s.pose == "string" ? cr[s.pose] : void 0;
|
|
2823
2826
|
n.push(l ? { ...l, turn: r.turn ?? 0 } : { ...r, ...s.pose });
|
|
2824
2827
|
}), n;
|
|
2825
2828
|
}
|
|
2826
|
-
function
|
|
2827
|
-
const s =
|
|
2829
|
+
function zi(e, t, n = C) {
|
|
2830
|
+
const s = Qn(t, n);
|
|
2828
2831
|
return Object.keys(n).filter((r) => s.some((l) => (l[r] ?? n[r]) !== n[r])).map((r) => ({
|
|
2829
2832
|
id: `${e}-${r}`,
|
|
2830
2833
|
target: e,
|
|
@@ -2836,7 +2839,7 @@ function $i(e, t, n = X) {
|
|
|
2836
2839
|
}))
|
|
2837
2840
|
}));
|
|
2838
2841
|
}
|
|
2839
|
-
const
|
|
2842
|
+
const _r = /* @__PURE__ */ new Set([
|
|
2840
2843
|
"x",
|
|
2841
2844
|
"y",
|
|
2842
2845
|
"z",
|
|
@@ -2852,43 +2855,43 @@ const Er = /* @__PURE__ */ new Set([
|
|
|
2852
2855
|
"visible",
|
|
2853
2856
|
"opacity",
|
|
2854
2857
|
"color"
|
|
2855
|
-
]),
|
|
2856
|
-
function
|
|
2858
|
+
]), $r = 1.7;
|
|
2859
|
+
function Br(e, t, n) {
|
|
2857
2860
|
const s = Array.from({ length: 24 }, (o, r) => {
|
|
2858
2861
|
const l = r / 24 * Math.PI * 2, i = t.toView([Math.cos(l) * n, 0, Math.sin(l) * n * 0.8]);
|
|
2859
2862
|
return i[2] < -1e-3 ? t.toScreen(i) : null;
|
|
2860
2863
|
});
|
|
2861
2864
|
s.some((o) => o === null) || (e.beginPath(), s.forEach((o, r) => r === 0 ? e.moveTo(o.x, o.y) : e.lineTo(o.x, o.y)), e.closePath(), e.fillStyle = "rgba(0, 0, 0, 0.22)", e.fill());
|
|
2862
2865
|
}
|
|
2863
|
-
function
|
|
2864
|
-
const t =
|
|
2865
|
-
if (t > 0.999999) return
|
|
2866
|
-
if (t < -0.999999) return
|
|
2867
|
-
const n =
|
|
2868
|
-
return
|
|
2869
|
-
}
|
|
2870
|
-
function
|
|
2871
|
-
const r = e.solid ?? {}, l = r.outline === !1 ? void 0 : r.outline ?? { width: 2, color: "#0f172a" }, i = { color: r.color ?? "#475569", shading: r.shading ?? "toon", outline: l }, a = { color: r.skin ?? "#f2c49b", shading: r.shading ?? "toon", outline: l }, h = { color: "#0f172a", shading: "unlit" }, c = s.height * 0.034, u = [],
|
|
2872
|
-
for (const
|
|
2873
|
-
const
|
|
2874
|
-
|
|
2875
|
-
const
|
|
2876
|
-
if (
|
|
2877
|
-
const
|
|
2878
|
-
|
|
2866
|
+
function Fr(e) {
|
|
2867
|
+
const t = Q.dot([0, 1, 0], e);
|
|
2868
|
+
if (t > 0.999999) return U.identity();
|
|
2869
|
+
if (t < -0.999999) return U.fromQuat(Yt.fromAxisAngle([1, 0, 0], 180));
|
|
2870
|
+
const n = Q.cross([0, 1, 0], e);
|
|
2871
|
+
return U.fromQuat(Yt.fromAxisAngle(n, Math.acos(t) * 180 / Math.PI));
|
|
2872
|
+
}
|
|
2873
|
+
function Rr(e, t, n, s, o) {
|
|
2874
|
+
const r = e.solid ?? {}, l = r.outline === !1 ? void 0 : r.outline ?? { width: 2, color: "#0f172a" }, i = { color: r.color ?? "#475569", shading: r.shading ?? "toon", outline: l }, a = { color: r.skin ?? "#f2c49b", shading: r.shading ?? "toon", outline: l }, h = { color: "#0f172a", shading: "unlit" }, c = s.height * 0.034, u = [], d = (k, v, H) => u.push({ mesh: k, world: U.multiply(o, v), material: H }), f = (k, v, H) => d(t.sphere, U.compose(k, [0, 0, 0, 1], [v, v, v]), H);
|
|
2875
|
+
for (const k of n.chains) {
|
|
2876
|
+
const v = s.chains[k.id], H = k.id === "spine" ? 1.9 : 1;
|
|
2877
|
+
k.bones.forEach((T, M) => {
|
|
2878
|
+
const w = v[M], y = v[M + 1], A = Q.distance(w, y), [x, E] = T.width ?? [1, 1], P = c * H * (x + E) / 2;
|
|
2879
|
+
if (A > 1e-6) {
|
|
2880
|
+
const K = Q.lerp(w, y, 0.5), _ = Fr(Q.normalize(Q.subtract(y, w)));
|
|
2881
|
+
d(t.cylinder, U.multiply(U.translation(K), U.multiply(_, U.scaling([P, A, P]))), i);
|
|
2879
2882
|
}
|
|
2880
|
-
f(
|
|
2881
|
-
}),
|
|
2883
|
+
f(w, c * H * x, i), f(y, c * H * E, i);
|
|
2884
|
+
}), k.id.startsWith("arm.") && f(v[v.length - 1], c * 1.5, a);
|
|
2882
2885
|
}
|
|
2883
|
-
const { center: p, rx:
|
|
2884
|
-
|
|
2885
|
-
for (const
|
|
2886
|
-
const
|
|
2887
|
-
|
|
2886
|
+
const { center: p, rx: g, ry: m, axes: b } = s.head, S = [...b[0], 0, ...b[1], 0, ...b[2], 0, ...p, 1];
|
|
2887
|
+
d(t.sphere, U.multiply(S, U.scaling([g, m, g])), a);
|
|
2888
|
+
for (const k of [-1, 1]) {
|
|
2889
|
+
const v = Q.normalize([k * 0.36, 0.15, 0.92]), H = Q.add(p, Q.add(Q.add(Q.scale(b[0], v[0] * g * 1.04), Q.scale(b[1], v[1] * m * 1.04)), Q.scale(b[2], v[2] * g * 1.04))), T = [...b[0], 0, ...b[1], 0, ...b[2], 0, ...H, 1];
|
|
2890
|
+
d(t.sphere, U.multiply(T, U.scaling([g * 0.11, m * 0.14, g * 0.03])), h);
|
|
2888
2891
|
}
|
|
2889
2892
|
return u;
|
|
2890
2893
|
}
|
|
2891
|
-
const
|
|
2894
|
+
const Vi = {
|
|
2892
2895
|
kind: "character",
|
|
2893
2896
|
validate(e) {
|
|
2894
2897
|
const t = e;
|
|
@@ -2896,39 +2899,39 @@ const Bi = {
|
|
|
2896
2899
|
},
|
|
2897
2900
|
prepare(e) {
|
|
2898
2901
|
return {
|
|
2899
|
-
who:
|
|
2900
|
-
cylinder:
|
|
2901
|
-
sphere:
|
|
2902
|
+
who: Mr({ ...e.character, height: 1 }),
|
|
2903
|
+
cylinder: Ct(go(1, 1, 16)),
|
|
2904
|
+
sphere: Ct(uo(1, 20))
|
|
2902
2905
|
};
|
|
2903
2906
|
},
|
|
2904
2907
|
resolve({ object: e, prepared: t, values: n, world: s, camera: o, toScreen: r }) {
|
|
2905
|
-
const l = e, i = t, a = i.who, h = { ...
|
|
2908
|
+
const l = e, i = t, a = i.who, h = { ...C, ...l.pose };
|
|
2906
2909
|
for (const [m, b] of n)
|
|
2907
|
-
typeof b == "number" && !
|
|
2908
|
-
const c = l.height ??
|
|
2909
|
-
toView: (m) =>
|
|
2910
|
+
typeof b == "number" && !_r.has(m) && (h[m] = b);
|
|
2911
|
+
const c = l.height ?? $r, u = U.multiply(o.view, s), d = {
|
|
2912
|
+
toView: (m) => U.transformPoint(u, m),
|
|
2910
2913
|
toScreen: (m) => r(m)
|
|
2911
|
-
}, p = -
|
|
2914
|
+
}, p = -d.toView([0, c / 2, 0])[2];
|
|
2912
2915
|
if (p <= o.near) return null;
|
|
2913
|
-
const
|
|
2916
|
+
const g = l.shadow === !1 ? [] : [{ depth: p + c, draw: (m) => Br(m, d, c * 0.18) }];
|
|
2914
2917
|
if (l.look === "solid") {
|
|
2915
|
-
const m =
|
|
2916
|
-
return { meshes:
|
|
2918
|
+
const m = zn(a.plan, h, { height: c, contact: a.contact });
|
|
2919
|
+
return { meshes: Rr(l, i, a.plan, m, s), drawables: g };
|
|
2917
2920
|
}
|
|
2918
2921
|
return {
|
|
2919
2922
|
drawables: [
|
|
2920
|
-
...
|
|
2923
|
+
...g,
|
|
2921
2924
|
{
|
|
2922
2925
|
depth: p,
|
|
2923
2926
|
draw(m, b) {
|
|
2924
|
-
m.lineCap = "round", m.lineJoin = "round",
|
|
2927
|
+
m.lineCap = "round", m.lineJoin = "round", Or(m, a, h, d, { height: c, time: b.time });
|
|
2925
2928
|
}
|
|
2926
2929
|
}
|
|
2927
2930
|
]
|
|
2928
2931
|
};
|
|
2929
2932
|
}
|
|
2930
2933
|
};
|
|
2931
|
-
function
|
|
2934
|
+
function Nr(e, t, n = {}, s) {
|
|
2932
2935
|
const o = n.length ?? 240, r = 9, l = 28, i = o - 22;
|
|
2933
2936
|
e.save(), e.translate(t.x, t.y), e.rotate((n.angle ?? -30) * Math.PI / 180), e.fillStyle = n.color ?? "#f4c542", e.fillRect(l, -r, i - l, 2 * r), e.fillStyle = "#e8b4a0", e.fillRect(i, -r, o - i, 2 * r), e.fillStyle = "#f1dcbf", e.beginPath(), e.moveTo(0, 0), e.lineTo(l, -r), e.lineTo(l, r), e.closePath(), e.fill(), e.fillStyle = n.outline ?? "#2f2f33", e.beginPath(), e.moveTo(0, 0), e.lineTo(l * 0.35, -r * 0.35), e.lineTo(l * 0.35, r * 0.35), e.closePath(), e.fill(), e.strokeStyle = n.outline ?? "#2f2f33", e.lineWidth = 3, e.lineJoin = "round", e.lineCap = "round";
|
|
2934
2937
|
const a = [
|
|
@@ -2936,10 +2939,10 @@ function Ar(e, t, n = {}, s) {
|
|
|
2936
2939
|
[{ x: l, y: -r }, { x: l, y: r }],
|
|
2937
2940
|
[{ x: i, y: -r }, { x: i, y: r }]
|
|
2938
2941
|
];
|
|
2939
|
-
for (const h of a)
|
|
2942
|
+
for (const h of a) oo(e, h, s);
|
|
2940
2943
|
e.restore();
|
|
2941
2944
|
}
|
|
2942
|
-
function
|
|
2945
|
+
function eo(e, t, n = {}, s) {
|
|
2943
2946
|
const o = n.length ?? 90, r = n.thickness ?? 34;
|
|
2944
2947
|
e.save(), e.translate(t.x, t.y), e.rotate((n.angle ?? -35) * Math.PI / 180);
|
|
2945
2948
|
const l = -r / 2;
|
|
@@ -2961,69 +2964,69 @@ function Gn(e, t, n = {}, s) {
|
|
|
2961
2964
|
}
|
|
2962
2965
|
e.restore();
|
|
2963
2966
|
}
|
|
2964
|
-
const
|
|
2965
|
-
function
|
|
2966
|
-
const o = n.tool ?? "pencil", r = n.skin ?? "#f1c9a5", l = n.outline ?? "#2f2f33", i = n.scale ?? 1, a = Math.min(1, Math.max(0, n.lift ?? 0)), h = (n.angle ?? -30) * Math.PI / 180, c = s ? s.nudge(0.6) : { x: 0, y: 0 }, u =
|
|
2967
|
+
const to = 150, Lr = { pencil: 44, eraser: 30 };
|
|
2968
|
+
function no(e, t, n = {}, s) {
|
|
2969
|
+
const o = n.tool ?? "pencil", r = n.skin ?? "#f1c9a5", l = n.outline ?? "#2f2f33", i = n.scale ?? 1, a = Math.min(1, Math.max(0, n.lift ?? 0)), h = (n.angle ?? -30) * Math.PI / 180, c = s ? s.nudge(0.6) : { x: 0, y: 0 }, u = to * i * (1 + 0.05 * a);
|
|
2967
2970
|
a > 0 && (e.save(), e.fillStyle = l, e.globalAlpha = 0.15 * a, e.beginPath(), e.ellipse(t.x, t.y, 9 * i, 4 * i, 0, 0, Math.PI * 2), e.fill(), e.restore());
|
|
2968
|
-
const
|
|
2969
|
-
const
|
|
2970
|
-
return { pinch:
|
|
2971
|
-
},
|
|
2972
|
-
|
|
2971
|
+
const d = { x: t.x + c.x + 6 * a * i, y: t.y + c.y - 18 * a * i }, f = q.pencilGrip, p = (M) => {
|
|
2972
|
+
const w = M.fingers.thumb, y = M.fingers.index, A = M.fingers.middle, x = hn([w.points[3], y.points[3], A.points[3]]), E = hn([w.points[1], y.points[0]]), P = (w.depths[3] + y.depths[3] + A.depths[3]) / 3;
|
|
2973
|
+
return { pinch: x, direction: Math.atan2(E.y - x.y, E.x - x.x), depth: P };
|
|
2974
|
+
}, g = yt(f, { size: u }), m = h - p(g).direction, b = yt(f, { size: u, angle: m * 180 / Math.PI }), S = p(b), k = Lr[o] * i, v = { x: S.pinch.x - Math.cos(h) * k, y: S.pinch.y - Math.sin(h) * k }, H = { x: d.x - v.x, y: d.y - v.y }, T = b.axes.up;
|
|
2975
|
+
Yr(e, H, { x: -T.x, y: -T.y }, u, n.arm ?? 300 * i, r, n.sleeve ?? "#5b7db1", l), Kt(e, H, f, {
|
|
2973
2976
|
size: u,
|
|
2974
2977
|
angle: m * 180 / Math.PI,
|
|
2975
2978
|
skin: r,
|
|
2976
2979
|
ink: l,
|
|
2977
2980
|
lineWidth: 3 * i,
|
|
2978
2981
|
prop: {
|
|
2979
|
-
depth:
|
|
2982
|
+
depth: S.depth,
|
|
2980
2983
|
draw: () => {
|
|
2981
|
-
e.save(), e.translate(
|
|
2984
|
+
e.save(), e.translate(d.x, d.y), e.scale(i, i), o === "eraser" ? eo(e, { x: 0, y: 0 }, { angle: h * 180 / Math.PI, outline: l }, s) : Nr(e, { x: 0, y: 0 }, { angle: h * 180 / Math.PI, length: 190, outline: l }, s), e.restore();
|
|
2982
2985
|
}
|
|
2983
2986
|
}
|
|
2984
2987
|
});
|
|
2985
2988
|
}
|
|
2986
|
-
const
|
|
2989
|
+
const hn = (e) => ({
|
|
2987
2990
|
x: e.reduce((t, n) => t + n.x, 0) / e.length,
|
|
2988
2991
|
y: e.reduce((t, n) => t + n.y, 0) / e.length
|
|
2989
2992
|
});
|
|
2990
|
-
function
|
|
2991
|
-
const a = { x: -n.y, y: n.x }, h = s * 0.15, c = (
|
|
2992
|
-
x: t.x + n.x *
|
|
2993
|
-
y: t.y + n.y *
|
|
2994
|
-
}), u = c(o, 0, 0),
|
|
2993
|
+
function Yr(e, t, n, s, o, r, l, i) {
|
|
2994
|
+
const a = { x: -n.y, y: n.x }, h = s * 0.15, c = (g, m, b) => ({
|
|
2995
|
+
x: t.x + n.x * g + a.x * m * b,
|
|
2996
|
+
y: t.y + n.y * g + a.y * m * b
|
|
2997
|
+
}), u = c(o, 0, 0), d = (g) => {
|
|
2995
2998
|
const m = e.createLinearGradient(t.x, t.y, u.x, u.y);
|
|
2996
|
-
return m.addColorStop(0,
|
|
2999
|
+
return m.addColorStop(0, g), m.addColorStop(0.6, g), m.addColorStop(1, Cr(g)), m;
|
|
2997
3000
|
}, f = Math.min(s * 0.55, o * 0.35);
|
|
2998
|
-
e.save(), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 3 * (s /
|
|
3001
|
+
e.save(), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 3 * (s / to), e.beginPath(), e.moveTo(c(-s * 0.1, -1, h).x, c(-s * 0.1, -1, h).y), e.lineTo(c(f + 4, -1, h * 1.1).x, c(f + 4, -1, h * 1.1).y), e.lineTo(c(f + 4, 1, h * 1.1).x, c(f + 4, 1, h * 1.1).y), e.lineTo(c(-s * 0.1, 1, h).x, c(-s * 0.1, 1, h).y), e.closePath(), e.fillStyle = r, e.fill(), e.strokeStyle = i, e.beginPath(), e.moveTo(c(0, -1, h).x, c(0, -1, h).y), e.lineTo(c(f, -1, h * 1.1).x, c(f, -1, h * 1.1).y), e.moveTo(c(0, 1, h).x, c(0, 1, h).y), e.lineTo(c(f, 1, h * 1.1).x, c(f, 1, h * 1.1).y), e.stroke();
|
|
2999
3002
|
const p = [c(f, -1, h * 1.3), c(o, -1, h * 1.5), c(o, 1, h * 1.5), c(f, 1, h * 1.3)];
|
|
3000
|
-
e.beginPath(), p.forEach((
|
|
3003
|
+
e.beginPath(), p.forEach((g, m) => m ? e.lineTo(g.x, g.y) : e.moveTo(g.x, g.y)), e.closePath(), e.fillStyle = d(l), e.fill(), e.strokeStyle = d(i), e.beginPath(), e.moveTo(p[1].x, p[1].y), e.lineTo(p[0].x, p[0].y), e.lineTo(p[3].x, p[3].y), e.lineTo(p[2].x, p[2].y), e.stroke(), e.restore();
|
|
3001
3004
|
}
|
|
3002
|
-
function
|
|
3003
|
-
const s = n.offstage ?? { x: 2e3, y: 1400 }, o = n.enter ?? 450, r = n.exit ?? 450, l = n.linger ?? 1500, i = [...e].filter((
|
|
3004
|
-
const m = Math.min(1, Math.max(0,
|
|
3005
|
+
function ji(e, t, n = {}) {
|
|
3006
|
+
const s = n.offstage ?? { x: 2e3, y: 1400 }, o = n.enter ?? 450, r = n.exit ?? 450, l = n.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, m) => g.start - m.start), a = (g) => g.tool ?? "pencil", h = (g) => {
|
|
3007
|
+
const m = Math.min(1, Math.max(0, g));
|
|
3005
3008
|
return m * m * (3 - 2 * m);
|
|
3006
|
-
}, c = (
|
|
3009
|
+
}, c = (g, m, b) => ({ x: g.x + (m.x - g.x) * b, y: g.y + (m.y - g.y) * b }), u = i.find((g) => t >= g.start && t <= g.end);
|
|
3007
3010
|
if (u) {
|
|
3008
|
-
const
|
|
3009
|
-
return { at:
|
|
3011
|
+
const g = u.end - u.start, m = g > 0 ? (t - u.start) / g : 1;
|
|
3012
|
+
return { at: xt(u.path, m), tool: a(u), lift: 0, drawing: !0 };
|
|
3010
3013
|
}
|
|
3011
|
-
const
|
|
3012
|
-
if (
|
|
3013
|
-
const
|
|
3014
|
-
return { at: c(p(
|
|
3014
|
+
const d = [...i].reverse().find((g) => g.end < t), f = i.find((g) => g.start > t), p = (g) => g.path[g.path.length - 1];
|
|
3015
|
+
if (d && f && f.start - d.end <= l) {
|
|
3016
|
+
const g = (t - d.end) / (f.start - d.end), m = g < 0.5 ? a(d) : a(f);
|
|
3017
|
+
return { at: c(p(d), f.path[0], h(g)), tool: m, lift: Math.sin(Math.PI * g), drawing: !1 };
|
|
3015
3018
|
}
|
|
3016
3019
|
if (f && f.start - t <= o) {
|
|
3017
|
-
const
|
|
3018
|
-
return { at: c(s, f.path[0], h(
|
|
3020
|
+
const g = 1 - (f.start - t) / o;
|
|
3021
|
+
return { at: c(s, f.path[0], h(g)), tool: a(f), lift: 1 - h(g), drawing: !1 };
|
|
3019
3022
|
}
|
|
3020
|
-
if (
|
|
3021
|
-
const
|
|
3022
|
-
return { at: c(p(
|
|
3023
|
+
if (d && t - d.end <= r) {
|
|
3024
|
+
const g = (t - d.end) / r;
|
|
3025
|
+
return { at: c(p(d), s, h(g)), tool: a(d), lift: h(g), drawing: !1 };
|
|
3023
3026
|
}
|
|
3024
3027
|
return null;
|
|
3025
3028
|
}
|
|
3026
|
-
function
|
|
3029
|
+
function Ji(e, t, n, s = 0.08, o = 32) {
|
|
3027
3030
|
const r = Math.PI * 2 * (1 + s), l = [];
|
|
3028
3031
|
for (let i = 0; i <= o; i++) {
|
|
3029
3032
|
const a = -Math.PI / 2 + r * i / o;
|
|
@@ -3031,7 +3034,7 @@ function Ri(e, t, n, s = 0.08, o = 32) {
|
|
|
3031
3034
|
}
|
|
3032
3035
|
return l;
|
|
3033
3036
|
}
|
|
3034
|
-
function
|
|
3037
|
+
function Zi(e) {
|
|
3035
3038
|
const { path: t } = e, n = t.map((i) => i.x), s = t.map((i) => i.y), o = Math.min(...n), r = Math.min(...s), l = e.hand === !1 ? void 0 : e.hand === !0 || e.hand === void 0 ? {} : e.hand;
|
|
3036
3039
|
return {
|
|
3037
3040
|
type: "custom",
|
|
@@ -3043,18 +3046,18 @@ function Li(e) {
|
|
|
3043
3046
|
draw(i, a, h) {
|
|
3044
3047
|
const c = Math.min(1, Math.max(0, Number(a.props?.draw ?? 0)));
|
|
3045
3048
|
i.translate(-o, -r), i.strokeStyle = e.color ?? "#2f2f33", i.lineWidth = e.lineWidth ?? 5, i.lineCap = "round", i.lineJoin = "round";
|
|
3046
|
-
const u = e.sketch ?
|
|
3047
|
-
c > 0 && (u ? e.smooth ? u.curve(t, c) : u.line(t, c) :
|
|
3049
|
+
const u = e.sketch ? mt(i, e.sketch, h) : void 0;
|
|
3050
|
+
c > 0 && (u ? e.smooth ? u.curve(t, c) : u.line(t, c) : oo(i, vn(t, c))), l && c > 0 && c < 1 && no(i, xt(t, c), l, u);
|
|
3048
3051
|
}
|
|
3049
3052
|
};
|
|
3050
3053
|
}
|
|
3051
|
-
function
|
|
3054
|
+
function Cr(e) {
|
|
3052
3055
|
const t = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
3053
3056
|
if (!t) return "rgba(0, 0, 0, 0)";
|
|
3054
3057
|
const n = t[1].length === 3 ? [...t[1]].map((l) => l + l).join("") : t[1], [s, o, r] = [0, 2, 4].map((l) => parseInt(n.slice(l, l + 2), 16));
|
|
3055
3058
|
return `rgba(${s}, ${o}, ${r}, 0)`;
|
|
3056
3059
|
}
|
|
3057
|
-
function
|
|
3060
|
+
function oo(e, t, n) {
|
|
3058
3061
|
if (!(t.length < 2)) {
|
|
3059
3062
|
if (n) return n.line(t);
|
|
3060
3063
|
e.beginPath(), e.moveTo(t[0].x, t[0].y);
|
|
@@ -3062,17 +3065,17 @@ function Vn(e, t, n) {
|
|
|
3062
3065
|
e.stroke();
|
|
3063
3066
|
}
|
|
3064
3067
|
}
|
|
3065
|
-
const
|
|
3066
|
-
function
|
|
3068
|
+
const Ce = 1e5;
|
|
3069
|
+
function Qi(e, t, n, s, o = 6) {
|
|
3067
3070
|
const r = [], l = Math.max(1, Math.round(o));
|
|
3068
3071
|
for (let i = 0; i <= l; i++)
|
|
3069
3072
|
r.push({ x: i % 2 === 0 ? e : e + n, y: t + s * i / l });
|
|
3070
3073
|
return r;
|
|
3071
3074
|
}
|
|
3072
|
-
function
|
|
3075
|
+
function so(e, t, n, s) {
|
|
3073
3076
|
if (s <= 0 || t.length === 0) return;
|
|
3074
|
-
const o =
|
|
3075
|
-
e.beginPath(), e.rect(-
|
|
3077
|
+
const o = vn(t, s), r = n / 2, l = (i) => {
|
|
3078
|
+
e.beginPath(), e.rect(-Ce, -Ce, 2 * Ce, 2 * Ce), i(), e.clip("evenodd");
|
|
3076
3079
|
};
|
|
3077
3080
|
for (const i of o)
|
|
3078
3081
|
l(() => {
|
|
@@ -3081,41 +3084,141 @@ function jn(e, t, n, s) {
|
|
|
3081
3084
|
for (let i = 1; i < o.length; i++) {
|
|
3082
3085
|
const a = o[i - 1], h = o[i], c = Math.hypot(h.x - a.x, h.y - a.y);
|
|
3083
3086
|
if (c === 0) continue;
|
|
3084
|
-
const u = -(h.y - a.y) / c * r,
|
|
3087
|
+
const u = -(h.y - a.y) / c * r, d = (h.x - a.x) / c * r;
|
|
3085
3088
|
l(() => {
|
|
3086
|
-
e.moveTo(a.x + u, a.y +
|
|
3089
|
+
e.moveTo(a.x + u, a.y + d), e.lineTo(h.x + u, h.y + d), e.lineTo(h.x - u, h.y - d), e.lineTo(a.x - u, a.y - d), e.closePath();
|
|
3087
3090
|
});
|
|
3088
3091
|
}
|
|
3089
3092
|
}
|
|
3090
|
-
function
|
|
3091
|
-
e.save(),
|
|
3093
|
+
function el(e, t, n, s, o) {
|
|
3094
|
+
e.save(), so(e, t, n, s), o(), e.restore();
|
|
3092
3095
|
}
|
|
3093
|
-
function
|
|
3096
|
+
function tl(e, t) {
|
|
3094
3097
|
const n = t.width ?? 40, s = t.hand === !0 ? {} : t.hand || void 0, o = t.eraser === !1 ? void 0 : t.eraser === !0 || t.eraser === void 0 ? {} : t.eraser;
|
|
3095
3098
|
return {
|
|
3096
3099
|
...e,
|
|
3097
3100
|
props: { ...e.props, erase: 0 },
|
|
3098
3101
|
draw(r, l, i) {
|
|
3099
3102
|
const a = Number(l.props?.erase ?? 0);
|
|
3100
|
-
if (r.save(),
|
|
3101
|
-
const h =
|
|
3102
|
-
s ?
|
|
3103
|
+
if (r.save(), so(r, t.path, n, a), e.draw(r, l, i), r.restore(), !o || a <= 0 || a >= 1) return;
|
|
3104
|
+
const h = xt(t.path, a);
|
|
3105
|
+
s ? no(r, h, { ...s, tool: "eraser" }) : eo(r, h, o);
|
|
3103
3106
|
}
|
|
3104
3107
|
};
|
|
3105
3108
|
}
|
|
3106
|
-
const
|
|
3107
|
-
|
|
3109
|
+
const cn = 40, Dr = 0.215 + 0.205, Z = (e, t) => {
|
|
3110
|
+
const n = {};
|
|
3111
|
+
for (const s of ["left", "right"]) for (const [o, r] of Object.entries(t)) n[`${e}.${s}.${o}`] = r;
|
|
3112
|
+
return n;
|
|
3113
|
+
}, O = (e, t) => e[t] ?? C[t] ?? 0;
|
|
3114
|
+
function nl(e, t, n = C, s = 1) {
|
|
3115
|
+
const o = ot(e), r = t * Math.PI * 2, l = Math.sin(r) * s, i = Math.cos(r) * s, a = (1 + Math.cos(r * 2 * (o.bounces ?? 1))) / 2, h = o.crouch ?? 0, c = o.shoulder ?? 0, u = o.forearm ?? 0, d = { ...C, ...n };
|
|
3116
|
+
d["leg.left.swing"] = o.swing * l + h * 0.6, d["leg.right.swing"] = -o.swing * l + h * 0.6, d["leg.left.knee"] = o.knee * Math.max(0, i) + h * 1.2, d["leg.right.knee"] = o.knee * Math.max(0, -i) + h * 1.2, d["leg.left.ankle"] = O(n, "leg.left.ankle") - (o.tiptoe ?? 0), d["leg.right.ankle"] = O(n, "leg.right.ankle") - (o.tiptoe ?? 0);
|
|
3117
|
+
for (const [f, p] of [["left", -1], ["right", 1]])
|
|
3118
|
+
O(n, `arm.${f}.spread`) > cn || O(n, `arm.${f}.swing`) > cn || (d[`arm.${f}.swing`] = c + p * o.arm * l, d[`arm.${f}.elbow`] = O(n, `arm.${f}.elbow`) + u + o.elbow * Math.max(0, p * l));
|
|
3119
|
+
return d.lean = O(n, "lean") + o.lean * s, d.bend = O(n, "bend") + (o.bend ?? 0), d["head.nod"] = O(n, "head.nod") - o.lean * 0.5 * s + (o.headTilt ?? 0), d.side = O(n, "side") + (o.sway ?? 0) * Math.sin(r), d.lift = O(n, "lift") + (o.bounce ?? 0) * s * a, d.stretch = O(n, "stretch") * (1 + (o.squash ?? 0) * (a - 0.5)), d;
|
|
3120
|
+
}
|
|
3121
|
+
function ol(e, t, n = 1) {
|
|
3122
|
+
const s = ot(e);
|
|
3123
|
+
return 4 * Dr * t * Math.sin(s.swing * n * Math.PI / 180);
|
|
3124
|
+
}
|
|
3125
|
+
const ye = (e) => dr[e], Xr = {
|
|
3126
|
+
/** Squash down in a squint, shoot up stretched with arms flung up, hang, land squashed, end surprised. */
|
|
3127
|
+
take: (e) => [
|
|
3128
|
+
{ after: 140, pose: { stretch: 0.8, bend: 10, lean: O(e, "lean") - 4, ...Z("arm", { spread: 6, swing: 0, elbow: 10 }), "eye.left": 0.35, "eye.right": 0.35, "brow.left": -0.6, "brow.right": -0.6, mouth: 0 }, easing: "ease-in-out" },
|
|
3129
|
+
{ after: 260, pose: { stretch: 0.78 } },
|
|
3130
|
+
{ after: 360, pose: { lift: 0.22, stretch: 1.35, bend: -14, ...Z("arm", { spread: 150, bend: 35, swing: 0, elbow: 0 }), ...Z("leg", { swing: 25, knee: 60 }), ...ye("shocked") }, easing: "ease-out-cubic" },
|
|
3131
|
+
{ after: 720, pose: { lift: 0.25, stretch: 1.25, bend: -10, ...Z("arm", { spread: 140 }) }, easing: "ease-in-out" },
|
|
3132
|
+
{ after: 900, pose: { lift: 0, stretch: 0.74, bend: 12, ...Z("arm", { spread: 70, bend: 0 }), ...Z("leg", { swing: 30, knee: 60 }) }, easing: "ease-in-quad" },
|
|
3133
|
+
{
|
|
3134
|
+
after: 1060,
|
|
3135
|
+
pose: {
|
|
3136
|
+
stretch: 1.06,
|
|
3137
|
+
bend: -3,
|
|
3138
|
+
...Z("arm", { spread: 60 }),
|
|
3139
|
+
"leg.left.swing": O(e, "leg.left.swing"),
|
|
3140
|
+
"leg.right.swing": O(e, "leg.right.swing"),
|
|
3141
|
+
"leg.left.knee": O(e, "leg.left.knee"),
|
|
3142
|
+
"leg.right.knee": O(e, "leg.right.knee")
|
|
3143
|
+
},
|
|
3144
|
+
easing: "ease-out"
|
|
3145
|
+
},
|
|
3146
|
+
{ after: 1260, pose: { stretch: O(e, "stretch"), bend: O(e, "bend"), ...ye("surprised"), ...Z("arm", { spread: 55, bend: 60 }) }, easing: "ease-in-out" }
|
|
3147
|
+
],
|
|
3148
|
+
/** Glance ahead, look away unbothered, then snap back in shock with a little hop. */
|
|
3149
|
+
doubleTake: (e) => [
|
|
3150
|
+
{ after: 160, pose: { lookX: 1, lookY: 0, "head.turn": 0 }, easing: "ease-out" },
|
|
3151
|
+
{ after: 520, pose: { lookX: -0.6, "head.turn": 30, "head.nod": O(e, "head.nod") - 4, smile: 0.6, mouth: 0 }, easing: "ease-in-out" },
|
|
3152
|
+
{ after: 1100, pose: { lookX: -0.6 } },
|
|
3153
|
+
{ after: 1180, pose: { "head.turn": 0, "head.nod": O(e, "head.nod") - 10, bend: O(e, "bend") - 10, lift: 0.05, stretch: 1.18, ...ye("shocked"), lookX: 1, lookY: 0 }, easing: "ease-out-cubic" },
|
|
3154
|
+
{ after: 1360, pose: { lift: 0, stretch: 0.88, "head.nod": O(e, "head.nod") - 4, bend: O(e, "bend") + 4 }, easing: "ease-in-quad" },
|
|
3155
|
+
{ after: 1560, pose: { stretch: O(e, "stretch"), "head.nod": O(e, "head.nod"), bend: O(e, "bend") }, easing: { type: "elastic", mode: "out", amplitude: 1, period: 0.35 } }
|
|
3156
|
+
],
|
|
3157
|
+
/** Rear back for a zip-off: lean back, a knee up, arms cocked; hold; pitch forward ready to run. */
|
|
3158
|
+
windUp: () => [
|
|
3159
|
+
{
|
|
3160
|
+
after: 220,
|
|
3161
|
+
pose: {
|
|
3162
|
+
lean: -18,
|
|
3163
|
+
bend: -16,
|
|
3164
|
+
"head.nod": -6,
|
|
3165
|
+
"arm.left.swing": 60,
|
|
3166
|
+
"arm.left.elbow": 100,
|
|
3167
|
+
"arm.right.swing": -40,
|
|
3168
|
+
"arm.right.elbow": 90,
|
|
3169
|
+
"leg.left.swing": 55,
|
|
3170
|
+
"leg.left.knee": 95,
|
|
3171
|
+
stretch: 0.92,
|
|
3172
|
+
...ye("angry"),
|
|
3173
|
+
lookX: 1
|
|
3174
|
+
},
|
|
3175
|
+
easing: "ease-out"
|
|
3176
|
+
},
|
|
3177
|
+
{ after: 620, pose: { lean: -20, bend: -18, stretch: 0.9 } },
|
|
3178
|
+
{ after: 700, pose: { lean: 28, bend: 14, "head.nod": 6, "arm.left.swing": -30, "arm.right.swing": 60, "leg.left.swing": -20, "leg.left.knee": 30, "leg.right.swing": 20, stretch: 1.12 }, easing: "ease-out-cubic" }
|
|
3179
|
+
],
|
|
3180
|
+
/** Coming down: stretched in the fall, squashed on contact, a spring back up. */
|
|
3181
|
+
land: (e) => [
|
|
3182
|
+
{ after: 120, pose: { lift: 0, stretch: 0.7, bend: 14, ...Z("arm", { spread: 75 }), ...Z("leg", { swing: 25, knee: 50 }) }, easing: "ease-in-quad" },
|
|
3183
|
+
{ after: 300, pose: { stretch: 1.05, bend: -4, "arm.left.spread": O(e, "arm.left.spread"), "arm.right.spread": O(e, "arm.right.spread") }, easing: "ease-out" },
|
|
3184
|
+
{ after: 460, pose: { lift: 0, stretch: O(e, "stretch"), bend: O(e, "bend"), ...Z("leg", { swing: 0, knee: 0 }) }, easing: "ease-in-out" }
|
|
3185
|
+
],
|
|
3186
|
+
/** A frightened shiver: paws up, fast small shakes side to side, then still. */
|
|
3187
|
+
tremble: (e) => {
|
|
3188
|
+
const t = [{ after: 80, pose: { ...ye("scared"), ...Z("arm", { swing: 40, elbow: 110, spread: 14 }), stretch: 0.94, bend: O(e, "bend") + 8 }, easing: "ease-out" }];
|
|
3189
|
+
for (let n = 1; n <= 14; n++) {
|
|
3190
|
+
const s = n % 2 === 0 ? 1 : -1;
|
|
3191
|
+
t.push({ after: 80 + n * 45, pose: { side: O(e, "side") + 2.5 * s, "head.tilt": O(e, "head.tilt") - 2 * s } });
|
|
3192
|
+
}
|
|
3193
|
+
return t.push({ after: 755, pose: { side: O(e, "side"), "head.tilt": O(e, "head.tilt"), bend: O(e, "bend") } }), t;
|
|
3194
|
+
},
|
|
3195
|
+
/** A sigh: the body sags, the back curls, the head and arms drop. */
|
|
3196
|
+
deflate: (e) => [
|
|
3197
|
+
{ after: 260, pose: { stretch: 1.04, "head.nod": O(e, "head.nod") - 4, "brow.left": 0.3, "brow.right": 0.3 }, easing: "ease-in-out" },
|
|
3198
|
+
{ after: 900, pose: { ...ye("sad"), bend: 18, stretch: 0.92, lean: O(e, "lean") + 5, "head.nod": 14, ...Z("arm", { spread: 6, swing: 0, elbow: 4, bend: 0 }) }, easing: "ease-in-out" }
|
|
3199
|
+
]
|
|
3200
|
+
};
|
|
3201
|
+
function sl(e, t) {
|
|
3202
|
+
const n = te(t.from ?? {}), s = t.speed ?? 1;
|
|
3203
|
+
let o = n;
|
|
3204
|
+
return [
|
|
3205
|
+
{ time: t.at, pose: n },
|
|
3206
|
+
...Xr[e](n).map((r) => (o = { ...o, ...r.pose }, { time: t.at + r.after * s, pose: o, act: !1, ...r.easing ? { easing: r.easing } : {} }))
|
|
3207
|
+
];
|
|
3208
|
+
}
|
|
3209
|
+
const qr = (e, t, n) => e.slice(Math.floor((e.length - 1) * t), Math.ceil((e.length - 1) * n) + 1);
|
|
3210
|
+
function rl(e = {}) {
|
|
3108
3211
|
const t = e.shirt ?? "#e2493b", n = e.trousers ?? "#24476b", s = (i) => i.lineWidth * 0.45, o = (i, a, h) => {
|
|
3109
3212
|
const c = i.parts[`leg.${h}`].points;
|
|
3110
|
-
a.shape(
|
|
3213
|
+
a.shape(qe(c, i.height * 0.08, i.height * 0.05), n, s(i));
|
|
3111
3214
|
}, r = (i, a) => {
|
|
3112
|
-
const h = i.chains.spine, c = h[0], u = h[h.length - 1],
|
|
3113
|
-
a.shape(
|
|
3215
|
+
const h = i.chains.spine, c = h[0], u = h[h.length - 1], d = { x: c.x - (u.x - c.x) * 0.25, y: c.y - (u.y - c.y) * 0.25 };
|
|
3216
|
+
a.shape(qe([d, ...i.parts.spine.points], i.height * 0.15, i.height * 0.14), t, s(i));
|
|
3114
3217
|
}, l = (i, a, h) => {
|
|
3115
|
-
const c = i.parts[`arm.${h}`].points, u = c[0],
|
|
3116
|
-
a.shape(
|
|
3117
|
-
const
|
|
3118
|
-
a.line(
|
|
3218
|
+
const c = i.parts[`arm.${h}`].points, u = c[0], d = i.chains.spine[i.chains.spine.length - 1], p = [{ x: u.x + (d.x - u.x) * 0.45, y: u.y + (d.y - u.y) * 0.45 }, ...qr(c, 0, 0.45)], g = qe(p, i.height * 0.085, i.height * 0.06), m = p.length, b = g.slice(0, m), S = g.slice(m).reverse();
|
|
3219
|
+
a.shape(g, t, 0);
|
|
3220
|
+
const k = (T) => Math.hypot(T[1].x - d.x, T[1].y - d.y), [v, H] = k(b) > k(S) ? [b, S] : [S, b];
|
|
3221
|
+
a.line(v.slice(1), s(i)), a.line(H.slice(Math.ceil(m * 0.45)), s(i)), a.line([b[m - 1], S[m - 1]], s(i));
|
|
3119
3222
|
};
|
|
3120
3223
|
return {
|
|
3121
3224
|
parts: {
|
|
@@ -3127,7 +3230,7 @@ function Di(e = {}) {
|
|
|
3127
3230
|
}
|
|
3128
3231
|
};
|
|
3129
3232
|
}
|
|
3130
|
-
const
|
|
3233
|
+
const dt = {
|
|
3131
3234
|
full: {
|
|
3132
3235
|
anticipation: 0.12,
|
|
3133
3236
|
anticipationTime: 0.3,
|
|
@@ -3189,123 +3292,123 @@ const ht = {
|
|
|
3189
3292
|
jumpSquash: 0
|
|
3190
3293
|
}
|
|
3191
3294
|
};
|
|
3192
|
-
function
|
|
3193
|
-
if (e === void 0) return
|
|
3194
|
-
if (typeof e == "string") return
|
|
3295
|
+
function Gr(e) {
|
|
3296
|
+
if (e === void 0) return dt.full;
|
|
3297
|
+
if (typeof e == "string") return dt[e];
|
|
3195
3298
|
const { base: t, ...n } = e;
|
|
3196
|
-
return { ...
|
|
3299
|
+
return { ...dt[t ?? "full"], ...n };
|
|
3197
3300
|
}
|
|
3198
|
-
const
|
|
3199
|
-
function
|
|
3200
|
-
const s =
|
|
3301
|
+
const At = 160, Ur = 120, zr = 700, gt = 60, Vr = 90, De = 3200, Me = 1, ge = 1e-6;
|
|
3302
|
+
function ro(e, t, n = {}) {
|
|
3303
|
+
const s = Gr(n.style), o = n.seed ?? 1, r = {};
|
|
3201
3304
|
if (e.length === 0) return r;
|
|
3202
|
-
const l = Object.keys(e[0].pose).filter((u) => e.some((
|
|
3203
|
-
for (const u of l) r[u] =
|
|
3305
|
+
const l = Object.keys(e[0].pose).filter((u) => e.some((d) => Math.abs(d.pose[u] - e[0].pose[u]) > ge));
|
|
3306
|
+
for (const u of l) r[u] = jr(u, e, t, s, o);
|
|
3204
3307
|
const i = t.blink, a = i !== void 0 && l.includes(i);
|
|
3205
3308
|
if (s.blinks && i !== void 0 && !a && i in e[0].pose) {
|
|
3206
|
-
const u =
|
|
3309
|
+
const u = Jr(e, t, s, o, e[0].pose[i]);
|
|
3207
3310
|
u.length > 0 && (r[i] = u);
|
|
3208
3311
|
}
|
|
3209
3312
|
const { lift: h, stretch: c } = t;
|
|
3210
3313
|
if (s.jumpSquash > 0 && h && c && l.includes(h) && !l.includes(c) && c in e[0].pose) {
|
|
3211
|
-
const u =
|
|
3314
|
+
const u = Zr(e, h, e[0].pose[c], s.jumpSquash);
|
|
3212
3315
|
u.length > 0 && (r[c] = u);
|
|
3213
3316
|
}
|
|
3214
3317
|
return r;
|
|
3215
3318
|
}
|
|
3216
|
-
function
|
|
3319
|
+
function jr(e, t, n, s, o) {
|
|
3217
3320
|
const r = n.eyes.includes(e), l = n.limits[e], i = l !== void 0, a = r ? -s.eyeLead : (n.depth[e] ?? 1) * s.overlap, h = (f) => {
|
|
3218
3321
|
const p = (t[f].time - t[f - 1].time) / 2;
|
|
3219
3322
|
return Math.max(-p, Math.min(p, a));
|
|
3220
|
-
}, c = [{ time: t[0].time, value: t[0].pose[e] }], u = (f, p,
|
|
3323
|
+
}, c = [{ time: t[0].time, value: t[0].pose[e] }], u = (f, p, g) => {
|
|
3221
3324
|
const m = c[c.length - 1];
|
|
3222
|
-
if (f <= m.time +
|
|
3223
|
-
c[c.length - 1] = { ...m, value: p, ...
|
|
3325
|
+
if (f <= m.time + Me) {
|
|
3326
|
+
c[c.length - 1] = { ...m, value: p, ...g ? { easing: g } : {} };
|
|
3224
3327
|
return;
|
|
3225
3328
|
}
|
|
3226
|
-
c.push({ time: f, value: p, ...
|
|
3329
|
+
c.push({ time: f, value: p, ...g ? { easing: g } : {} });
|
|
3227
3330
|
};
|
|
3228
|
-
let
|
|
3331
|
+
let d = t[0].pose[e];
|
|
3229
3332
|
for (let f = 1; f < t.length; f++) {
|
|
3230
|
-
const p = t[f],
|
|
3231
|
-
if (Math.abs(b) <=
|
|
3232
|
-
const
|
|
3333
|
+
const p = t[f], g = t[f - 1].pose[e], m = p.pose[e], b = m - g, S = c[c.length - 1].time, k = p.act !== !1;
|
|
3334
|
+
if (Math.abs(b) <= ge) {
|
|
3335
|
+
const x = p.time + (k ? h(f) : 0);
|
|
3233
3336
|
if (f === t.length - 1)
|
|
3234
|
-
Math.abs(
|
|
3235
|
-
else if (
|
|
3236
|
-
const
|
|
3237
|
-
|
|
3337
|
+
Math.abs(d - m) > ge && u(Math.max(x, S + At), m, "ease-in-out"), d = m;
|
|
3338
|
+
else if (k && i && s.drift > 0 && n.drift.includes(e) && x - S >= zr) {
|
|
3339
|
+
const E = tt(`${o}:${e}:${f}`) % 2 === 0 ? 1 : -1;
|
|
3340
|
+
d = m + E * s.drift * l, u(x, d, "ease-in-out");
|
|
3238
3341
|
}
|
|
3239
3342
|
continue;
|
|
3240
3343
|
}
|
|
3241
|
-
if (!
|
|
3242
|
-
u(t[f - 1].time,
|
|
3344
|
+
if (!k) {
|
|
3345
|
+
u(t[f - 1].time, d), u(p.time, m, p.easing), d = m;
|
|
3243
3346
|
continue;
|
|
3244
3347
|
}
|
|
3245
|
-
const
|
|
3246
|
-
let
|
|
3247
|
-
r && s.eyeDart > 0 && (
|
|
3248
|
-
const
|
|
3249
|
-
if (
|
|
3250
|
-
u(p.time, m, p.easing),
|
|
3348
|
+
const v = h(f), H = Math.max(t[f - 1].time + v, S);
|
|
3349
|
+
let T = p.time + v;
|
|
3350
|
+
r && s.eyeDart > 0 && (T = Math.min(T, H + s.eyeDart));
|
|
3351
|
+
const M = T - H;
|
|
3352
|
+
if (M <= Me) {
|
|
3353
|
+
u(p.time, m, p.easing), d = m;
|
|
3251
3354
|
continue;
|
|
3252
3355
|
}
|
|
3253
|
-
u(
|
|
3254
|
-
const
|
|
3255
|
-
if (i && s.anticipation > 0 && l > 0 &&
|
|
3256
|
-
const
|
|
3257
|
-
u(
|
|
3356
|
+
u(H, d);
|
|
3357
|
+
const w = Math.sign(b);
|
|
3358
|
+
if (i && s.anticipation > 0 && l > 0 && M >= At) {
|
|
3359
|
+
const x = d - w * Math.min(Math.abs(b) * s.anticipation, l), E = H + M * s.anticipationTime;
|
|
3360
|
+
u(E, x, "ease-in-out"), s.hold > 0 && u(E + M * s.hold, x);
|
|
3258
3361
|
}
|
|
3259
|
-
const
|
|
3260
|
-
if (i && s.overshoot > 0 && l > 0 &&
|
|
3261
|
-
const
|
|
3262
|
-
u(
|
|
3362
|
+
const y = f + 1 < t.length ? t[f + 1].time - p.time : 1 / 0, A = Math.min(s.settle, y / 2);
|
|
3363
|
+
if (i && s.overshoot > 0 && l > 0 && M >= Ur && A > Me) {
|
|
3364
|
+
const x = Math.min(Math.abs(b) * s.overshoot, l);
|
|
3365
|
+
u(T, m + w * x, p.easing ?? s.actionEase), u(T + A, m, s.settleEase);
|
|
3263
3366
|
} else
|
|
3264
|
-
u(
|
|
3265
|
-
|
|
3367
|
+
u(T, m, p.easing ?? s.actionEase);
|
|
3368
|
+
d = m;
|
|
3266
3369
|
}
|
|
3267
3370
|
return c;
|
|
3268
3371
|
}
|
|
3269
|
-
function
|
|
3270
|
-
const r = [], l =
|
|
3372
|
+
function Jr(e, t, n, s, o) {
|
|
3373
|
+
const r = [], l = gt + Vr;
|
|
3271
3374
|
for (let f = 1; f < e.length; f++) {
|
|
3272
|
-
const p = e[f - 1].pose,
|
|
3273
|
-
Object.entries(t.headTurns).some(([b,
|
|
3375
|
+
const p = e[f - 1].pose, g = e[f].pose;
|
|
3376
|
+
Object.entries(t.headTurns).some(([b, S]) => Math.abs((g[b] ?? 0) - (p[b] ?? 0)) > S) && e[f].act !== !1 && r.push(Math.max(e[0].time, e[f - 1].time - n.eyeLead));
|
|
3274
3377
|
}
|
|
3275
3378
|
const i = e[0].time, a = e[e.length - 1].time, h = [...r];
|
|
3276
|
-
let c = i +
|
|
3379
|
+
let c = i + De * 0.6, u = 0;
|
|
3277
3380
|
for (; c < a; ) {
|
|
3278
|
-
h.some((
|
|
3279
|
-
const p = (
|
|
3280
|
-
c +=
|
|
3381
|
+
h.some((g) => Math.abs(g - c) < De / 2) || r.push(c);
|
|
3382
|
+
const p = (tt(`${s}:blink:${u++}`) % 1e3 / 1e3 - 0.5) * (De * 0.66);
|
|
3383
|
+
c += De + p;
|
|
3281
3384
|
}
|
|
3282
3385
|
r.sort((f, p) => f - p);
|
|
3283
|
-
const
|
|
3386
|
+
const d = [{ time: i, value: o }];
|
|
3284
3387
|
for (const f of r) {
|
|
3285
|
-
const p =
|
|
3286
|
-
f +
|
|
3388
|
+
const p = d[d.length - 1].time;
|
|
3389
|
+
f + gt <= p + Me || (f > p + Me && d.push({ time: f, value: o }), d.push({ time: f + gt, value: 1, easing: "ease-in" }), d.push({ time: f + l, value: o, easing: "ease-out" }));
|
|
3287
3390
|
}
|
|
3288
|
-
return
|
|
3391
|
+
return d.length > 1 ? d : [];
|
|
3289
3392
|
}
|
|
3290
|
-
function
|
|
3393
|
+
function Zr(e, t, n, s) {
|
|
3291
3394
|
const o = n * (1 - 0.18 * s), r = n * (1 + 0.14 * s), l = [{ time: e[0].time, value: n }], i = (a, h, c) => {
|
|
3292
3395
|
const u = l[l.length - 1];
|
|
3293
|
-
a <= u.time +
|
|
3396
|
+
a <= u.time + Me || l.push({ time: a, value: h, ...c ? { easing: c } : {} });
|
|
3294
3397
|
};
|
|
3295
3398
|
for (let a = 1; a < e.length; a++) {
|
|
3296
|
-
const h = e[a - 1].pose[t], c = e[a].pose[t], u = e[a - 1].time,
|
|
3297
|
-
if (!(f <
|
|
3298
|
-
if (h <=
|
|
3299
|
-
i(u, n), i(u + f * 0.2, o, "ease-out"), i(u + f * 0.45, r, "ease-out"), i(
|
|
3300
|
-
else if (h >
|
|
3301
|
-
const p = a + 1 < e.length ? e[a + 1].time -
|
|
3302
|
-
i(u + f * 0.5, n), i(
|
|
3399
|
+
const h = e[a - 1].pose[t], c = e[a].pose[t], u = e[a - 1].time, d = e[a].time, f = d - u;
|
|
3400
|
+
if (!(f < At || e[a].act === !1)) {
|
|
3401
|
+
if (h <= ge && c > ge)
|
|
3402
|
+
i(u, n), i(u + f * 0.2, o, "ease-out"), i(u + f * 0.45, r, "ease-out"), i(d, n, "ease-in-out");
|
|
3403
|
+
else if (h > ge && c <= ge) {
|
|
3404
|
+
const p = a + 1 < e.length ? e[a + 1].time - d : 400;
|
|
3405
|
+
i(u + f * 0.5, n), i(d - Math.min(60, f * 0.15), r, "ease-in"), i(d, o, "ease-out"), i(d + Math.min(260, p / 2), n, { type: "back", mode: "out", overshoot: 1.4 });
|
|
3303
3406
|
}
|
|
3304
3407
|
}
|
|
3305
3408
|
}
|
|
3306
3409
|
return l.length > 1 ? l : [];
|
|
3307
3410
|
}
|
|
3308
|
-
const
|
|
3411
|
+
const Qr = {
|
|
3309
3412
|
depth: {
|
|
3310
3413
|
lean: 0,
|
|
3311
3414
|
bend: 0,
|
|
@@ -3371,13 +3474,13 @@ const Lr = {
|
|
|
3371
3474
|
lift: "rise",
|
|
3372
3475
|
stretch: "stretch"
|
|
3373
3476
|
};
|
|
3374
|
-
function
|
|
3375
|
-
return /^(turn|lean|side|lift|roll|stretch)$/.test(e) ? { depth: 0, limit: { turn: 0.06, lean: 10, side: 8, lift: 0, roll: 25, stretch: 0.08 }[e] } : /^leg\.\w+\.(swing|spread|rotate)$/.test(e) ? { depth: 0, limit: 12 } : /^head\./.test(e) ? { depth: 1, limit: 12 } : /^arm\.\w+\.(swing|spread)$/.test(e) ? { depth: 1, limit: 20 } : /^leg\.\w+\.knee$/.test(e) ? { depth: 1, limit: 15 } : /^(brow\.|browTilt$)/.test(e) ? { depth: 1, limit: e === "browTilt" ? void 0 : 0.25 } : /^eye\./.test(e) ? { depth: 1, limit: 0.15 } : /^arm\.\w+\.(elbow|bend)$/.test(e) ? { depth: 2, limit: 18 } : /^leg\.\w+\.(ankle|toeOut)$/.test(e) ? { depth: 2, limit: 10 } : /^(mouth|smile|mouthWidth)$/.test(e) ? { depth: 2 } : /^hand\./.test(e) ? { depth: 3 } : { depth: 1 };
|
|
3477
|
+
function ei(e) {
|
|
3478
|
+
return /^(turn|lean|bend|side|lift|roll|stretch)$/.test(e) ? { depth: 0, limit: { turn: 0.06, lean: 10, bend: 10, side: 8, lift: 0, roll: 25, stretch: 0.08 }[e] } : /^leg\.\w+\.(swing|spread|rotate)$/.test(e) ? { depth: 0, limit: 12 } : /^head\./.test(e) ? { depth: 1, limit: 12 } : /^arm\.\w+\.(swing|spread)$/.test(e) ? { depth: 1, limit: 20 } : /^leg\.\w+\.knee$/.test(e) ? { depth: 1, limit: 15 } : /^(brow\.|browTilt$)/.test(e) ? { depth: 1, limit: e === "browTilt" ? void 0 : 0.25 } : /^eye\./.test(e) ? { depth: 1, limit: 0.15 } : /^arm\.\w+\.(elbow|bend)$/.test(e) ? { depth: 2, limit: 18 } : /^leg\.\w+\.(ankle|toeOut)$/.test(e) ? { depth: 2, limit: 10 } : /^(mouth|smile|mouthWidth)$/.test(e) ? { depth: 2 } : /^hand\./.test(e) ? { depth: 3 } : { depth: 1 };
|
|
3376
3479
|
}
|
|
3377
|
-
function
|
|
3480
|
+
function ti() {
|
|
3378
3481
|
const e = {}, t = {};
|
|
3379
|
-
for (const n of Object.keys(
|
|
3380
|
-
const s =
|
|
3482
|
+
for (const n of Object.keys(C)) {
|
|
3483
|
+
const s = ei(n);
|
|
3381
3484
|
e[n] = s.depth, s.limit !== void 0 && (t[n] = s.limit);
|
|
3382
3485
|
}
|
|
3383
3486
|
return {
|
|
@@ -3386,46 +3489,46 @@ function Yr() {
|
|
|
3386
3489
|
eyes: ["lookX", "lookY"],
|
|
3387
3490
|
blink: "blink",
|
|
3388
3491
|
headTurns: { turn: 0.15, "head.turn": 15, "head.nod": 12, lookX: 0.5, roll: 45 },
|
|
3389
|
-
drift: ["lean", "head.tilt", "head.nod", "arm.left.spread", "arm.right.spread", "arm.left.elbow", "arm.right.elbow"],
|
|
3492
|
+
drift: ["lean", "bend", "head.tilt", "head.nod", "arm.left.spread", "arm.right.spread", "arm.left.elbow", "arm.right.elbow"],
|
|
3390
3493
|
lift: "lift",
|
|
3391
3494
|
stretch: "stretch"
|
|
3392
3495
|
};
|
|
3393
3496
|
}
|
|
3394
|
-
const
|
|
3395
|
-
function
|
|
3497
|
+
const ni = ti();
|
|
3498
|
+
function io(e, t) {
|
|
3396
3499
|
return Object.entries(t).map(([n, s]) => ({ id: `${e}-${n}`, target: e, property: n, keyframes: s }));
|
|
3397
3500
|
}
|
|
3398
|
-
function
|
|
3399
|
-
const s =
|
|
3400
|
-
return
|
|
3501
|
+
function oi(e, t, n = {}) {
|
|
3502
|
+
const s = Cn(t), o = t.map((r, l) => ({ time: r.time, pose: { ...s[l] }, easing: r.easing, act: r.act }));
|
|
3503
|
+
return io(e, ro(o, n.rig ?? Qr, n));
|
|
3401
3504
|
}
|
|
3402
|
-
function
|
|
3403
|
-
const s = n.rest ??
|
|
3404
|
-
return
|
|
3505
|
+
function il(e, t, n = {}) {
|
|
3506
|
+
const s = n.rest ?? C, o = Qn(t, s), r = t.map((l, i) => ({ time: l.time, pose: { ...s, ...o[i] }, easing: l.easing, act: l.act }));
|
|
3507
|
+
return io(e, ro(r, n.rig ?? ni, n));
|
|
3405
3508
|
}
|
|
3406
|
-
const
|
|
3509
|
+
const fn = X.shocked, si = X.scared, Lt = {
|
|
3407
3510
|
/** The classic take: squash down in a squint, then shoot up stretched with eyes popping, hang, and land squashed. */
|
|
3408
3511
|
take: (e) => [
|
|
3409
3512
|
{ after: 140, pose: { stretch: 0.8, bend: 10, lean: e.lean - 4, leftShoulder: 8, rightShoulder: 8, leftEye: 0.35, rightEye: 0.35, leftBrow: -0.6, rightBrow: -0.6, mouth: 0 }, easing: "ease-in-out" },
|
|
3410
3513
|
{ after: 260, pose: { stretch: 0.78 } },
|
|
3411
|
-
{ after: 360, pose: { rise: 0.22, stretch: 1.35, bend: -14, leftShoulder: 150, rightShoulder: 150, leftElbow: 35, rightElbow: 35, leftHip: 22, rightHip: 22, leftKnee: 45, rightKnee: 45, ...
|
|
3514
|
+
{ after: 360, pose: { rise: 0.22, stretch: 1.35, bend: -14, leftShoulder: 150, rightShoulder: 150, leftElbow: 35, rightElbow: 35, leftHip: 22, rightHip: 22, leftKnee: 45, rightKnee: 45, ...fn, headTilt: 0 }, easing: "ease-out-cubic" },
|
|
3412
3515
|
{ after: 720, pose: { rise: 0.25, stretch: 1.25, bend: -10, leftShoulder: 140, rightShoulder: 140 }, easing: "ease-in-out" },
|
|
3413
3516
|
{ after: 900, pose: { rise: 0, stretch: 0.74, bend: 12, leftShoulder: 70, rightShoulder: 70, leftHip: 18, rightHip: 18, leftKnee: 30, rightKnee: 30 }, easing: "ease-in-quad" },
|
|
3414
3517
|
{ after: 1060, pose: { stretch: 1.06, bend: -3, leftShoulder: 60, rightShoulder: 60, leftHip: e.leftHip, rightHip: e.rightHip, leftKnee: e.leftKnee, rightKnee: e.rightKnee }, easing: "ease-out" },
|
|
3415
|
-
{ after: 1260, pose: { stretch: e.stretch, bend: e.bend, ...
|
|
3518
|
+
{ after: 1260, pose: { stretch: e.stretch, bend: e.bend, ...X.surprised, leftShoulder: 70, rightShoulder: 70, leftElbow: 60, rightElbow: 60 }, easing: "ease-in-out" }
|
|
3416
3519
|
],
|
|
3417
3520
|
/** Glance at something, look away unbothered, then snap back to it in shock. */
|
|
3418
3521
|
doubleTake: (e) => [
|
|
3419
3522
|
{ after: 160, pose: { lookX: 1, lookY: 0 }, easing: "ease-out" },
|
|
3420
3523
|
{ after: 520, pose: { lookX: -0.6, headTilt: e.headTilt - 4, smile: 0.6, mouth: 0 }, easing: "ease-in-out" },
|
|
3421
3524
|
{ after: 1100, pose: { lookX: -0.6 } },
|
|
3422
|
-
{ after: 1180, pose: { bend: e.bend - 10, headTilt: e.headTilt + 10, rise: 0.05, stretch: 1.18, ...
|
|
3525
|
+
{ after: 1180, pose: { bend: e.bend - 10, headTilt: e.headTilt + 10, rise: 0.05, stretch: 1.18, ...fn, lookX: 1, lookY: 0 }, easing: "ease-out-cubic" },
|
|
3423
3526
|
{ after: 1360, pose: { rise: 0, stretch: 0.88, bend: e.bend + 4, headTilt: e.headTilt + 4 }, easing: "ease-in-quad" },
|
|
3424
3527
|
{ after: 1560, pose: { stretch: e.stretch, bend: e.bend, headTilt: e.headTilt }, easing: { type: "elastic", mode: "out", amplitude: 1, period: 0.35 } }
|
|
3425
3528
|
],
|
|
3426
3529
|
/** Rear back for a zip-off: lean back, one knee up, arms cocked, hold, then pitch forward ready to run. */
|
|
3427
3530
|
windUp: () => [
|
|
3428
|
-
{ after: 220, pose: { lean: -18, bend: -16, headTilt: -6, leftShoulder: 70, leftElbow: -100, rightShoulder: 40, rightElbow: 100, leftHip: -45, leftKnee: -80, stretch: 0.92, ...
|
|
3531
|
+
{ after: 220, pose: { lean: -18, bend: -16, headTilt: -6, leftShoulder: 70, leftElbow: -100, rightShoulder: 40, rightElbow: 100, leftHip: -45, leftKnee: -80, stretch: 0.92, ...X.angry, lookX: 1 }, easing: "ease-out" },
|
|
3429
3532
|
{ after: 620, pose: { lean: -20, bend: -18, stretch: 0.9 } },
|
|
3430
3533
|
{ after: 700, pose: { lean: 28, bend: 14, headTilt: 6, leftShoulder: 30, rightShoulder: 60, leftHip: 30, leftKnee: -30, rightHip: -20, stretch: 1.12 }, easing: "ease-out-cubic" }
|
|
3431
3534
|
],
|
|
@@ -3433,47 +3536,47 @@ const rn = Y.shocked, Xr = Y.scared, Bt = {
|
|
|
3433
3536
|
land: (e) => [
|
|
3434
3537
|
{ after: 120, pose: { rise: 0, stretch: 0.7, bend: 14, leftShoulder: 75, rightShoulder: 75, leftHip: 20, rightHip: 20, leftKnee: 35, rightKnee: 35 }, easing: "ease-in-quad" },
|
|
3435
3538
|
{ after: 300, pose: { stretch: 1.05, bend: -4, leftShoulder: e.leftShoulder, rightShoulder: e.rightShoulder }, easing: "ease-out" },
|
|
3436
|
-
{ after: 460, pose: { rise: 0, stretch: e.stretch, bend: e.bend, leftHip:
|
|
3539
|
+
{ after: 460, pose: { rise: 0, stretch: e.stretch, bend: e.bend, leftHip: B.leftHip, rightHip: B.rightHip, leftKnee: 0, rightKnee: 0 }, easing: "ease-in-out" }
|
|
3437
3540
|
],
|
|
3438
3541
|
/** A frightened shiver: small, fast shakes with wide eyes, then still. */
|
|
3439
3542
|
tremble: (e) => {
|
|
3440
|
-
const t = [{ after: 80, pose: { ...
|
|
3543
|
+
const t = [{ after: 80, pose: { ...si, bend: e.bend + 8, leftShoulder: 40, rightShoulder: 40, leftElbow: 110, rightElbow: 110, stretch: 0.94 }, easing: "ease-out" }];
|
|
3441
3544
|
for (let n = 1; n <= 14; n++) t.push({ after: 80 + n * 45, pose: { lean: e.lean + (n % 2 === 0 ? 2.5 : -2.5), headTilt: e.headTilt + (n % 2 === 0 ? -2 : 2) } });
|
|
3442
3545
|
return t.push({ after: 755, pose: { lean: e.lean, headTilt: e.headTilt, bend: e.bend } }), t;
|
|
3443
3546
|
},
|
|
3444
3547
|
/** A sigh: the body sags, shoulders drop, head and eyes go down. */
|
|
3445
3548
|
deflate: (e) => [
|
|
3446
3549
|
{ after: 260, pose: { stretch: 1.04, headTilt: e.headTilt + 4, leftBrow: 0.3, rightBrow: 0.3 }, easing: "ease-in-out" },
|
|
3447
|
-
{ after: 900, pose: { ...
|
|
3550
|
+
{ after: 900, pose: { ...Be.sad, bend: 18, stretch: 0.92, lean: e.lean + 5, turn: e.turn, sit: e.sit }, easing: "ease-in-out" }
|
|
3448
3551
|
]
|
|
3449
3552
|
};
|
|
3450
|
-
function
|
|
3451
|
-
const n = typeof t.from == "string" ?
|
|
3553
|
+
function un(e, t) {
|
|
3554
|
+
const n = typeof t.from == "string" ? Be[t.from] : t.from ?? B, s = t.speed ?? 1;
|
|
3452
3555
|
let o = n;
|
|
3453
3556
|
return [
|
|
3454
3557
|
// The move onto the starting pose is acted like any other; the gag itself is not.
|
|
3455
3558
|
{ time: t.at, pose: n },
|
|
3456
|
-
...
|
|
3559
|
+
...Lt[e](n).map((r) => (o = { ...o, ...r.pose }, { time: t.at + r.after * s, pose: o, act: !1, ...r.easing ? { easing: r.easing } : {} }))
|
|
3457
3560
|
];
|
|
3458
3561
|
}
|
|
3459
|
-
function
|
|
3460
|
-
const n =
|
|
3562
|
+
function dn(e, t = 1) {
|
|
3563
|
+
const n = Lt[e](B);
|
|
3461
3564
|
return n[n.length - 1].after * t;
|
|
3462
3565
|
}
|
|
3463
|
-
function
|
|
3566
|
+
function ri(e, t, n = {}) {
|
|
3464
3567
|
if (t.length < 2) return;
|
|
3465
3568
|
const s = Math.max(1, Math.round(n.lines ?? 3)), o = n.spacing ?? 5, r = n.lineWidth ?? 2, l = n.opacity ?? 0.7;
|
|
3466
3569
|
e.save(), e.strokeStyle = n.color ?? "#222", e.lineCap = "round";
|
|
3467
3570
|
for (let i = 0; i < s; i++) {
|
|
3468
3571
|
const a = (i - (s - 1) / 2) * o, h = Math.floor(Math.abs(a) / Math.max(o, 1) * (t.length / 6));
|
|
3469
3572
|
for (let c = h + 1; c < t.length; c++) {
|
|
3470
|
-
const u = t[c - 1],
|
|
3471
|
-
e.globalAlpha = l * (1 -
|
|
3573
|
+
const u = t[c - 1], d = t[c], f = d.x - u.x, p = d.y - u.y, g = Math.hypot(f, p) || 1, m = -p / g, b = f / g, S = 1 - c / (t.length - 1);
|
|
3574
|
+
e.globalAlpha = l * (1 - S), e.lineWidth = r * (1 - S * 0.7), e.beginPath(), e.moveTo(u.x + m * a, u.y + b * a), e.lineTo(d.x + m * a, d.y + b * a), e.stroke();
|
|
3472
3575
|
}
|
|
3473
3576
|
}
|
|
3474
3577
|
e.restore();
|
|
3475
3578
|
}
|
|
3476
|
-
const
|
|
3579
|
+
const ii = {
|
|
3477
3580
|
hands: [
|
|
3478
3581
|
{ name: "left hand", at: (e) => e.hands.left },
|
|
3479
3582
|
{ name: "right hand", at: (e) => e.hands.right }
|
|
@@ -3488,7 +3591,7 @@ const zr = {
|
|
|
3488
3591
|
{ name: "neck", at: (e) => e.neck }
|
|
3489
3592
|
]
|
|
3490
3593
|
};
|
|
3491
|
-
function
|
|
3594
|
+
function ll(e, t, n, s, o = {}) {
|
|
3492
3595
|
const r = n.stateAt;
|
|
3493
3596
|
if (!r) return;
|
|
3494
3597
|
const l = o.length ?? 120, i = Math.max(2, Math.round(o.samples ?? 8)), a = Math.max(0, n.time - l);
|
|
@@ -3496,40 +3599,40 @@ function qi(e, t, n, s, o = {}) {
|
|
|
3496
3599
|
const h = [];
|
|
3497
3600
|
for (let f = 0; f < i; f++) {
|
|
3498
3601
|
const p = a + (n.time - a) * f / (i - 1);
|
|
3499
|
-
h.push(
|
|
3602
|
+
h.push(Ss(t, { time: p, state: r(p) }, s).joints);
|
|
3500
3603
|
}
|
|
3501
|
-
const c = h[h.length - 1].height, u = (o.threshold ?? 1.2) * c,
|
|
3502
|
-
for (const f of
|
|
3604
|
+
const c = h[h.length - 1].height, u = (o.threshold ?? 1.2) * c, d = (o.parts ?? ["hands", "toes", "head"]).flatMap((f) => ii[f]);
|
|
3605
|
+
for (const f of d) {
|
|
3503
3606
|
const p = h.map(f.at);
|
|
3504
|
-
let
|
|
3505
|
-
for (let
|
|
3506
|
-
const m =
|
|
3607
|
+
let g = 0;
|
|
3608
|
+
for (let S = 1; S < p.length; S++) g += Math.hypot(p[S].x - p[S - 1].x, p[S].y - p[S - 1].y);
|
|
3609
|
+
const m = g / ((n.time - a) / 1e3);
|
|
3507
3610
|
if (m <= u) continue;
|
|
3508
3611
|
const b = Math.min(1, (m - u) / (u * 0.5));
|
|
3509
|
-
|
|
3612
|
+
ri(e, p, { ...o, opacity: (o.opacity ?? 0.7) * b, spacing: o.spacing ?? c * 0.02 });
|
|
3510
3613
|
}
|
|
3511
3614
|
}
|
|
3512
|
-
function
|
|
3615
|
+
function al(e, t, n, s = {}) {
|
|
3513
3616
|
if (n <= 0 || n >= 1) return;
|
|
3514
3617
|
const o = s.size ?? 40, r = s.seed ?? 1, l = 0.45 + 0.55 * (1 - (1 - n) ** 3);
|
|
3515
3618
|
e.save(), e.strokeStyle = s.color ?? "#555", e.lineWidth = Math.max(1, o * 0.03), e.globalAlpha = Math.min(1, n / 0.08) * (1 - n);
|
|
3516
3619
|
for (let i = 0; i < 5; i++) {
|
|
3517
|
-
const a =
|
|
3518
|
-
e.beginPath(), e.arc(c, u,
|
|
3620
|
+
const a = tt(`${r}:puff:${i}`) % 1e3 / 1e3, h = i - 2, c = t.x + h * o * 0.3 * l, u = t.y - o * (0.06 + 0.12 * a) * l + Math.abs(h) * o * 0.03, d = o * (0.11 + 0.07 * a) * l;
|
|
3621
|
+
e.beginPath(), e.arc(c, u, d, Math.PI * 0.95, Math.PI * 2.05), e.stroke();
|
|
3519
3622
|
}
|
|
3520
3623
|
e.restore();
|
|
3521
3624
|
}
|
|
3522
|
-
function
|
|
3625
|
+
function hl(e, t, n, s = {}) {
|
|
3523
3626
|
if (n <= 0 || n >= 1) return;
|
|
3524
3627
|
const o = s.size ?? 40, r = 5, l = 1 - (1 - n) ** 2;
|
|
3525
3628
|
e.save(), e.strokeStyle = s.color ?? "#222", e.lineWidth = Math.max(1, o * 0.035), e.lineJoin = "round", e.globalAlpha = n < 0.7 ? 1 : (1 - n) / 0.3;
|
|
3526
3629
|
for (let i = 0; i < r; i++) {
|
|
3527
3630
|
const a = -Math.PI / 2 + (i - (r - 1) / 2) * Math.PI / (r + 1), h = o * (0.3 + 0.7 * l), c = t.x + Math.cos(a) * h, u = t.y + Math.sin(a) * h;
|
|
3528
|
-
|
|
3631
|
+
li(e, c, u, o * 0.14, n * Math.PI + i), e.stroke();
|
|
3529
3632
|
}
|
|
3530
3633
|
e.restore();
|
|
3531
3634
|
}
|
|
3532
|
-
function
|
|
3635
|
+
function li(e, t, n, s, o) {
|
|
3533
3636
|
e.beginPath();
|
|
3534
3637
|
for (let r = 0; r < 10; r++) {
|
|
3535
3638
|
const l = r % 2 === 0 ? s : s * 0.45, i = o + r * Math.PI / 5 - Math.PI / 2, a = t + Math.cos(i) * l, h = n + Math.sin(i) * l;
|
|
@@ -3537,7 +3640,7 @@ function Vr(e, t, n, s, o) {
|
|
|
3537
3640
|
}
|
|
3538
3641
|
e.closePath();
|
|
3539
3642
|
}
|
|
3540
|
-
const
|
|
3643
|
+
const ue = {
|
|
3541
3644
|
/** Closed and relaxed */
|
|
3542
3645
|
rest: { mouth: 0, mouthWidth: 1 },
|
|
3543
3646
|
/** "ah": open wide */
|
|
@@ -3558,7 +3661,7 @@ const ce = {
|
|
|
3558
3661
|
l: { mouth: 0.3, mouthWidth: 1 },
|
|
3559
3662
|
/** Other consonants: slightly open */
|
|
3560
3663
|
c: { mouth: 0.2, mouthWidth: 1 }
|
|
3561
|
-
},
|
|
3664
|
+
}, Ae = 1, Xe = 0.55, gn = 0.35, ai = 1.6, pn = { a: "a", e: "e", i: "i", y: "i", o: "o", u: "u" }, mn = { m: "m", b: "m", p: "m", f: "f", v: "f", w: "u", q: "u", l: "l", n: "l", d: "l", t: "l" }, bn = {
|
|
3562
3665
|
अ: "a",
|
|
3563
3666
|
आ: "a",
|
|
3564
3667
|
इ: "i",
|
|
@@ -3572,7 +3675,7 @@ const ce = {
|
|
|
3572
3675
|
औ: "o",
|
|
3573
3676
|
ऍ: "e",
|
|
3574
3677
|
ऑ: "o"
|
|
3575
|
-
},
|
|
3678
|
+
}, wn = {
|
|
3576
3679
|
"ा": "a",
|
|
3577
3680
|
"ि": "i",
|
|
3578
3681
|
"ी": "i",
|
|
@@ -3585,78 +3688,78 @@ const ce = {
|
|
|
3585
3688
|
"ौ": "o",
|
|
3586
3689
|
"ॅ": "e",
|
|
3587
3690
|
"ॉ": "o"
|
|
3588
|
-
},
|
|
3589
|
-
function
|
|
3691
|
+
}, hi = { प: "m", फ: "m", ब: "m", भ: "m", म: "m", व: "u" }, ci = "्", yn = "़", fi = (e) => e >= "क" && e <= "ह", kn = /* @__PURE__ */ new Set([".", ",", "!", "?", ";", ":", "…", "।", "॥", "—", "-"]);
|
|
3692
|
+
function ui(e) {
|
|
3590
3693
|
const t = [], n = Array.from(e.toLowerCase()), s = (o, r) => {
|
|
3591
3694
|
const l = t[t.length - 1];
|
|
3592
3695
|
l && l.viseme === o ? l.weight += r * 0.5 : t.push({ viseme: o, weight: r });
|
|
3593
3696
|
};
|
|
3594
3697
|
for (let o = 0; o < n.length; o++) {
|
|
3595
3698
|
const r = n[o], l = n[o + 1];
|
|
3596
|
-
if (
|
|
3699
|
+
if (kn.has(r)) s("rest", ai);
|
|
3597
3700
|
else if (/\s/.test(r)) {
|
|
3598
3701
|
const i = t[t.length - 1];
|
|
3599
|
-
i && i.viseme !== "rest" && t.push({ viseme: "c", weight:
|
|
3702
|
+
i && i.viseme !== "rest" && t.push({ viseme: "c", weight: gn });
|
|
3600
3703
|
} else if ((r === "o" || r === "e") && l === r)
|
|
3601
|
-
s(r === "o" ? "u" : "i",
|
|
3602
|
-
else if (r in
|
|
3603
|
-
else if (r in
|
|
3704
|
+
s(r === "o" ? "u" : "i", Ae), o++;
|
|
3705
|
+
else if (r in pn) s(pn[r], Ae);
|
|
3706
|
+
else if (r in mn) s(mn[r], Xe);
|
|
3604
3707
|
else {
|
|
3605
3708
|
if (r === "h") continue;
|
|
3606
|
-
if (/[a-z]/.test(r)) s("c",
|
|
3607
|
-
else if (r in
|
|
3608
|
-
else if (
|
|
3609
|
-
const i = l ===
|
|
3610
|
-
s(i ?? "c",
|
|
3709
|
+
if (/[a-z]/.test(r)) s("c", Xe);
|
|
3710
|
+
else if (r in bn) s(bn[r], Ae);
|
|
3711
|
+
else if (fi(r)) {
|
|
3712
|
+
const i = l === yn ? r === "फ" ? "f" : void 0 : hi[r];
|
|
3713
|
+
s(i ?? "c", Xe);
|
|
3611
3714
|
let a = o + 1;
|
|
3612
|
-
n[a] ===
|
|
3715
|
+
n[a] === yn && a++;
|
|
3613
3716
|
const h = n[a];
|
|
3614
|
-
h ===
|
|
3615
|
-
} else (r === "ं" || r === "ँ") && s("l",
|
|
3717
|
+
h === ci ? o = a : h && h in wn ? (s(wn[h], Ae), o = a) : (!h || /\s/.test(h) || kn.has(h) || s("a", Ae * 0.6), o = a - 1);
|
|
3718
|
+
} else (r === "ं" || r === "ँ") && s("l", Xe * 0.6);
|
|
3616
3719
|
}
|
|
3617
3720
|
}
|
|
3618
|
-
for (; t.length > 0 && (t[t.length - 1].viseme === "rest" || t[t.length - 1].weight ===
|
|
3721
|
+
for (; t.length > 0 && (t[t.length - 1].viseme === "rest" || t[t.length - 1].weight === gn); ) t.pop();
|
|
3619
3722
|
return t;
|
|
3620
3723
|
}
|
|
3621
|
-
function
|
|
3622
|
-
const n = t.fields?.mouth ?? "mouth", s = t.fields?.mouthWidth ?? "mouthWidth", o = t.energy ?? 1, r =
|
|
3724
|
+
function lo(e, t = {}) {
|
|
3725
|
+
const n = t.fields?.mouth ?? "mouth", s = t.fields?.mouthWidth ?? "mouthWidth", o = t.energy ?? 1, r = ui(e.text), l = [{ time: e.start, value: ue.rest.mouth }], i = [{ time: e.start, value: ue.rest.mouthWidth }], a = r.reduce((c, u) => c + u.weight, 0), h = e.end - e.start;
|
|
3623
3726
|
if (a > 0 && h > 0) {
|
|
3624
3727
|
let c = e.start;
|
|
3625
3728
|
for (const u of r) {
|
|
3626
|
-
const
|
|
3729
|
+
const d = h * u.weight / a, f = c + Math.min(d * 0.4, 60);
|
|
3627
3730
|
if (f > l[l.length - 1].time) {
|
|
3628
|
-
const p =
|
|
3731
|
+
const p = ue[u.viseme];
|
|
3629
3732
|
l.push({ time: f, value: p.mouth * o, easing: "ease-out" }), i.push({ time: f, value: 1 + (p.mouthWidth - 1) * Math.min(1.3, o), easing: "ease-out" });
|
|
3630
3733
|
}
|
|
3631
|
-
c +=
|
|
3734
|
+
c += d;
|
|
3632
3735
|
}
|
|
3633
3736
|
}
|
|
3634
|
-
return e.end > l[l.length - 1].time && (l.push({ time: e.end, value:
|
|
3737
|
+
return e.end > l[l.length - 1].time && (l.push({ time: e.end, value: ue.rest.mouth, easing: "ease-in-out" }), i.push({ time: e.end, value: ue.rest.mouthWidth, easing: "ease-in-out" })), { [n]: l, [s]: i };
|
|
3635
3738
|
}
|
|
3636
|
-
function
|
|
3739
|
+
function cl(e, t, n = {}) {
|
|
3637
3740
|
const s = {};
|
|
3638
3741
|
for (const o of [...t].sort((r, l) => r.start - l.start))
|
|
3639
|
-
for (const [r, l] of Object.entries(
|
|
3742
|
+
for (const [r, l] of Object.entries(lo(o, n))) {
|
|
3640
3743
|
const i = s[r] ??= [], a = i.length > 0 ? i[i.length - 1].time : -1 / 0;
|
|
3641
3744
|
i.push(...l.filter((h) => h.time > a));
|
|
3642
3745
|
}
|
|
3643
3746
|
return Object.entries(s).map(([o, r]) => ({ id: `${e}-${o}`, target: e, property: o, keyframes: r }));
|
|
3644
3747
|
}
|
|
3645
|
-
function
|
|
3748
|
+
function di(e, t, n, s = {}) {
|
|
3646
3749
|
if (n.length === 0) return t;
|
|
3647
|
-
const o = s.fields?.mouth ?? "mouth", r = s.fields?.mouthWidth ?? "mouthWidth", l = { [o]:
|
|
3750
|
+
const o = s.fields?.mouth ?? "mouth", r = s.fields?.mouthWidth ?? "mouthWidth", l = { [o]: ue.rest.mouth, [r]: ue.rest.mouthWidth, ...s.rest }, i = new fo({ id: "before-speech", tracks: t }), a = (u, d) => i.getStateAtTime(d).values.get(e)?.get(u) ?? l[u], h = [o, r], c = t.filter((u) => u.target !== e || !h.includes(u.property));
|
|
3648
3751
|
for (const u of h) {
|
|
3649
|
-
const
|
|
3650
|
-
let f =
|
|
3752
|
+
const d = t.find((p) => p.target === e && p.property === u);
|
|
3753
|
+
let f = d ? [...d.keyframes] : [{ time: 0, value: a(u, 0) }];
|
|
3651
3754
|
for (const p of n) {
|
|
3652
|
-
const
|
|
3653
|
-
|
|
3755
|
+
const g = lo(p, s)[u];
|
|
3756
|
+
g[0] = { ...g[0], value: a(u, p.start) }, g[g.length - 1] = { ...g[g.length - 1], value: a(u, p.end) }, f = [...f.filter((m) => m.time < p.start || m.time > p.end), ...g], f.sort((m, b) => m.time - b.time);
|
|
3654
3757
|
}
|
|
3655
|
-
c.push({ id:
|
|
3758
|
+
c.push({ id: d?.id ?? `${e}-${u}`, target: e, property: u, keyframes: f });
|
|
3656
3759
|
}
|
|
3657
3760
|
return c;
|
|
3658
3761
|
}
|
|
3659
|
-
const
|
|
3762
|
+
const Sn = {
|
|
3660
3763
|
walk: 1e3,
|
|
3661
3764
|
bouncy: 900,
|
|
3662
3765
|
doubleBounce: 1100,
|
|
@@ -3664,77 +3767,86 @@ const ni = {
|
|
|
3664
3767
|
strut: 1100,
|
|
3665
3768
|
tired: 1500,
|
|
3666
3769
|
run: 560
|
|
3667
|
-
},
|
|
3668
|
-
function
|
|
3669
|
-
return Math.max(
|
|
3770
|
+
}, gi = 450, pi = 2.4, mi = 160, En = 2.5, he = 450, Mn = 1200, bi = 700, ke = 320, Se = 220, wi = 65, yi = 700, pt = (e) => e in Ee, Hn = (e) => e in Lt, ki = (e) => e in Be;
|
|
3771
|
+
function Si(e) {
|
|
3772
|
+
return Math.max(yi, Array.from(e).length * wi);
|
|
3670
3773
|
}
|
|
3671
|
-
function
|
|
3774
|
+
function fl(e, t, n = {}) {
|
|
3672
3775
|
const s = n.from ?? 0, o = n.height ?? 300;
|
|
3673
|
-
let r = s, l = n.facing ?? 1, i = n.start ??
|
|
3674
|
-
const c = [{ time: 0, pose: i }], u = [{ time: 0, value: 0 }],
|
|
3675
|
-
i = { ...i, ...
|
|
3676
|
-
},
|
|
3776
|
+
let r = s, l = n.facing ?? 1, i = n.start ?? B, a = 0, h = 0;
|
|
3777
|
+
const c = [{ time: 0, pose: i }], u = [{ time: 0, value: 0 }], d = [{ time: 0, value: 0 }], f = [{ time: 0, value: 0 }], p = [{ time: 0, value: "walk" }], g = [{ time: 0, value: l }], m = [], b = [], S = [], k = (w, y, A, x) => {
|
|
3778
|
+
i = { ...i, ...y }, A && (i = We(i, A)), c.push({ time: w, pose: i });
|
|
3779
|
+
}, v = (w, y, A) => (k(w + ke / 2, { turn: 0 }, A), g.push({ time: w + ke / 2, value: l }, { time: w + ke / 2 + 1, value: y }), l = y, k(w + ke, { turn: 1 }), w + ke), H = (w) => w < r ? -1 : 1;
|
|
3677
3780
|
for (const w of t) {
|
|
3678
|
-
const
|
|
3679
|
-
let
|
|
3781
|
+
const y = Math.max(w.at ?? h, h === 0 ? 0 : c[c.length - 1].time);
|
|
3782
|
+
let A = y;
|
|
3680
3783
|
const x = w.pose ?? {};
|
|
3681
|
-
if (
|
|
3682
|
-
const
|
|
3683
|
-
let K =
|
|
3684
|
-
|
|
3685
|
-
const
|
|
3686
|
-
p.push({ time: K, value: w.do }), f.push({ time: K, value: 0 }, { time: K +
|
|
3687
|
-
} else if (
|
|
3688
|
-
const
|
|
3689
|
-
|
|
3784
|
+
if (pt(w.do)) {
|
|
3785
|
+
const E = w.to ?? r, P = E === r ? l : H(E);
|
|
3786
|
+
let K = y;
|
|
3787
|
+
P !== l ? K = v(y, P, w.mood) : i.turn < 1 ? (K = y + Se, k(K, { turn: 1, ...x }, w.mood)) : (w.mood || w.pose) && k(y + Se, x, w.mood);
|
|
3788
|
+
const $ = Math.abs(E - r) / Yo(w.do, o), G = w.for ?? Math.max(Se * 2, $ * Sn[w.do]), W = K + G;
|
|
3789
|
+
p.push({ time: K, value: w.do }), f.push({ time: K, value: 0 }, { time: K + Se, value: 1, easing: "ease-out" }), f.push({ time: W - Se, value: 1 }, { time: W, value: 0, easing: "ease-in" }), d.push({ time: K, value: a }, { time: W, value: a + $ }), u.push({ time: K, value: r - s }, { time: W, value: E - s }), a += $, r = E, k(W, {}), A = W;
|
|
3790
|
+
} else if (w.do === "zip") {
|
|
3791
|
+
const E = w.to ?? r, P = E === r ? l : H(E);
|
|
3792
|
+
let K = y;
|
|
3793
|
+
P !== l ? K = v(y, P, w.mood) : i.turn < 1 && (K = y + Se, k(K, { turn: 1 }, w.mood));
|
|
3794
|
+
const _ = un("windUp", { at: K, from: w.mood ? We(i, w.mood) : i });
|
|
3795
|
+
c.push(..._), i = _[_.length - 1].pose;
|
|
3796
|
+
const $ = K + dn("windUp"), G = $ + gi, W = G + Math.max(mi, Math.abs(E - r) / pi);
|
|
3797
|
+
p.push({ time: $, value: "run" }), f.push({ time: $, value: 0 }, { time: $ + 80, value: 1, easing: "ease-out" }, { time: W, value: 1 }, { time: W + 120, value: 0 }), d.push({ time: $, value: a }, { time: G, value: a + En, easing: "ease-in" }), a += En + (W - G) / Sn.run * 1.5, d.push({ time: W, value: a }), u.push({ time: G, value: r - s }, { time: W, value: E - s, easing: "ease-in" }), S.push({ kind: "dust", time: G, x: r, length: 900 }), r = E, k(W, {}), A = W;
|
|
3798
|
+
} else if (Hn(w.do)) {
|
|
3799
|
+
const E = un(w.do, { at: y, from: w.mood ? We(i, w.mood) : i });
|
|
3800
|
+
c.push(...E), i = E[E.length - 1].pose, A = y + dn(w.do), w.do === "take" && S.push({ kind: "dust", time: y + 900, x: r, length: 500 }), w.do === "land" && S.push({ kind: "dust", time: y + 120, x: r, length: 500 });
|
|
3690
3801
|
} else if (w.do === "look" || w.do === "face") {
|
|
3691
|
-
const
|
|
3692
|
-
if (
|
|
3693
|
-
else if (
|
|
3694
|
-
else if (
|
|
3802
|
+
const E = w.toward ?? "viewer", P = w.for ?? bi;
|
|
3803
|
+
if (E === "viewer") k(y + he, { turn: 0, lookX: 0, lookY: 0, ...x }, w.mood);
|
|
3804
|
+
else if (E === "ahead") k(y + he, { turn: w.do === "face" ? 1 : 0.6, lookX: 1, ...x }, w.mood);
|
|
3805
|
+
else if (E === "back") k(y + he, { turn: 0.2, lookX: -1, ...x }, w.mood);
|
|
3695
3806
|
else {
|
|
3696
|
-
const K = H(
|
|
3697
|
-
K !== l && w.do === "face" ? (
|
|
3807
|
+
const K = H(E);
|
|
3808
|
+
K !== l && w.do === "face" ? (v(y, K, w.mood), k(y + ke + 1, { lookX: 1, ...x })) : K !== l ? k(y + he, { turn: 0.25, lookX: -1, ...x }, w.mood) : k(y + he, { turn: w.do === "face" ? 1 : 0.6, lookX: 1, ...x }, w.mood);
|
|
3698
3809
|
}
|
|
3699
|
-
|
|
3700
|
-
} else if (
|
|
3701
|
-
const
|
|
3702
|
-
y
|
|
3810
|
+
A = y + Math.max(P, he);
|
|
3811
|
+
} else if (ki(w.do) || w.do === "stand") {
|
|
3812
|
+
const E = w.do === "stand" ? B : Be[w.do], P = E.turn !== B.turn ? E.turn : i.turn, K = w.mood ? X[w.mood] : { lookX: i.lookX, lookY: i.lookY };
|
|
3813
|
+
k(y + he, { ...E, turn: P, ...K, ...x }), A = y + (w.for ?? Mn);
|
|
3703
3814
|
} else {
|
|
3704
|
-
const
|
|
3705
|
-
(w.mood || w.pose) && y
|
|
3815
|
+
const E = w.for ?? (w.say ? Si(w.say) : Mn);
|
|
3816
|
+
(w.mood || w.pose) && k(y + Math.min(he, E / 2), x, w.mood), A = y + E;
|
|
3706
3817
|
}
|
|
3707
3818
|
if (w.say) {
|
|
3708
|
-
const
|
|
3709
|
-
m.push({ text: w.say, start:
|
|
3819
|
+
const E = pt(w.do) || Hn(w.do) ? y : y + Math.min(150, (A - y) / 4), P = pt(w.do) ? A : Math.max(E + 200, A - 100);
|
|
3820
|
+
m.push({ text: w.say, start: E, end: P }), w.do === "say" && Hi(c, i, E, P);
|
|
3710
3821
|
}
|
|
3711
|
-
|
|
3822
|
+
A > c[c.length - 1].time && c.push({ time: A, pose: i }), b.push({ start: y, end: A }), h = A;
|
|
3712
3823
|
}
|
|
3713
|
-
const
|
|
3824
|
+
const T = oi(e, Mi(c), n), M = [
|
|
3714
3825
|
{ id: `${e}-x`, target: e, property: "x", keyframes: u },
|
|
3715
|
-
{ id: `${e}-walk`, target: e, property: "walk", keyframes:
|
|
3826
|
+
{ id: `${e}-walk`, target: e, property: "walk", keyframes: d },
|
|
3716
3827
|
{ id: `${e}-walking`, target: e, property: "walking", keyframes: f },
|
|
3717
3828
|
{ id: `${e}-gait`, target: e, property: "gait", keyframes: p },
|
|
3718
|
-
{ id: `${e}-facing`, target: e, property: "facing", keyframes:
|
|
3829
|
+
{ id: `${e}-facing`, target: e, property: "facing", keyframes: g }
|
|
3719
3830
|
].filter((w) => w.keyframes.length > 1 || w.property === "x");
|
|
3720
3831
|
return {
|
|
3721
|
-
tracks: [...
|
|
3832
|
+
tracks: [...di(e, T, m, { energy: n.energy }), ...M],
|
|
3722
3833
|
duration: h,
|
|
3723
3834
|
lines: m,
|
|
3724
3835
|
keys: c,
|
|
3725
|
-
beats: b
|
|
3836
|
+
beats: b,
|
|
3837
|
+
effects: S
|
|
3726
3838
|
};
|
|
3727
3839
|
}
|
|
3728
|
-
const
|
|
3729
|
-
function
|
|
3840
|
+
const Ei = 30;
|
|
3841
|
+
function Mi(e) {
|
|
3730
3842
|
const t = [];
|
|
3731
3843
|
for (const n of e) {
|
|
3732
3844
|
const s = t[t.length - 1];
|
|
3733
|
-
s && n.time - s.time <
|
|
3845
|
+
s && n.time - s.time < Ei ? t[t.length - 1] = { ...n, time: s.time } : t.push(n);
|
|
3734
3846
|
}
|
|
3735
3847
|
return t;
|
|
3736
3848
|
}
|
|
3737
|
-
function
|
|
3849
|
+
function Hi(e, t, n, s) {
|
|
3738
3850
|
const r = e.filter((a) => a.time > n), l = e.filter((a) => a.time <= n), i = [];
|
|
3739
3851
|
for (let a = n + 520, h = 0; a < s - 520 / 2; a += 520, h++) {
|
|
3740
3852
|
const c = h % 2 === 0 ? 3 : -2;
|
|
@@ -3743,126 +3855,134 @@ function ci(e, t, n, s) {
|
|
|
3743
3855
|
i.length > 0 && i.push({ time: s, pose: t }), e.length = 0, e.push(...l, ...i.filter((a) => !r.some((h) => Math.abs(h.time - a.time) < 60)), ...r), e.sort((a, h) => a.time - h.time);
|
|
3744
3856
|
}
|
|
3745
3857
|
export {
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3858
|
+
dt as ACTING_STYLES,
|
|
3859
|
+
ve as DANCE_STYLES,
|
|
3860
|
+
X as EXPRESSIONS,
|
|
3861
|
+
yo as FINGERS,
|
|
3862
|
+
_t as FLIPS,
|
|
3863
|
+
Lt as GAGS,
|
|
3864
|
+
Ee as GAITS,
|
|
3865
|
+
Sn as GAIT_CYCLE_MS,
|
|
3866
|
+
Y as HAND_REST,
|
|
3867
|
+
q as HAND_SHAPES,
|
|
3868
|
+
ni as HUMAN_ACTING_RIG,
|
|
3869
|
+
dr as HUMAN_EXPRESSIONS,
|
|
3870
|
+
Xr as HUMAN_GAGS,
|
|
3871
|
+
cr as HUMAN_POSES,
|
|
3872
|
+
C as HUMAN_REST,
|
|
3873
|
+
ml as IDENTITY_CAMERA,
|
|
3874
|
+
nn as MUDRAS,
|
|
3875
|
+
Be as POSES,
|
|
3876
|
+
B as REST_POSE,
|
|
3877
|
+
Qr as STICK_ACTING_RIG,
|
|
3878
|
+
ue as VISEMES,
|
|
3879
|
+
il as actCharacterTracks,
|
|
3880
|
+
ro as actKeyframes,
|
|
3881
|
+
oi as actTracks,
|
|
3882
|
+
bl as applyCamera,
|
|
3883
|
+
xs as applyGroove,
|
|
3884
|
+
Fi as bakeDanceTracks,
|
|
3885
|
+
rl as basicOutfit,
|
|
3886
|
+
_i as beatAt,
|
|
3887
|
+
_e as blendPose,
|
|
3888
|
+
ho as boilFrame,
|
|
3889
|
+
wl as cameraFromValues,
|
|
3890
|
+
yl as cameraPoint,
|
|
3891
|
+
Mr as character,
|
|
3892
|
+
Ui as characterAt,
|
|
3893
|
+
Pr as characterHandPose,
|
|
3894
|
+
Tr as characterJoints,
|
|
3895
|
+
Di as characterJointsInView,
|
|
3896
|
+
Vi as characterObjects,
|
|
3897
|
+
zi as characterPoseTracks,
|
|
3898
|
+
Gi as characterTarget,
|
|
3899
|
+
Ji as circlePath,
|
|
3900
|
+
so as clipErased,
|
|
3901
|
+
Tn as createPen,
|
|
3902
|
+
Ot as danceFrame,
|
|
3903
|
+
Oi as dancePose,
|
|
3904
|
+
Mt as danceStance,
|
|
3905
|
+
Ii as danceTaps,
|
|
3906
|
+
Bi as danceTracks,
|
|
3907
|
+
lt as danceTravel,
|
|
3908
|
+
Os as danceTravelTrack,
|
|
3909
|
+
$i as dancer,
|
|
3910
|
+
Kt as drawCartoonHand,
|
|
3911
|
+
Wr as drawCharacter,
|
|
3912
|
+
Or as drawCharacterInView,
|
|
3913
|
+
al as drawDustPuff,
|
|
3914
|
+
eo as drawEraser,
|
|
3915
|
+
no as drawHand,
|
|
3916
|
+
hl as drawImpactStars,
|
|
3917
|
+
Nr as drawPencil,
|
|
3918
|
+
ri as drawSpeedLines,
|
|
3919
|
+
bs as drawStickFigure,
|
|
3920
|
+
ll as drawStickSmear,
|
|
3921
|
+
Zi as drawnPathTarget,
|
|
3922
|
+
Dt as ellipsePoints,
|
|
3923
|
+
tl as erasable,
|
|
3924
|
+
Vs as flipPose,
|
|
3925
|
+
Ri as flipTracks,
|
|
3926
|
+
js as flipTravel,
|
|
3927
|
+
un as gag,
|
|
3928
|
+
dn as gagDuration,
|
|
3929
|
+
Lo as gaitPose,
|
|
3930
|
+
Yo as gaitStrideLength,
|
|
3931
|
+
ji as handAt,
|
|
3932
|
+
yt as handJoints,
|
|
3933
|
+
Wo as handJointsAt,
|
|
3934
|
+
L as handPose,
|
|
3935
|
+
je as handProp,
|
|
3936
|
+
Pi as headPoint,
|
|
3937
|
+
Li as humanFieldLabel,
|
|
3938
|
+
sl as humanGag,
|
|
3939
|
+
nl as humanGaitPose,
|
|
3940
|
+
ol as humanGaitStrideLength,
|
|
3941
|
+
fr as humanPlan,
|
|
3942
|
+
te as humanPose,
|
|
3943
|
+
Ir as jointsInScene,
|
|
3944
|
+
ms as jointsToScene,
|
|
3945
|
+
lo as lipSyncKeyframes,
|
|
3946
|
+
di as lipSyncOver,
|
|
3947
|
+
cl as lipSyncTracks,
|
|
3948
|
+
Ni as mirrorHumanPose,
|
|
3949
|
+
Ts as mirrorPose,
|
|
3950
|
+
Ie as mixHandPoses,
|
|
3951
|
+
Xi as mixPoses,
|
|
3952
|
+
vn as partialPath,
|
|
3953
|
+
gl as pathLength,
|
|
3954
|
+
xt as pointAlong,
|
|
3955
|
+
Ci as pointOnHead,
|
|
3956
|
+
V as pose,
|
|
3957
|
+
Wi as poseTracks,
|
|
3958
|
+
qi as reachCharacter,
|
|
3959
|
+
Gr as resolveActingStyle,
|
|
3960
|
+
Qn as resolveCharacterPoseKeys,
|
|
3961
|
+
ot as resolveGait,
|
|
3962
|
+
Cn as resolvePoseKeys,
|
|
3963
|
+
Ln as resolveStickFrame,
|
|
3964
|
+
ws as resolveStickPose,
|
|
3965
|
+
pe as rotateAbout,
|
|
3966
|
+
It as routineBeats,
|
|
3967
|
+
He as rubberLimb,
|
|
3968
|
+
fl as scriptTracks,
|
|
3969
|
+
Qi as scrubPath,
|
|
3970
|
+
xi as seatHeight,
|
|
3971
|
+
Vn as skeletonInView,
|
|
3972
|
+
mt as sketchPen,
|
|
3973
|
+
Bt as solvePlanSpace,
|
|
3974
|
+
ui as soundsOf,
|
|
3975
|
+
Si as speechDuration,
|
|
3976
|
+
zn as stagePlanSpace,
|
|
3977
|
+
Ss as stickFigureAt,
|
|
3978
|
+
ps as stickFigureJoints,
|
|
3979
|
+
Ki as stickFigureTarget,
|
|
3980
|
+
Yi as stickToHuman,
|
|
3981
|
+
Xo as strideLength,
|
|
3982
|
+
qo as talkingMouth,
|
|
3983
|
+
Pt as taperedLine,
|
|
3984
|
+
qe as taperedOutline,
|
|
3985
|
+
Do as walkPose,
|
|
3986
|
+
el as withErased,
|
|
3987
|
+
We as withExpression
|
|
3868
3988
|
};
|