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