@algorisys/tinyfly 0.120.0 → 0.121.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 +6 -6
- package/docs/editor-guide.md +1 -1
- package/docs/examples.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/gsap-compat.md +1 -1
- package/docs/llm-guide.md +2 -1
- package/docs/maps.md +2 -2
- package/docs/math.md +26 -4
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +209 -208
- package/lib/addons/math.js +1349 -1275
- package/lib/browser/tinyfly-math.iife.js +4 -4
- package/lib/browser/tinyfly.iife.js +1 -1
- package/lib/browser/tinyfly.js +1 -0
- package/lib/browser/tinyfly.umd.js +1 -1
- package/lib/types/math/index.d.ts +1 -0
- package/lib/types/math/ml/loss-surface.d.ts +118 -0
- package/llms-full.txt +37 -13
- package/llms.txt +31 -31
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +2 -1
package/lib/addons/characters.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { H as we, A as bt, R as ce, B as Pe, D as Xt, E as to, F as rt, G as tr, I as ye, J as sr, K as Ws, L as so, M as or, N as nr, O as Gn, P as oo, Q as Yn, S as ar, T as rr, U as ir, V as _e, W as lr, X as Ke, Y as Un, Z as Xn, _ as To, $ as hr, a0 as xe, a1 as Fe, a2 as Oe, a3 as cr, a4 as dr, a5 as fr, a6 as Vn, a7 as Ae, a8 as $e, a9 as Jn, aa as ur, ab as zs, ac as je, ad as Zn, ae as gr, af as pr, ag as Qn, ah as mr, ai as yr, aj as br, ak as wr, al as kr, i as vr, h as Sr, c as Mr, j as $r, f as Er, d as Ar, b as Tr, e as Pr, C as Or, am as Hr, an as Ir, ao as xr, ap as jr, aq as _r, ar as Kr, as as
|
|
2
|
-
import { au as Ef, av as Af, aw as Tf, ax as Pf, ay as Of, az as Hf, aA as If, aB as xf, aC as jf, aD as _f, aE as Kf, aF as
|
|
1
|
+
import { H as we, A as bt, R as ce, B as Pe, D as Xt, E as to, F as rt, G as tr, I as ye, J as sr, K as Ws, L as so, M as or, N as nr, O as Gn, P as oo, Q as Yn, S as ar, T as rr, U as ir, V as _e, W as lr, X as Ke, Y as Un, Z as Xn, _ as To, $ as hr, a0 as xe, a1 as Fe, a2 as Oe, a3 as cr, a4 as dr, a5 as fr, a6 as Vn, a7 as Ae, a8 as $e, a9 as Jn, aa as ur, ab as zs, ac as je, ad as Zn, ae as gr, af as pr, ag as Qn, ah as mr, ai as yr, aj as br, ak as wr, al as kr, i as vr, h as Sr, c as Mr, j as $r, f as Er, d as Ar, b as Tr, e as Pr, C as Or, am as Hr, an as Ir, ao as xr, ap as jr, aq as _r, ar as Kr, as as Nr, at as Cr } from "./cricket-play-C5CkNOc6.js";
|
|
2
|
+
import { au as Ef, av as Af, aw as Tf, ax as Pf, ay as Of, az as Hf, aA as If, aB as xf, aC as jf, aD as _f, aE as Kf, aF as Nf, aG as Cf, aH as Rf, aI as Wf, aJ as zf, aK as Ff, aL as Df, aM as Lf, aN as qf, aO as Bf, aP as Gf, aQ as Yf, aR as Uf, aS as Xf, aT as Vf, aU as Jf, aV as Zf, aW as Qf, aX as eu, aY as tu, aZ as su, a_ as ou, a$ as nu, b0 as au, b1 as ru, b2 as iu, b3 as lu, b4 as hu, b5 as cu, b6 as du, b7 as fu, b8 as uu, b9 as gu, ba as pu, bb as mu, bc as yu, bd as bu, be as wu, bf as ku, bg as vu, bh as Su, bi as Mu, bj as $u, bk as Eu, bl as Au, bm as Tu, bn as Pu, bo as Ou, bp as Hu, bq as Iu, br as xu, bs as ju, bt as _u } from "./cricket-play-C5CkNOc6.js";
|
|
3
3
|
import { getEasingFunction as mt, hashSeed as De, mat4 as oe, vec3 as ke, quat as We, Timeline as ve, unknownName as fe, createRandom as no, springFollow as Bt, closestName as Fs } from "@algorisys/tinyfly";
|
|
4
4
|
import { f as Vt, h as Rr, a as ea } from "./load-scene-oWNsYYC1.js";
|
|
5
5
|
import { l as ta, f as sa } from "./shading-0lPgnXmD.js";
|
|
6
6
|
import { s as Wr, p as oa, b as ao } from "./sketch-CYPUbk3Q.js";
|
|
7
|
-
import { c as
|
|
7
|
+
import { c as Nu, a as Cu } from "./sketch-CYPUbk3Q.js";
|
|
8
8
|
import { C as zr } from "./target-properties-BtN9skb-.js";
|
|
9
9
|
import { I as Wu, a as zu, b as Fu, c as Du, d as Lu, e as qu, f as Bu } from "./target-properties-BtN9skb-.js";
|
|
10
10
|
const ys = 0.5, Ds = {
|
|
@@ -1472,7 +1472,7 @@ function Ki(e) {
|
|
|
1472
1472
|
const t = ke.cross([0, 1, 0], e);
|
|
1473
1473
|
return oe.fromQuat(We.fromAxisAngle(t, Math.acos(s) * 180 / Math.PI));
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1475
|
+
function Ni(e, s, t, o, r) {
|
|
1476
1476
|
const a = e.solid ?? {}, n = a.outline === !1 ? void 0 : a.outline ?? { width: 2, color: "#0f172a" }, i = { color: a.color ?? "#475569", shading: a.shading ?? "toon", outline: n }, h = { color: a.skin ?? "#f2c49b", shading: a.shading ?? "toon", outline: n }, c = { color: "#0f172a", shading: "unlit" }, l = o.height * 0.034, d = [], f = (M, m, P) => d.push({ mesh: M, world: oe.multiply(r, m), material: P }), u = (M, m, P) => f(s.sphere, oe.compose(M, [0, 0, 0, 1], [m, m, m]), P);
|
|
1477
1477
|
for (const M of t.chains) {
|
|
1478
1478
|
const m = o.chains[M.id], P = M.id === "spine" ? 1.9 : 1;
|
|
@@ -1525,7 +1525,7 @@ const Id = {
|
|
|
1525
1525
|
const H = h.shadow === !1 ? [] : [{ depth: T + u, draw: (y) => _i(y, g, u * 0.18) }];
|
|
1526
1526
|
if (h.look === "solid") {
|
|
1527
1527
|
const y = so(l.plan, d, { height: u, contact: l.contact });
|
|
1528
|
-
return { meshes:
|
|
1528
|
+
return { meshes: Ni(h, c, l.plan, y, o), drawables: H };
|
|
1529
1529
|
}
|
|
1530
1530
|
const M = oe.transformPoint(o, [0, u * 0.6, 0]), m = ke.normalize(ke.subtract(r.position, M)), P = ta(M, m, a).map((y) => Math.min(1, y));
|
|
1531
1531
|
let A = l;
|
|
@@ -1563,7 +1563,7 @@ const Id = {
|
|
|
1563
1563
|
l: { mouth: 0.3, mouthWidth: 1 },
|
|
1564
1564
|
/** Other consonants: slightly open */
|
|
1565
1565
|
c: { mouth: 0.2, mouthWidth: 1 }
|
|
1566
|
-
}, wt = 1,
|
|
1566
|
+
}, wt = 1, Nt = 0.55, No = 0.35, Ci = 1.6, Co = { a: "a", e: "e", i: "i", y: "i", o: "o", u: "u" }, Ro = { m: "m", b: "m", p: "m", f: "f", v: "f", w: "u", q: "u", l: "l", n: "l", d: "l", t: "l" }, Wo = {
|
|
1567
1567
|
अ: "a",
|
|
1568
1568
|
आ: "a",
|
|
1569
1569
|
इ: "i",
|
|
@@ -1598,29 +1598,29 @@ function Fi(e) {
|
|
|
1598
1598
|
};
|
|
1599
1599
|
for (let r = 0; r < t.length; r++) {
|
|
1600
1600
|
const a = t[r], n = t[r + 1];
|
|
1601
|
-
if (Do.has(a)) o("rest",
|
|
1601
|
+
if (Do.has(a)) o("rest", Ci);
|
|
1602
1602
|
else if (/\s/.test(a)) {
|
|
1603
1603
|
const i = s[s.length - 1];
|
|
1604
|
-
i && i.viseme !== "rest" && s.push({ viseme: "c", weight:
|
|
1604
|
+
i && i.viseme !== "rest" && s.push({ viseme: "c", weight: No });
|
|
1605
1605
|
} else if ((a === "o" || a === "e") && n === a)
|
|
1606
1606
|
o(a === "o" ? "u" : "i", wt), r++;
|
|
1607
|
-
else if (a in
|
|
1608
|
-
else if (a in Ro) o(Ro[a],
|
|
1607
|
+
else if (a in Co) o(Co[a], wt);
|
|
1608
|
+
else if (a in Ro) o(Ro[a], Nt);
|
|
1609
1609
|
else {
|
|
1610
1610
|
if (a === "h") continue;
|
|
1611
|
-
if (/[a-z]/.test(a)) o("c",
|
|
1611
|
+
if (/[a-z]/.test(a)) o("c", Nt);
|
|
1612
1612
|
else if (a in Wo) o(Wo[a], wt);
|
|
1613
1613
|
else if (zi(a)) {
|
|
1614
1614
|
const i = n === Fo ? a === "फ" ? "f" : void 0 : Ri[a];
|
|
1615
|
-
o(i ?? "c",
|
|
1615
|
+
o(i ?? "c", Nt);
|
|
1616
1616
|
let h = r + 1;
|
|
1617
1617
|
t[h] === Fo && h++;
|
|
1618
1618
|
const c = t[h];
|
|
1619
1619
|
c === Wi ? r = h : c && c in zo ? (o(zo[c], wt), r = h) : (!c || /\s/.test(c) || Do.has(c) || o("a", wt * 0.6), r = h - 1);
|
|
1620
|
-
} else (a === "ं" || a === "ँ") && o("l",
|
|
1620
|
+
} else (a === "ं" || a === "ँ") && o("l", Nt * 0.6);
|
|
1621
1621
|
}
|
|
1622
1622
|
}
|
|
1623
|
-
for (; s.length > 0 && (s[s.length - 1].viseme === "rest" || s[s.length - 1].weight ===
|
|
1623
|
+
for (; s.length > 0 && (s[s.length - 1].viseme === "rest" || s[s.length - 1].weight === No); ) s.pop();
|
|
1624
1624
|
return s;
|
|
1625
1625
|
}
|
|
1626
1626
|
function ma(e, s = {}) {
|
|
@@ -1930,10 +1930,10 @@ ${o.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
|
|
|
1930
1930
|
const se = l;
|
|
1931
1931
|
let q = c;
|
|
1932
1932
|
for (let I = 0; ; I = Math.min(O, I + Zi)) {
|
|
1933
|
-
const
|
|
1933
|
+
const N = E + va(G, I / O) * x, { point: C, direction: S } = ka(w, I);
|
|
1934
1934
|
q += ts(q, lt([0, 0], S));
|
|
1935
1935
|
const _ = I === 0 ? p : u;
|
|
1936
|
-
if (_("x",
|
|
1936
|
+
if (_("x", N, C[0]), _("z", N, C[1]), _("rotateY", N, q), _("walk", N, se + I / W), I >= O) break;
|
|
1937
1937
|
}
|
|
1938
1938
|
return l = se + O / W, [i, h] = w[w.length - 1].point, c = q, E + x;
|
|
1939
1939
|
}, H = [], M = [];
|
|
@@ -1952,8 +1952,8 @@ ${o.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
|
|
|
1952
1952
|
for (const Y of Object.keys(W[0])) {
|
|
1953
1953
|
const se = n(Y, j);
|
|
1954
1954
|
Y === "turn" || Y === "roll" || W.every((q) => q[Y] === se) || (p(Y, y, se), W.slice(1).forEach((q, I) => {
|
|
1955
|
-
const
|
|
1956
|
-
u(Y,
|
|
1955
|
+
const N = y + (v - y) * (I + 1) / x, C = Math.min(1, (N - y) / G), S = C * C * (3 - 2 * C);
|
|
1956
|
+
u(Y, N, se + (q[Y] - se) * S);
|
|
1957
1957
|
}), a[Y] = W[x][Y]);
|
|
1958
1958
|
}
|
|
1959
1959
|
} else if (k.do === "hold") v = y + (k.for ?? 1e3);
|
|
@@ -2124,7 +2124,7 @@ function al(e, s, t, o, r, a, n, i) {
|
|
|
2124
2124
|
const p = [l(u, -1, c * 1.3), l(r, -1, c * 1.5), l(r, 1, c * 1.5), l(u, 1, c * 1.3)];
|
|
2125
2125
|
e.beginPath(), p.forEach((g, b) => b ? e.lineTo(g.x, g.y) : e.moveTo(g.x, g.y)), e.closePath(), e.fillStyle = f(n), e.fill(), e.strokeStyle = f(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();
|
|
2126
2126
|
}
|
|
2127
|
-
function
|
|
2127
|
+
function Nd(e, s, t = {}) {
|
|
2128
2128
|
const o = t.offstage ?? { x: 2e3, y: 1400 }, r = t.enter ?? 450, a = t.exit ?? 450, n = t.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, b) => g.start - b.start), h = (g) => g.tool ?? "pencil", c = (g) => {
|
|
2129
2129
|
const b = Math.min(1, Math.max(0, g));
|
|
2130
2130
|
return b * b * (3 - 2 * b);
|
|
@@ -2148,7 +2148,7 @@ function Cd(e, s, t = {}) {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
return null;
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2151
|
+
function Cd(e, s, t, o = 0.08, r = 32) {
|
|
2152
2152
|
const a = Math.PI * 2 * (1 + o), n = [];
|
|
2153
2153
|
for (let i = 0; i <= r; i++) {
|
|
2154
2154
|
const h = -Math.PI / 2 + a * i / r;
|
|
@@ -2187,7 +2187,7 @@ function Aa(e, s, t) {
|
|
|
2187
2187
|
e.stroke();
|
|
2188
2188
|
}
|
|
2189
2189
|
}
|
|
2190
|
-
const
|
|
2190
|
+
const Ct = 1e5;
|
|
2191
2191
|
function Wd(e, s, t, o, r = 6) {
|
|
2192
2192
|
const a = [], n = Math.max(1, Math.round(r));
|
|
2193
2193
|
for (let i = 0; i <= n; i++)
|
|
@@ -2197,7 +2197,7 @@ function Wd(e, s, t, o, r = 6) {
|
|
|
2197
2197
|
function Ta(e, s, t, o) {
|
|
2198
2198
|
if (o <= 0 || s.length === 0) return;
|
|
2199
2199
|
const r = oa(s, o), a = t / 2, n = (i) => {
|
|
2200
|
-
e.beginPath(), e.rect(-
|
|
2200
|
+
e.beginPath(), e.rect(-Ct, -Ct, 2 * Ct, 2 * Ct), i(), e.clip("evenodd");
|
|
2201
2201
|
};
|
|
2202
2202
|
for (const i of r)
|
|
2203
2203
|
n(() => {
|
|
@@ -2390,19 +2390,19 @@ function Dd(e) {
|
|
|
2390
2390
|
const s = { ...cl, ...e.theme }, t = e.code.replace(/\t/g, " ").replace(/\n$/, "").split(`
|
|
2391
2391
|
`), o = e.fontSize ?? 16, r = (e.lineHeight ?? 1.6) * o, a = (e.charWidth ?? 0.6) * o, n = e.padding ?? 12, i = e.lineNumbers === !1 ? 0 : (String(t.length).length + 2) * a, h = Math.max(1, ...t.map((I) => I.length)), c = e.width ?? n * 2 + i + h * a, l = n * 2 + t.length * r, d = e.x + n + i, f = new Set(e.hidden ?? []), u = e.language ?? "plain";
|
|
2392
2392
|
if (!Ys.includes(u)) throw new Error(`codePanel: ${fe("language", u, Ys)}`);
|
|
2393
|
-
const p = t.map((I) => ml(I, u).flatMap((
|
|
2393
|
+
const p = t.map((I) => ml(I, u).flatMap((N) => Array.from(N.text, () => s[N.kind]))), g = It(), b = ds(g), T = [], H = /* @__PURE__ */ new Map(), M = [], m = [], P = (I) => {
|
|
2394
2394
|
if (!Number.isInteger(I) || I < 1 || I > t.length) throw new Error(`codePanel: no line ${I} (it has ${t.length})`);
|
|
2395
|
-
}, A = g.tween, k = g.last, y = (I,
|
|
2396
|
-
P(I), A(`line.${I}.${
|
|
2397
|
-
}, v = (I,
|
|
2395
|
+
}, A = g.tween, k = g.last, y = (I, N, C, S, _, V = 300) => {
|
|
2396
|
+
P(I), A(`line.${I}.${N}`, C, S, _, V);
|
|
2397
|
+
}, v = (I, N) => T.filter((C) => C.line < I && C.closed <= N).length, w = me, E = (I) => e.y + n + (I - 1) * r, O = (I) => Array.isArray(I) ? I : [I], j = (I, N, C) => {
|
|
2398
2398
|
let S = -1;
|
|
2399
|
-
for (let _ = 0; _ <
|
|
2400
|
-
if (S = t[I - 1].indexOf(
|
|
2399
|
+
for (let _ = 0; _ < C; _++)
|
|
2400
|
+
if (S = t[I - 1].indexOf(N, S + 1), S < 0) throw new Error(`codePanel: line ${I} has no ${C > 1 ? `${C}th ` : ""}"${N}"`);
|
|
2401
2401
|
return S;
|
|
2402
2402
|
}, x = {};
|
|
2403
|
-
t.forEach((I,
|
|
2404
|
-
const
|
|
2405
|
-
x[`line.${
|
|
2403
|
+
t.forEach((I, N) => {
|
|
2404
|
+
const C = N + 1;
|
|
2405
|
+
x[`line.${C}.highlight`] = 0, x[`line.${C}.strike`] = 0, x[`line.${C}.wipe`] = 0, x[`line.${C}.reveal`] = f.has(C) ? 0 : 1, x[`line.${C}.shift`] = 0;
|
|
2406
2406
|
});
|
|
2407
2407
|
const W = {
|
|
2408
2408
|
type: "custom",
|
|
@@ -2420,8 +2420,8 @@ function Dd(e) {
|
|
|
2420
2420
|
},
|
|
2421
2421
|
actions: Pa
|
|
2422
2422
|
},
|
|
2423
|
-
draw(I,
|
|
2424
|
-
const
|
|
2423
|
+
draw(I, N) {
|
|
2424
|
+
const C = N.props ?? {}, S = (F) => Number(C[F] ?? x[F]), _ = n + i, V = (F) => n + (F - 1) * r - S(`line.${F}.shift`) * r;
|
|
2425
2425
|
I.fillStyle = s.background, Xo(I, 0, 0, c, l, 8), I.fill(), I.font = `${o}px ${s.font}`, I.textBaseline = "middle", I.textAlign = "left";
|
|
2426
2426
|
const ee = (F, Q, ae, K, X) => {
|
|
2427
2427
|
const D = t[F - 1];
|
|
@@ -2464,168 +2464,168 @@ function Dd(e) {
|
|
|
2464
2464
|
I.restore();
|
|
2465
2465
|
}
|
|
2466
2466
|
}, G = (I) => {
|
|
2467
|
-
const { kind:
|
|
2468
|
-
if (
|
|
2469
|
-
if (
|
|
2470
|
-
return { kind:
|
|
2467
|
+
const { kind: N, rest: C } = pt(I), S = (_) => Ue("codePanel", I, Gt, _);
|
|
2468
|
+
if (N === "box") {
|
|
2469
|
+
if (C) throw S("box takes no arguments");
|
|
2470
|
+
return { kind: N };
|
|
2471
2471
|
}
|
|
2472
|
-
if (
|
|
2473
|
-
if (!/^\d+$/.test(
|
|
2474
|
-
return { kind:
|
|
2472
|
+
if (N === "line") {
|
|
2473
|
+
if (!/^\d+$/.test(C)) throw S("write it line:N");
|
|
2474
|
+
return { kind: N, n: Number(C) };
|
|
2475
2475
|
}
|
|
2476
|
-
if (
|
|
2477
|
-
const _ = /^(\d+)(?:#(\d+))?:(.+)$/.exec(
|
|
2476
|
+
if (N === "token") {
|
|
2477
|
+
const _ = /^(\d+)(?:#(\d+))?:(.+)$/.exec(C);
|
|
2478
2478
|
if (!_) throw S("write it token:N:TEXT, or token:N#K:TEXT for the Kth");
|
|
2479
|
-
return { kind:
|
|
2479
|
+
return { kind: N, n: Number(_[1]), occurrence: _[2] ? Number(_[2]) : 1, text: _[3] };
|
|
2480
2480
|
}
|
|
2481
|
-
if (
|
|
2482
|
-
const _ = /^(\d+):(\d+)(?::(\d+))?$/.exec(
|
|
2481
|
+
if (N === "spot") {
|
|
2482
|
+
const _ = /^(\d+):(\d+)(?::(\d+))?$/.exec(C);
|
|
2483
2483
|
if (!_) throw S("write it spot:N:C, or spot:N:C:W for W characters");
|
|
2484
|
-
return { kind:
|
|
2484
|
+
return { kind: N, n: Number(_[1]), column: Number(_[2]), width: _[3] ? Number(_[3]) : 1 };
|
|
2485
2485
|
}
|
|
2486
2486
|
throw S();
|
|
2487
|
-
}, Y = (I,
|
|
2488
|
-
const _ = Array.isArray(
|
|
2489
|
-
if (_.length === 0 || S && _.length > 1) throw new Error(`codePanel.edit: ${I} takes ${S ? "one" : "at least one"} ${
|
|
2487
|
+
}, Y = (I, N, C, S = !1) => {
|
|
2488
|
+
const _ = Array.isArray(N) ? N : [N];
|
|
2489
|
+
if (_.length === 0 || S && _.length > 1) throw new Error(`codePanel.edit: ${I} takes ${S ? "one" : "at least one"} ${C} anchor`);
|
|
2490
2490
|
return _.map((V) => {
|
|
2491
2491
|
const ee = G(V);
|
|
2492
|
-
if (ee.kind !==
|
|
2492
|
+
if (ee.kind !== C) throw new Error(`codePanel.edit: ${I} takes ${C} anchors (${C}:…), not "${V}"`);
|
|
2493
2493
|
return ee;
|
|
2494
2494
|
});
|
|
2495
|
-
}, se = (I,
|
|
2496
|
-
if (typeof
|
|
2497
|
-
return
|
|
2495
|
+
}, se = (I, N) => {
|
|
2496
|
+
if (typeof N.text != "string") throw new Error(`codePanel.edit: ${I} needs \`text\` (the text to write)`);
|
|
2497
|
+
return N.text;
|
|
2498
2498
|
}, q = {
|
|
2499
2499
|
kind: "code",
|
|
2500
2500
|
about: Gt,
|
|
2501
2501
|
target: W,
|
|
2502
2502
|
lines: t,
|
|
2503
2503
|
box: w(e.x, e.y, c, l),
|
|
2504
|
-
line(I,
|
|
2505
|
-
return P(I), w(d, E(I) - v(I,
|
|
2504
|
+
line(I, N = 1 / 0) {
|
|
2505
|
+
return P(I), w(d, E(I) - v(I, N) * r, Math.max(1, t[I - 1].length) * a, r);
|
|
2506
2506
|
},
|
|
2507
|
-
token(I,
|
|
2507
|
+
token(I, N, C = 1, S = 1 / 0) {
|
|
2508
2508
|
P(I);
|
|
2509
|
-
const _ = j(I,
|
|
2510
|
-
return w(d + _ * a, E(I) - v(I, S) * r,
|
|
2509
|
+
const _ = j(I, N, C);
|
|
2510
|
+
return w(d + _ * a, E(I) - v(I, S) * r, N.length * a, r);
|
|
2511
2511
|
},
|
|
2512
|
-
highlight(I,
|
|
2513
|
-
for (const
|
|
2514
|
-
const S = k(`line.${
|
|
2515
|
-
y(
|
|
2512
|
+
highlight(I, N) {
|
|
2513
|
+
for (const C of O(I)) {
|
|
2514
|
+
const S = k(`line.${C}.highlight`, 0);
|
|
2515
|
+
y(C, "highlight", S, N.on === !1 ? 0 : 1, N, 200);
|
|
2516
2516
|
}
|
|
2517
2517
|
return q;
|
|
2518
2518
|
},
|
|
2519
|
-
strike(I,
|
|
2520
|
-
for (const
|
|
2519
|
+
strike(I, N) {
|
|
2520
|
+
for (const C of O(I)) y(C, "strike", k(`line.${C}.strike`, 0), 1, N);
|
|
2521
2521
|
return q;
|
|
2522
2522
|
},
|
|
2523
|
-
remove(I,
|
|
2524
|
-
const
|
|
2523
|
+
remove(I, N) {
|
|
2524
|
+
const C = O(I), S = N.style ?? "wipe";
|
|
2525
2525
|
if (!Gs.includes(S)) throw new Error(`codePanel.remove: ${fe("style", S, Gs)}`);
|
|
2526
|
-
const _ = S === "wipe" ? 300 : 450, V =
|
|
2527
|
-
for (const F of
|
|
2528
|
-
y(F, "wipe", 0, 1, { ...
|
|
2526
|
+
const _ = S === "wipe" ? 300 : 450, V = N.at + (N.duration ?? _), ee = N.close ?? 250;
|
|
2527
|
+
for (const F of C)
|
|
2528
|
+
y(F, "wipe", 0, 1, { ...N, easing: N.easing ?? (S === "fly" ? "ease-in" : void 0) }, _), H.set(F, { style: S, from: N.from ?? "left" }), T.push({ line: F, closed: V + ee });
|
|
2529
2529
|
for (let F = 1; F <= t.length; F++) {
|
|
2530
|
-
if (
|
|
2531
|
-
const Q =
|
|
2530
|
+
if (C.includes(F)) continue;
|
|
2531
|
+
const Q = C.filter((K) => K < F).length;
|
|
2532
2532
|
if (Q === 0) continue;
|
|
2533
2533
|
const ae = k(`line.${F}.shift`, 0);
|
|
2534
2534
|
y(F, "shift", ae, ae + Q, { at: V, duration: ee, easing: "ease-in-out" });
|
|
2535
2535
|
}
|
|
2536
2536
|
return q;
|
|
2537
2537
|
},
|
|
2538
|
-
type(I,
|
|
2539
|
-
return y(I, "reveal", 0, 1, { duration: t[I - 1].length * 45, ...
|
|
2538
|
+
type(I, N) {
|
|
2539
|
+
return y(I, "reveal", 0, 1, { duration: t[I - 1].length * 45, ...N }), q;
|
|
2540
2540
|
},
|
|
2541
|
-
piece(I,
|
|
2541
|
+
piece(I, N, C = 1) {
|
|
2542
2542
|
if (typeof I == "string") {
|
|
2543
2543
|
const F = G(I);
|
|
2544
2544
|
if (F.kind !== "token") throw new Error(`codePanel.piece: a piece is a word, token:N:TEXT, not "${I}"`);
|
|
2545
2545
|
return q.piece(F.n, F.text, F.occurrence);
|
|
2546
2546
|
}
|
|
2547
2547
|
const S = I;
|
|
2548
|
-
if (
|
|
2548
|
+
if (N === void 0) throw new Error('codePanel.piece: which word? piece(n, text) or piece("token:N:TEXT")');
|
|
2549
2549
|
P(S);
|
|
2550
|
-
const _ = j(S,
|
|
2550
|
+
const _ = j(S, N, C), V = M.find((F) => F.line === S && F.column === _ && F.text === N);
|
|
2551
2551
|
if (V) return V;
|
|
2552
|
-
if (M.some((F) => F.line === S && _ < F.column + F.text.length && F.column < _ +
|
|
2553
|
-
throw new Error(`codePanel: "${
|
|
2554
|
-
const ee = { id: M.length + 1, line: S, column: _, text:
|
|
2552
|
+
if (M.some((F) => F.line === S && _ < F.column + F.text.length && F.column < _ + N.length))
|
|
2553
|
+
throw new Error(`codePanel: "${N}" on line ${S} overlaps another piece`);
|
|
2554
|
+
const ee = { id: M.length + 1, line: S, column: _, text: N, home: q.token(S, N, C, 0) };
|
|
2555
2555
|
M.push(ee);
|
|
2556
2556
|
for (const F of ["x", "y", "rotate", "write", "away"]) x[`piece.${ee.id}.${F}`] = 0;
|
|
2557
2557
|
return x[`piece.${ee.id}.opacity`] = 1, ee;
|
|
2558
2558
|
},
|
|
2559
|
-
follow(I,
|
|
2560
|
-
return b.follow(I,
|
|
2559
|
+
follow(I, N) {
|
|
2560
|
+
return b.follow(I, N), q;
|
|
2561
2561
|
},
|
|
2562
|
-
fling(I,
|
|
2563
|
-
return b.fling(I,
|
|
2562
|
+
fling(I, N) {
|
|
2563
|
+
return b.fling(I, N), q;
|
|
2564
2564
|
},
|
|
2565
|
-
move(I,
|
|
2566
|
-
return b.move(I,
|
|
2565
|
+
move(I, N) {
|
|
2566
|
+
return b.move(I, N), q;
|
|
2567
2567
|
},
|
|
2568
|
-
write(I,
|
|
2569
|
-
return I.written =
|
|
2568
|
+
write(I, N, C) {
|
|
2569
|
+
return I.written = N, A(`piece.${I.id}.write`, 0, 1, { duration: Math.max(1, N.length) * 70, ...C }), q;
|
|
2570
2570
|
},
|
|
2571
|
-
spot(I,
|
|
2571
|
+
spot(I, N, C = 1, S = 1 / 0) {
|
|
2572
2572
|
P(I);
|
|
2573
|
-
const _ = m.filter((V) => V.line === I && V.column <=
|
|
2574
|
-
return w(d + (
|
|
2573
|
+
const _ = m.filter((V) => V.line === I && V.column <= N && V.at <= S).reduce((V, ee) => V + ee.chars, 0);
|
|
2574
|
+
return w(d + (N + _) * a, E(I) - v(I, S) * r, C * a, r);
|
|
2575
2575
|
},
|
|
2576
|
-
insert(I,
|
|
2576
|
+
insert(I, N, C, S) {
|
|
2577
2577
|
P(I);
|
|
2578
|
-
const _ = { id: m.length + 1, line: I, column:
|
|
2578
|
+
const _ = { id: m.length + 1, line: I, column: N, chars: C.length, text: C, at: S.at };
|
|
2579
2579
|
m.push(_), x[`insert.${_.id}.open`] = 0, x[`insert.${_.id}.type`] = 0;
|
|
2580
|
-
const V = S.duration ??
|
|
2580
|
+
const V = S.duration ?? C.length * 70;
|
|
2581
2581
|
return A(`insert.${_.id}.open`, 0, 1, { at: S.at, duration: V * 0.6, easing: "ease-out" }), A(`insert.${_.id}.type`, 0, 1, { at: S.at, duration: V }), q;
|
|
2582
2582
|
},
|
|
2583
|
-
drop(I,
|
|
2584
|
-
P(
|
|
2585
|
-
const _ = S.duration ?? 250, V =
|
|
2583
|
+
drop(I, N, C, S) {
|
|
2584
|
+
P(N);
|
|
2585
|
+
const _ = S.duration ?? 250, V = N === I.line, ee = S.easing ?? (V ? "linear" : "ease-out"), F = q.landing(I, N, C, S.at), Q = { id: m.length + 1, line: N, column: C, chars: I.text.length, at: S.at };
|
|
2586
2586
|
return m.push(Q), x[`insert.${Q.id}.open`] = 0, A(`insert.${Q.id}.open`, 0, 1, { at: S.at, duration: _, easing: V ? ee : "ease-out" }), A(`piece.${I.id}.away`, k(`piece.${I.id}.away`, 0), 1, { at: S.at, duration: _, easing: V ? ee : "ease-in-out" }), b.cutAfter(I, S.at), q.move(I, { at: S.at, duration: _, easing: ee, to: { x: F.x, y: F.y } }), A(`piece.${I.id}.rotate`, g.valueAt(`piece.${I.id}.rotate`, S.at), 0, { at: S.at, duration: _ }), q;
|
|
2587
2587
|
},
|
|
2588
|
-
landing(I,
|
|
2589
|
-
const _ = q.spot(
|
|
2588
|
+
landing(I, N, C, S = 1 / 0) {
|
|
2589
|
+
const _ = q.spot(N, C, I.text.length, S), V = N === I.line && C > I.column ? I.text.length * a : 0;
|
|
2590
2590
|
return w(_.left - V, _.top, _.width, _.height);
|
|
2591
2591
|
},
|
|
2592
|
-
ride(I,
|
|
2592
|
+
ride(I, N, C) {
|
|
2593
2593
|
const S = t.map((_, V) => {
|
|
2594
2594
|
const ee = g.keys(`line.${V + 1}.shift`) ?? [];
|
|
2595
2595
|
return { top: E(V + 1), offset: (F) => -yo(ee, F) * r, windows: Pt(ee) };
|
|
2596
2596
|
});
|
|
2597
|
-
return bo(I,
|
|
2597
|
+
return bo(I, N, { ground: C.ground, every: C.every ?? Ye, floors: S });
|
|
2598
2598
|
},
|
|
2599
2599
|
tracks: g.tracks,
|
|
2600
|
-
anchor(I,
|
|
2601
|
-
const
|
|
2602
|
-
return
|
|
2603
|
-
},
|
|
2604
|
-
edit(I,
|
|
2605
|
-
const S = () => Y(I,
|
|
2606
|
-
if (I === "highlight") return q.highlight(S(),
|
|
2607
|
-
if (I === "strike") return q.strike(S(),
|
|
2608
|
-
if (I === "remove") return q.remove(S(),
|
|
2600
|
+
anchor(I, N = 1 / 0) {
|
|
2601
|
+
const C = G(I);
|
|
2602
|
+
return C.kind === "box" ? q.box : C.kind === "line" ? q.line(C.n, N) : C.kind === "token" ? q.token(C.n, C.text, C.occurrence, N) : q.spot(C.n, C.column, C.width, N);
|
|
2603
|
+
},
|
|
2604
|
+
edit(I, N, C) {
|
|
2605
|
+
const S = () => Y(I, N, "line").map((_) => _.n);
|
|
2606
|
+
if (I === "highlight") return q.highlight(S(), C);
|
|
2607
|
+
if (I === "strike") return q.strike(S(), C);
|
|
2608
|
+
if (I === "remove") return q.remove(S(), C);
|
|
2609
2609
|
if (I === "type") {
|
|
2610
|
-
for (const _ of S()) q.type(_,
|
|
2610
|
+
for (const _ of S()) q.type(_, C);
|
|
2611
2611
|
return q;
|
|
2612
2612
|
}
|
|
2613
2613
|
if (I === "insert") {
|
|
2614
|
-
const [_] = Y(I,
|
|
2615
|
-
return q.insert(_.n, _.column, se(I,
|
|
2614
|
+
const [_] = Y(I, N, "spot", !0);
|
|
2615
|
+
return q.insert(_.n, _.column, se(I, C), C);
|
|
2616
2616
|
}
|
|
2617
2617
|
if (I === "write" || I === "drop" || I === "move" || I === "fling") {
|
|
2618
|
-
const [_] = Y(I,
|
|
2619
|
-
if (I === "write") return q.write(V, se(I,
|
|
2620
|
-
if (I === "fling") return q.fling(V,
|
|
2618
|
+
const [_] = Y(I, N, "token", !0), V = q.piece(_.n, _.text, _.occurrence);
|
|
2619
|
+
if (I === "write") return q.write(V, se(I, C), C);
|
|
2620
|
+
if (I === "fling") return q.fling(V, C);
|
|
2621
2621
|
if (I === "drop") {
|
|
2622
|
-
const F = typeof
|
|
2622
|
+
const F = typeof C.into == "string" ? G(C.into) : void 0;
|
|
2623
2623
|
if (F?.kind !== "spot") throw new Error("codePanel.edit: drop needs `into`, a spot anchor (spot:N:C)");
|
|
2624
|
-
return q.drop(V, F.n, F.column,
|
|
2624
|
+
return q.drop(V, F.n, F.column, C);
|
|
2625
2625
|
}
|
|
2626
|
-
const ee = typeof
|
|
2626
|
+
const ee = typeof C.to == "string" ? q.anchor(C.to, C.at) : C.to;
|
|
2627
2627
|
if (!ee || typeof ee.x != "number" || typeof ee.y != "number") throw new Error("codePanel.edit: move needs `to`, an anchor name or { x, y }");
|
|
2628
|
-
return q.move(V, { ...
|
|
2628
|
+
return q.move(V, { ...C, to: ee });
|
|
2629
2629
|
}
|
|
2630
2630
|
throw fs("codePanel", I, Gt);
|
|
2631
2631
|
}
|
|
@@ -2764,7 +2764,7 @@ const Ms = '"Patrick Hand", "Segoe Print", "Bradley Hand", "Comic Sans MS", "Cha
|
|
|
2764
2764
|
opacity: 1,
|
|
2765
2765
|
rule: { color: "#c9d6ec", spacing: 1.55, margin: "#f0a3a3" }
|
|
2766
2766
|
}
|
|
2767
|
-
}, Vo = ["circle", "box", "underline", "arrow"],
|
|
2767
|
+
}, Vo = ["circle", "box", "underline", "arrow"], Ce = {
|
|
2768
2768
|
kind: "board",
|
|
2769
2769
|
create: "whiteboard({ x, y, width, height, theme?: whiteboard | chalkboard | lines, fontSize?, items: [{ id, text, at: [x, y], size?, color?, hidden? } | { id, mark: circle | box | underline | arrow, around? | from?, to?, bend?, color?, hidden? }] })",
|
|
2770
2770
|
anchors: {
|
|
@@ -2787,14 +2787,14 @@ function Ld(e) {
|
|
|
2787
2787
|
if (!(s in Rt)) throw new Error(`whiteboard: ${fe("theme", s, Object.keys(Rt))}`);
|
|
2788
2788
|
const t = typeof e.theme == "object" ? { ...Rt.whiteboard, ...e.theme } : Rt[s], o = e.fontSize ?? 28, r = e.charWidth ?? 0.55, a = (m) => m === void 0 ? t.ink : t.colors[m] ?? m, n = (m) => me(e.x + m.left, e.y + m.top, m.width, m.height), i = It(), h = ds(i), c = {}, l = /* @__PURE__ */ new Map(), d = [], f = [], u = (m, P, A, k) => {
|
|
2789
2789
|
const y = l.get(m);
|
|
2790
|
-
if (!y || y.kind !== "text") throw Ue("whiteboard", k,
|
|
2790
|
+
if (!y || y.kind !== "text") throw Ue("whiteboard", k, Ce, `there is no text "${m}" (texts: ${p().join(", ") || "none"})`);
|
|
2791
2791
|
let v = -1;
|
|
2792
2792
|
for (let E = 0; E < A; E++)
|
|
2793
|
-
if (v = y.item.text.indexOf(P, v + 1), v < 0) throw Ue("whiteboard", k,
|
|
2793
|
+
if (v = y.item.text.indexOf(P, v + 1), v < 0) throw Ue("whiteboard", k, Ce, `text "${m}" has no ${A > 1 ? `${A}th ` : ""}"${P}"`);
|
|
2794
2794
|
const w = y.size * r;
|
|
2795
2795
|
return { column: v, box: me(y.box.left + v * w, y.box.top, P.length * w, y.box.height) };
|
|
2796
2796
|
}, p = () => [...l.values()].filter((m) => m.kind === "text").map((m) => m.item.id), g = (m) => {
|
|
2797
|
-
const { kind: P, rest: A } = pt(m), k = (y) => Ue("whiteboard", m,
|
|
2797
|
+
const { kind: P, rest: A } = pt(m), k = (y) => Ue("whiteboard", m, Ce, y);
|
|
2798
2798
|
if (P === "box") {
|
|
2799
2799
|
if (A) throw k("box takes no arguments");
|
|
2800
2800
|
return { kind: P };
|
|
@@ -2816,7 +2816,7 @@ function Ld(e) {
|
|
|
2816
2816
|
const A = l.get(P.id);
|
|
2817
2817
|
if (!A || A.kind !== P.kind) {
|
|
2818
2818
|
const k = [...l.values()].filter((y) => y.kind === P.kind).map((y) => y.item.id);
|
|
2819
|
-
throw Ue("whiteboard", m,
|
|
2819
|
+
throw Ue("whiteboard", m, Ce, `there is no ${P.kind} "${P.id}" (${P.kind}s: ${k.join(", ") || "none"})`);
|
|
2820
2820
|
}
|
|
2821
2821
|
return A.box;
|
|
2822
2822
|
};
|
|
@@ -2848,7 +2848,7 @@ function Ld(e) {
|
|
|
2848
2848
|
get props() {
|
|
2849
2849
|
return Sl(Object.keys(c));
|
|
2850
2850
|
},
|
|
2851
|
-
actions:
|
|
2851
|
+
actions: Ce.edits
|
|
2852
2852
|
},
|
|
2853
2853
|
draw(m, P) {
|
|
2854
2854
|
const A = P.props ?? {}, k = (y) => Number(A[y] ?? c[y] ?? 0);
|
|
@@ -2897,7 +2897,7 @@ function Ld(e) {
|
|
|
2897
2897
|
}
|
|
2898
2898
|
}, M = {
|
|
2899
2899
|
kind: "board",
|
|
2900
|
-
about:
|
|
2900
|
+
about: Ce,
|
|
2901
2901
|
target: H,
|
|
2902
2902
|
box: me(e.x, e.y, e.width, e.height),
|
|
2903
2903
|
anchor(m) {
|
|
@@ -2967,7 +2967,7 @@ function Ld(e) {
|
|
|
2967
2967
|
}
|
|
2968
2968
|
if (m === "fling")
|
|
2969
2969
|
return v(["term"], !0), M.fling(w(), A);
|
|
2970
|
-
throw fs("whiteboard", m,
|
|
2970
|
+
throw fs("whiteboard", m, Ce);
|
|
2971
2971
|
},
|
|
2972
2972
|
follow(m, P) {
|
|
2973
2973
|
return h.follow(m, P), M;
|
|
@@ -3183,11 +3183,11 @@ function qd(e) {
|
|
|
3183
3183
|
q.set(z.id, me($ - te, M, te, g * 1.4)), $ -= te + g * 0.6;
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
3186
|
-
const I = It(),
|
|
3186
|
+
const I = It(), N = ds(I), C = {}, S = ($, z, U) => a ? `${f}.${$}.${z}.${U}` : `${f}.${$}.${U}`;
|
|
3187
3187
|
for (const $ of e.data)
|
|
3188
3188
|
for (const z of n)
|
|
3189
|
-
|
|
3190
|
-
const _ = ($, z) => I.keys($)?.length ? yo(I.keys($), z) :
|
|
3189
|
+
C[S($.id, z.id, "value")] = d($, z), C[S($.id, z.id, "show")] = $.hidden ? 0 : 1, C[S($.id, z.id, "highlight")] = 0, r && (C[S($.id, z.id, "pull")] = 0);
|
|
3190
|
+
const _ = ($, z) => I.keys($)?.length ? yo(I.keys($), z) : C[$], V = ($, z, U) => _(S($, z, "value"), U) * (o === "bar" ? _(S($, z, "show"), U) : 1) * w, ee = ($) => {
|
|
3191
3191
|
const z = n[0].id, U = e.data.map((L) => Math.max(0, $(S(L.id, z, "value"))) * Math.max(0, Math.min(1, $(S(L.id, z, "show"))))), te = U.reduce((L, R) => L + R, 0), B = /* @__PURE__ */ new Map();
|
|
3192
3192
|
let le = -Math.PI / 2;
|
|
3193
3193
|
return e.data.forEach((L, R) => {
|
|
@@ -3244,15 +3244,15 @@ function qd(e) {
|
|
|
3244
3244
|
y: e.y,
|
|
3245
3245
|
width: e.width,
|
|
3246
3246
|
height: e.height,
|
|
3247
|
-
props:
|
|
3247
|
+
props: C,
|
|
3248
3248
|
about: {
|
|
3249
3249
|
kind: `${o} chart`,
|
|
3250
3250
|
summary: `A ${o} chart of ${e.data.length} values (${e.data.map(($) => $.id).join(", ")})${a ? ` in ${n.length} series (${n.map(($) => $.id).join(", ")})` : ""}${r ? "" : `, scaled to ${p}`}. Its ${f}s and labels are places in the scene (anchor()); its edits record tracks (edit(), tracks()).`,
|
|
3251
|
-
props: Object.fromEntries(Object.keys(
|
|
3251
|
+
props: Object.fromEntries(Object.keys(C).map(($) => [$, xl($)])),
|
|
3252
3252
|
actions: nt.edits
|
|
3253
3253
|
},
|
|
3254
3254
|
draw($, z) {
|
|
3255
|
-
const U = z.props ?? {}, te = (L) => Number(U[L] ??
|
|
3255
|
+
const U = z.props ?? {}, te = (L) => Number(U[L] ?? C[L] ?? 0);
|
|
3256
3256
|
if ($.save(), $.fillStyle = t.background, nn($, 0, 0, e.width, e.height, 8), $.fill(), $.font = `${g}px ${t.font}`, $.textBaseline = "middle", e.title && ($.fillStyle = t.text, $.textAlign = "left", $.font = `600 ${g * 1.2}px ${t.font}`, $.fillText(e.title, r ? g : m.left, g * 1.5), $.font = `${g}px ${t.font}`), b) {
|
|
3257
3257
|
$.textAlign = "left";
|
|
3258
3258
|
for (const L of n) {
|
|
@@ -3335,8 +3335,8 @@ function qd(e) {
|
|
|
3335
3335
|
if (U) return U;
|
|
3336
3336
|
const te = { id: Z.size + 1, datum: z.id, home: X(ae(z, 0)) };
|
|
3337
3337
|
Z.set(z.id, te);
|
|
3338
|
-
for (const B of ["x", "y", "rotate"])
|
|
3339
|
-
return
|
|
3338
|
+
for (const B of ["x", "y", "rotate"]) C[`piece.${te.id}.${B}`] = 0;
|
|
3339
|
+
return C[`piece.${te.id}.opacity`] = 1, te;
|
|
3340
3340
|
},
|
|
3341
3341
|
edit($, z, U) {
|
|
3342
3342
|
const te = Array.isArray(z) ? z : [z];
|
|
@@ -3358,13 +3358,13 @@ function qd(e) {
|
|
|
3358
3358
|
return ie;
|
|
3359
3359
|
},
|
|
3360
3360
|
follow($, z) {
|
|
3361
|
-
return
|
|
3361
|
+
return N.follow($, z), ie;
|
|
3362
3362
|
},
|
|
3363
3363
|
fling($, z) {
|
|
3364
|
-
return
|
|
3364
|
+
return N.fling($, z), ie;
|
|
3365
3365
|
},
|
|
3366
3366
|
move($, z) {
|
|
3367
|
-
return
|
|
3367
|
+
return N.move($, z), ie;
|
|
3368
3368
|
},
|
|
3369
3369
|
ride($, z, U) {
|
|
3370
3370
|
if (o !== "bar") return $;
|
|
@@ -3821,7 +3821,7 @@ function Jd(e, s, t, o = {}) {
|
|
|
3821
3821
|
};
|
|
3822
3822
|
return { helper: l, sitter: u, point: h, reached: g(e, l) && g(s, u) };
|
|
3823
3823
|
}
|
|
3824
|
-
const Kl = 0.7,
|
|
3824
|
+
const Kl = 0.7, Nl = 50, Cl = 1.2, Rl = 0.8, Wl = 3, zl = 30, Fl = 0.8, Dl = 0.6, As = (e, s) => Math.max(-s, Math.min(s, e)), Ll = ["hair.swing", "hair.trail", "hair.lift"];
|
|
3825
3825
|
function ql(e, s) {
|
|
3826
3826
|
const t = s.start ?? 0, o = s.amount ?? 1, r = Math.max(1e-6, s.headRadius);
|
|
3827
3827
|
let a = NaN, n = { x: 0, y: 0, turn: 0 };
|
|
@@ -3833,8 +3833,8 @@ function ql(e, s) {
|
|
|
3833
3833
|
const g = i(u.time), b = u.value - h(u.time), T = d[p].value - g.x - (s.wind ?? 0) * Kl * r, H = f[p].value - g.y, M = Math.sin(g.turn * Math.PI / 2), m = Math.cos(g.turn * Math.PI / 2), P = b * Wl + T * m / r * zl, A = -T * M / r * Fl, k = -H / r * Dl;
|
|
3834
3834
|
return {
|
|
3835
3835
|
time: u.time,
|
|
3836
|
-
swing: As(P * o,
|
|
3837
|
-
trail: As(A * o,
|
|
3836
|
+
swing: As(P * o, Nl),
|
|
3837
|
+
trail: As(A * o, Cl),
|
|
3838
3838
|
lift: As(k * o, Rl)
|
|
3839
3839
|
};
|
|
3840
3840
|
});
|
|
@@ -4647,11 +4647,11 @@ function vo(e, s, t = {}) {
|
|
|
4647
4647
|
}
|
|
4648
4648
|
if (S.say) {
|
|
4649
4649
|
const K = n(S.do) || An(S.do) || ae ? _ : _ + Math.min(150, (V - _) / 4), X = n(S.do) ? V : Math.max(K + 200, V - 100);
|
|
4650
|
-
v.push({ text: S.say, start: K, end: X }), S.do === "say" &&
|
|
4650
|
+
v.push({ text: S.say, start: K, end: X }), S.do === "say" && Ch(H, g, K, X);
|
|
4651
4651
|
}
|
|
4652
4652
|
S.onto !== void 0 && S.do !== "leap" && S.onto !== u && (m.push({ time: _, value: u - l }, { time: V, value: S.onto - l, easing: "ease-in-out" }), u = S.onto), V > H[H.length - 1].time && H.push({ time: V, pose: g }), w.push({ start: _, end: V, ...ee !== void 0 ? { contact: ee } : {}, ...F !== void 0 ? { release: F } : {} }), T = V;
|
|
4653
4653
|
}
|
|
4654
|
-
const
|
|
4654
|
+
const N = sh(e, Nh(H), t), C = [
|
|
4655
4655
|
{ id: `${e}-x`, target: e, property: "x", keyframes: M },
|
|
4656
4656
|
{ id: `${e}-y`, target: e, property: "y", keyframes: m },
|
|
4657
4657
|
{ id: `${e}-walk`, target: e, property: "walk", keyframes: P },
|
|
@@ -4663,7 +4663,7 @@ function vo(e, s, t = {}) {
|
|
|
4663
4663
|
S.property === "facing" && S.keyframes[0].value === -1
|
|
4664
4664
|
);
|
|
4665
4665
|
return {
|
|
4666
|
-
tracks: [...mo(e,
|
|
4666
|
+
tracks: [...mo(e, N, v, { energy: t.energy }), ...C],
|
|
4667
4667
|
duration: T,
|
|
4668
4668
|
lines: v,
|
|
4669
4669
|
keys: H,
|
|
@@ -4672,7 +4672,7 @@ function vo(e, s, t = {}) {
|
|
|
4672
4672
|
};
|
|
4673
4673
|
}
|
|
4674
4674
|
const _h = (e) => Math.max(-1, Math.min(1, e)), Kh = 30;
|
|
4675
|
-
function
|
|
4675
|
+
function Nh(e) {
|
|
4676
4676
|
const s = [];
|
|
4677
4677
|
for (const t of e) {
|
|
4678
4678
|
const o = s[s.length - 1];
|
|
@@ -4680,7 +4680,7 @@ function Ch(e) {
|
|
|
4680
4680
|
}
|
|
4681
4681
|
return s;
|
|
4682
4682
|
}
|
|
4683
|
-
function
|
|
4683
|
+
function Ch(e, s, t, o) {
|
|
4684
4684
|
const a = e.filter((h) => h.time > t), n = e.filter((h) => h.time <= t), i = [];
|
|
4685
4685
|
for (let h = t + 520, c = 0; h < o - 520 / 2; h += 520, c++) {
|
|
4686
4686
|
const l = c % 2 === 0 ? 3 : -2;
|
|
@@ -4688,7 +4688,7 @@ function Nh(e, s, t, o) {
|
|
|
4688
4688
|
}
|
|
4689
4689
|
i.length > 0 && i.push({ time: o, pose: s }), e.length = 0, e.push(...n, ...i.filter((h) => !a.some((c) => Math.abs(c.time - h.time) < 60)), ...a), e.sort((h, c) => h.time - c.time);
|
|
4690
4690
|
}
|
|
4691
|
-
function
|
|
4691
|
+
function Na(e, s, t) {
|
|
4692
4692
|
const o = new ve({ id: `${e}-hand`, tracks: s.filter((h) => h.target === e) }), r = Zn({ x: t.x, y: t.y, style: t.style, cast: t.cast }), a = t.side ?? "right", n = t.every ?? 33, i = [];
|
|
4693
4693
|
for (let h = t.start; ; h = Math.min(t.end, h + n)) {
|
|
4694
4694
|
const { joints: c } = Jn(r, { time: h, state: o.getStateAtTime(h) }, e), l = c.hands[a], d = c.fingertips[a];
|
|
@@ -4703,7 +4703,7 @@ function nf(e, s, t, o = {}) {
|
|
|
4703
4703
|
throw new Error(`surfaceScript: ${r.length} problem(s) in the beats:
|
|
4704
4704
|
${r.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
|
|
4705
4705
|
`)}`);
|
|
4706
|
-
const a = t.map((f) =>
|
|
4706
|
+
const a = t.map((f) => Ca(f, s)), n = vo(e, a, o), i = Dh(a, n.beats, o), h = o.ground ?? 0, c = (f) => o.ride === !1 ? f : Object.values(s).reduce((u, p) => p.ride(u, e, { ground: h }), f);
|
|
4707
4707
|
t.forEach((f, u) => {
|
|
4708
4708
|
for (const p of zh(f)) {
|
|
4709
4709
|
const g = (m) => new Error(`surfaceScript: beat ${u} (${f.do}), ${p.edit} on ${p.surface}: ${m}`), b = (m, P) => {
|
|
@@ -4717,7 +4717,7 @@ ${r.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
|
|
|
4717
4717
|
if (M !== void 0 && M < H) throw g(`it ends (${M} ms) before it starts (${H} ms)`);
|
|
4718
4718
|
try {
|
|
4719
4719
|
if (p.edit === "carry") {
|
|
4720
|
-
const P = T.piece(p.anchor), A =
|
|
4720
|
+
const P = T.piece(p.anchor), A = Na(e, c(n.tracks), {
|
|
4721
4721
|
x: o.from ?? 0,
|
|
4722
4722
|
y: h,
|
|
4723
4723
|
style: o.figureStyle ?? (o.height ? { height: o.height } : void 0),
|
|
@@ -4786,10 +4786,10 @@ function Fh(e, s, t = {}) {
|
|
|
4786
4786
|
p.edit === "carry" && typeof p.anchor != "string" && o.push({ level: "error", beat: l, message: `${b}: \`carry\` takes one anchor, the piece it carries.` }), p.edit === "carry" && p.until === void 0 && o.push({ level: "error", beat: l, message: `${b}: \`carry\` needs \`until\` (when it lets go, such as { beat: ${l + 1}, at: 'release' }).` }), p.at !== void 0 && i(l, p.at, `${b} \`at\``), p.until !== void 0 && i(l, p.until, `${b} \`until\``), p.until !== void 0 && p.duration !== void 0 && o.push({ level: "error", beat: l, message: `${b}: give \`until\` or \`duration\`, not both.` });
|
|
4787
4787
|
});
|
|
4788
4788
|
});
|
|
4789
|
-
const h = e.map((c) => c && typeof c == "object" && !Array.isArray(c) ?
|
|
4789
|
+
const h = e.map((c) => c && typeof c == "object" && !Array.isArray(c) ? Ca(c, s, !0) : c);
|
|
4790
4790
|
return [...as(h, t), ...o];
|
|
4791
4791
|
}
|
|
4792
|
-
function
|
|
4792
|
+
function Ca(e, s, t = !1) {
|
|
4793
4793
|
const { then: o, ...r } = e, a = (i) => {
|
|
4794
4794
|
try {
|
|
4795
4795
|
return s[i.surface].anchor(i.anchor, 0);
|
|
@@ -4844,7 +4844,7 @@ function af(e) {
|
|
|
4844
4844
|
energy: e.energy
|
|
4845
4845
|
}),
|
|
4846
4846
|
check: (d) => as(d, s),
|
|
4847
|
-
handPath: (d, f, u) =>
|
|
4847
|
+
handPath: (d, f, u) => Na(d, f, { ...u, style: c, cast: s }),
|
|
4848
4848
|
describe: () => ({
|
|
4849
4849
|
name: e.name,
|
|
4850
4850
|
summary: l,
|
|
@@ -5155,13 +5155,13 @@ function Mo(e, s) {
|
|
|
5155
5155
|
for (const n of e.parts) a(n);
|
|
5156
5156
|
return o;
|
|
5157
5157
|
}
|
|
5158
|
-
const
|
|
5158
|
+
const Ns = (() => {
|
|
5159
5159
|
const e = [-0.45, 0.75, 0.5], s = Math.hypot(...e);
|
|
5160
5160
|
return [e[0] / s, e[1] / s, e[2] / s];
|
|
5161
5161
|
})(), fc = Math.cos(35 * Zs);
|
|
5162
5162
|
function Da(e, s, t, o, r = {}) {
|
|
5163
5163
|
const a = e.derive ? { ...s, ...e.derive(s) } : s, n = Mo(e, a), i = t.toView([0, 0, 0]), h = (x) => (W) => [x[0] * W[0] + x[4] * W[1] + x[8] * W[2], x[1] * W[0] + x[5] * W[1] + x[9] * W[2], x[2] * W[0] + x[6] * W[1] + x[10] * W[2]], c = Ot(e, a), l = r.slice === void 0 ? null : oe.invert(c), d = l ? e.parts.map((x) => ({ part: x, mesh: Ut(x.shape), local: oe.multiply(l, n.get(x.id)), whole: x.shape.type === "tube" })) : void 0, f = d ? lc(d, r.slice) : void 0, u = d ? za(d.map((x) => ({ part: x.part.id, mesh: x.mesh, ...So(x.mesh, x.local) }))) : void 0, p = (x, W, G, Y) => {
|
|
5164
|
-
const se = (R) => t.toView(oe.transformPoint(G, R)), q = W.vertices.map(se), I = q.map((R) => t.toScreen(R)),
|
|
5164
|
+
const se = (R) => t.toView(oe.transformPoint(G, R)), q = W.vertices.map(se), I = q.map((R) => t.toScreen(R)), N = r.perspective ? r.near : void 0, C = (R) => R.map((J) => t.toScreen(J)), S = (R) => N === void 0 ? R : Pn(R, N), _ = (R) => N === void 0 ? [R] : tc(R, N), V = h(G), ee = W.faces.map((R) => {
|
|
5165
5165
|
const J = t.toView(V(R.normal)), he = [J[0] - i[0], J[1] - i[1], J[2] - i[2]], de = Math.hypot(...he) || 1;
|
|
5166
5166
|
return [he[0] / de, he[1] / de, he[2] / de];
|
|
5167
5167
|
}), F = u && Y ? Fa(x.id, W, Y, Ra(Y), u) : void 0, Q = (R) => F?.[R] ?? !1, ae = ee.map((R, J) => {
|
|
@@ -5172,9 +5172,9 @@ function Da(e, s, t, o, r = {}) {
|
|
|
5172
5172
|
}), K = (R) => W.faces[R].corners.reduce((J, he) => J + q[he][2], 0) / W.faces[R].corners.length, X = W.faces.map((R, J) => ({ face: R, i: J })).filter(({ i: R }) => ae[R]).map(({ face: R, i: J }) => ({
|
|
5173
5173
|
i: J,
|
|
5174
5174
|
solved: {
|
|
5175
|
-
points:
|
|
5175
|
+
points: N === void 0 ? R.corners.map((he) => I[he]) : C(S(R.corners.map((he) => q[he]))),
|
|
5176
5176
|
depth: K(J),
|
|
5177
|
-
tone: 0.72 + 0.33 * Math.max(0, ee[J][0] *
|
|
5177
|
+
tone: 0.72 + 0.33 * Math.max(0, ee[J][0] * Ns[0] + ee[J][1] * Ns[1] + ee[J][2] * Ns[2])
|
|
5178
5178
|
}
|
|
5179
5179
|
})).filter((R) => R.solved.points.length >= 3).sort((R, J) => R.solved.depth - J.solved.depth);
|
|
5180
5180
|
if (r.light) {
|
|
@@ -5194,12 +5194,12 @@ function Da(e, s, t, o, r = {}) {
|
|
|
5194
5194
|
const de = J.length === 2 && he === 2 && W.creases !== !1 && ee[J[0]][0] * ee[J[1]][0] + ee[J[0]][1] * ee[J[1]][1] + ee[J[0]][2] * ee[J[1]][2] < fc;
|
|
5195
5195
|
J.length === 1 && (W.joined || mc(W, R)) || (J.length === 1 || he === 1 || de) && (ne.push(R.split("-").map(Number)), re.push(J.filter((pe) => ae[pe]).reduce((pe, ge) => K(ge) > K(pe) ? ge : pe)));
|
|
5196
5196
|
}
|
|
5197
|
-
const ie = (R) => W.faces.findIndex((J) => J.corners.length > 4 && Math.sign(bc(W.vertices[R], J.normal)) > 0), $ = (W.marks ?? []).filter(([R]) => ie(R) < 0 || ae[ie(R)]), z = ([R, J]) =>
|
|
5197
|
+
const ie = (R) => W.faces.findIndex((J) => J.corners.length > 4 && Math.sign(bc(W.vertices[R], J.normal)) > 0), $ = (W.marks ?? []).filter(([R]) => ie(R) < 0 || ae[ie(R)]), z = ([R, J]) => N === void 0 ? [[I[R], I[J]]] : _([q[R], q[J]]).map(C), U = $.flatMap(z), te = (R) => N === void 0 ? [R.map((J) => I[J])] : _(R.map((J) => q[J])).map(C);
|
|
5198
5198
|
if (r.slice !== void 0) {
|
|
5199
5199
|
const R = /* @__PURE__ */ new Map();
|
|
5200
5200
|
ne.forEach((J, he) => R.set(re[he], [...R.get(re[he]) ?? [], J]));
|
|
5201
5201
|
for (const { i: J, solved: he } of X) {
|
|
5202
|
-
he.edges =
|
|
5202
|
+
he.edges = Nn(R.get(J) ?? []).flatMap(te);
|
|
5203
5203
|
const de = W.faces[J].corners;
|
|
5204
5204
|
he.center = de.reduce((ge, Me) => [ge[0] + q[Me][0] / de.length, ge[1] + q[Me][1] / de.length, ge[2] + q[Me][2] / de.length], [0, 0, 0]), he.normal = ee[J];
|
|
5205
5205
|
const pe = X[X.length - 1].i;
|
|
@@ -5211,11 +5211,11 @@ function Da(e, s, t, o, r = {}) {
|
|
|
5211
5211
|
part: x,
|
|
5212
5212
|
depth: q.reduce((R, J) => R + J[2], 0) / Math.max(1, q.length),
|
|
5213
5213
|
faces: D,
|
|
5214
|
-
edges:
|
|
5214
|
+
edges: Nn(ne).flatMap(te),
|
|
5215
5215
|
marks: U,
|
|
5216
5216
|
glow: B,
|
|
5217
5217
|
opacity: L,
|
|
5218
|
-
...x.shape.type === "tube" ? { spine: yc(_(x.shape.points.map(se)).map(
|
|
5218
|
+
...x.shape.type === "tube" ? { spine: yc(_(x.shape.points.map(se)).map(C)) } : {},
|
|
5219
5219
|
...W.walls ? { cut: !0 } : {}
|
|
5220
5220
|
};
|
|
5221
5221
|
}, g = new Map(d?.map((x) => [x.part.id, x.local])), T = (f ? f.pieces.map((x) => ({
|
|
@@ -5301,7 +5301,7 @@ function yc(e) {
|
|
|
5301
5301
|
return e.reduce((s, t) => !s || t.length > s.length ? t : s, void 0);
|
|
5302
5302
|
}
|
|
5303
5303
|
const bc = (e, s) => e[0] * s[0] + e[1] * s[1] + e[2] * s[2];
|
|
5304
|
-
function
|
|
5304
|
+
function Nn(e) {
|
|
5305
5305
|
const s = e.map((o) => [...o]), t = [];
|
|
5306
5306
|
for (; s.length > 0; ) {
|
|
5307
5307
|
const o = [...s.shift()];
|
|
@@ -5468,12 +5468,12 @@ function hf(e, s = {}) {
|
|
|
5468
5468
|
if (O.size === 0) return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
|
|
5469
5469
|
return j(O, `the parts control "${y.name}" moves are`);
|
|
5470
5470
|
function j(x, W) {
|
|
5471
|
-
const G = [...E.under, ...E.over].filter((
|
|
5471
|
+
const G = [...E.under, ...E.over].filter((N) => x.has(N.part.id)).flatMap((N) => N.faces.flatMap((C) => C.points));
|
|
5472
5472
|
if (G.length === 0) {
|
|
5473
|
-
const
|
|
5474
|
-
throw new Error(`${t.kind}: ${W} turned away from the viewer ${
|
|
5473
|
+
const N = Number.isFinite(k) ? `at ${k} ms` : "after its edits";
|
|
5474
|
+
throw new Error(`${t.kind}: ${W} turned away from the viewer ${N}; aim at an anchor (${a.map((C) => `anchor:${C}`).join(", ") || "none"}) or box`);
|
|
5475
5475
|
}
|
|
5476
|
-
const Y = G.map((
|
|
5476
|
+
const Y = G.map((N) => N.x), se = G.map((N) => N.y), q = Math.min(...Y), I = Math.min(...se);
|
|
5477
5477
|
return me(w.x + q, w.y + I, Math.max(...Y) - q, Math.max(...se) - I);
|
|
5478
5478
|
}
|
|
5479
5479
|
}, m = (A, k) => {
|
|
@@ -5718,7 +5718,7 @@ function qt(e, s, t, o, r, a, n = !1) {
|
|
|
5718
5718
|
const i = e.facing() || Math.sign(o - e.x) || 1, h = e.values.wheelSpin ?? 0, c = (o - e.x) * i / e.scale;
|
|
5719
5719
|
e.set("wheelSpin", s, h), e.move(s, t, o, { easing: r }), e.set("wheelSpin", t, n ? h : h + c / a * (180 / Math.PI), r);
|
|
5720
5720
|
}
|
|
5721
|
-
const
|
|
5721
|
+
const Cn = 0.4;
|
|
5722
5722
|
function $c(e) {
|
|
5723
5723
|
const s = e.wheels[0]?.radius ?? 0.4, { forwardMost: t, backMost: o } = Ba(e), r = (t - o) / 2, a = (i, h, c) => {
|
|
5724
5724
|
const l = i.exaggeration;
|
|
@@ -5736,7 +5736,7 @@ function $c(e) {
|
|
|
5736
5736
|
run(i, h, c) {
|
|
5737
5737
|
const l = Math.sign(h.to - i.x);
|
|
5738
5738
|
if (l === 0) return { end: c };
|
|
5739
|
-
const d = a(i, c, l), f = i.exaggeration, u = Math.abs(h.to - i.x), p = h.for ?? Math.max(500, u / (h.speed ??
|
|
5739
|
+
const d = a(i, c, l), f = i.exaggeration, u = Math.abs(h.to - i.x), p = h.for ?? Math.max(500, u / (h.speed ?? Cn));
|
|
5740
5740
|
return i.effect({ kind: "dust", time: d, x: i.x - l * r * i.scale, y: i.floor, length: 600, direction: -l }), i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.05 * f, lean: 0.12 * f }, { act: !1, easing: "ease-out" }), i.key(d + Math.max(160, p - 160), { pitch: 0, lean: 0.08 * f, squash: 1.02 }, { act: !1 }), qt(i, d, d + p, h.to, "ease-in-out", s), n(i, d + p, !1), { end: d + p + 380, contact: d, release: d + p };
|
|
5741
5741
|
}
|
|
5742
5742
|
},
|
|
@@ -5747,7 +5747,7 @@ function $c(e) {
|
|
|
5747
5747
|
run(i, h, c) {
|
|
5748
5748
|
const l = Math.sign(h.to - i.x);
|
|
5749
5749
|
if (l === 0) return { end: c };
|
|
5750
|
-
const d = a(i, c, l), f = i.exaggeration, u = i.x, p = Math.abs(h.to - u), g = h.for ?? Math.max(600, p / (h.speed ??
|
|
5750
|
+
const d = a(i, c, l), f = i.exaggeration, u = i.x, p = Math.abs(h.to - u), g = h.for ?? Math.max(600, p / (h.speed ?? Cn * 1.2)), b = d + g * 0.55, T = u + (h.to - u) * 0.65;
|
|
5751
5751
|
return i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.06 * f, lean: 0.14 * f }, { act: !1, easing: "ease-out" }), qt(i, d, b, T, "ease-in", s), i.key(b + 80, { pitch: -7 * f, lean: -0.12 * f, squash: 0.94 }, { act: !1, easing: "ease-out" }), qt(i, b, d + g, h.to, "ease-out", s, !0), i.effect({ kind: "skid", time: b, x: T, toX: h.to, y: i.floor, length: g * 0.45 + 1500 }), i.effect({ kind: "dust", time: d + g, x: h.to + l * r * i.scale, y: i.floor, length: 600, direction: l }), n(i, d + g, !0), { end: d + g + 380, contact: b, release: d + g };
|
|
5752
5752
|
}
|
|
5753
5753
|
},
|
|
@@ -6030,7 +6030,7 @@ function Kc() {
|
|
|
6030
6030
|
}
|
|
6031
6031
|
};
|
|
6032
6032
|
}
|
|
6033
|
-
function
|
|
6033
|
+
function Nc(e = {}) {
|
|
6034
6034
|
const s = e.width ?? 4, t = e.depth ?? 3.2, o = e.wallHeight ?? 2.5, r = e.roofHeight ?? 1.5, a = e.overhang ?? 0.25, n = { walls: "#f1d9a8", roof: "#b8433a", door: "#7a4b2a", doorway: "#3a2a22", glass: "#bfe3f2", lit: "#ffd66b", chimney: "#9b5a45", ...e.colors }, i = t / 2 + 0.01, h = e.door?.width ?? 0.9, c = e.door?.height ?? 1.9, l = e.door?.at ?? 0, d = e.windows ?? [
|
|
6035
6035
|
{ at: -1.25, low: 1, width: 0.8, height: 0.8 },
|
|
6036
6036
|
{ at: 1.25, low: 1, width: 0.8, height: 0.8 }
|
|
@@ -6096,11 +6096,11 @@ function Cc(e = {}) {
|
|
|
6096
6096
|
summary: e.summary ?? "A house: opens its door, lights its windows, puffs chimney smoke, shakes, pops up.",
|
|
6097
6097
|
rig: p,
|
|
6098
6098
|
actions: Rc(!!u),
|
|
6099
|
-
acting:
|
|
6099
|
+
acting: Cc,
|
|
6100
6100
|
colors: { body: n.walls }
|
|
6101
6101
|
};
|
|
6102
6102
|
}
|
|
6103
|
-
const
|
|
6103
|
+
const Cc = {
|
|
6104
6104
|
depth: { door: 1, lights: 0, roll: 1, squash: 1, size: 0 },
|
|
6105
6105
|
limits: { door: 0.1, roll: 1.5, squash: 0.05 },
|
|
6106
6106
|
eyes: [],
|
|
@@ -7198,7 +7198,7 @@ function g0(e = {}) {
|
|
|
7198
7198
|
grazes: !0
|
|
7199
7199
|
});
|
|
7200
7200
|
}
|
|
7201
|
-
const
|
|
7201
|
+
const Ne = 0.6, Va = 75, Cs = 80;
|
|
7202
7202
|
function Qe(e) {
|
|
7203
7203
|
const { colors: s } = e, [t, o, r] = e.body.radii, a = (e.tail.raised ?? 15) * Math.PI / 180, n = e.tail.length * 0.4, i = [
|
|
7204
7204
|
{ id: "body", shape: { type: "ellipsoid", radii: e.body.radii, segments: 16 }, at: [0, e.body.height, 0], fill: s.body },
|
|
@@ -7240,17 +7240,17 @@ function Qe(e) {
|
|
|
7240
7240
|
}), i.push({
|
|
7241
7241
|
id: `wing-${d}-blade`,
|
|
7242
7242
|
parent: `wing-${d}`,
|
|
7243
|
-
shape: { type: "ellipsoid", radii: [e.wing.span *
|
|
7244
|
-
at: [l * e.wing.span *
|
|
7243
|
+
shape: { type: "ellipsoid", radii: [e.wing.span * Ne / 2, e.wing.chord * 0.1, e.wing.chord / 2], segments: 12 },
|
|
7244
|
+
at: [l * e.wing.span * Ne / 2, 0, -e.wing.chord * 0.1],
|
|
7245
7245
|
// Folded, the blade is rolled about its length so it lies flat against the body's side.
|
|
7246
|
-
rotate: [-
|
|
7246
|
+
rotate: [-Cs, 0, 0],
|
|
7247
7247
|
fill: s.wing,
|
|
7248
7248
|
outline: 0.8
|
|
7249
7249
|
}), i.push({
|
|
7250
7250
|
id: `wing-${d}-tip`,
|
|
7251
7251
|
parent: `wing-${d}-blade`,
|
|
7252
|
-
shape: { type: "ellipsoid", radii: [e.wing.span *
|
|
7253
|
-
at: [l * e.wing.span *
|
|
7252
|
+
shape: { type: "ellipsoid", radii: [e.wing.span * Ne / 2.4, e.wing.chord * 0.06, e.wing.chord * 0.3], segments: 10 },
|
|
7253
|
+
at: [l * e.wing.span * Ne / 4, 0, -e.wing.chord * 0.3],
|
|
7254
7254
|
rotate: [0, l * 14, 0],
|
|
7255
7255
|
fill: s.wing,
|
|
7256
7256
|
outline: 0.8
|
|
@@ -7265,8 +7265,8 @@ function Qe(e) {
|
|
|
7265
7265
|
bind: [
|
|
7266
7266
|
{ parts: ["wing-left"], rotate: { axis: "y", degrees: -90 } },
|
|
7267
7267
|
{ parts: ["wing-right"], rotate: { axis: "y", degrees: 90 } },
|
|
7268
|
-
{ parts: ["wing-left-blade"], translate: [e.wing.span * (1 -
|
|
7269
|
-
{ parts: ["wing-right-blade"], translate: [-e.wing.span * (1 -
|
|
7268
|
+
{ parts: ["wing-left-blade"], translate: [e.wing.span * (1 - Ne) / 2, 0, 0], rotate: { axis: "x", degrees: Cs }, scale: [1 / Ne, 1, 1] },
|
|
7269
|
+
{ parts: ["wing-right-blade"], translate: [-e.wing.span * (1 - Ne) / 2, 0, 0], rotate: { axis: "x", degrees: Cs }, scale: [1 / Ne, 1, 1] }
|
|
7270
7270
|
]
|
|
7271
7271
|
},
|
|
7272
7272
|
flap: {
|
|
@@ -7544,7 +7544,7 @@ function $0(e = {}) {
|
|
|
7544
7544
|
stoop: 10
|
|
7545
7545
|
});
|
|
7546
7546
|
}
|
|
7547
|
-
const Ht = { car: Ec, truck: Ac, bus: Tc, tractor: Pc, cart: Oc, trainCar: Hc, bike: Ic, motorbike: xc, tree: jc, house:
|
|
7547
|
+
const Ht = { car: Ec, truck: Ac, bus: Tc, tractor: Pc, cart: Oc, trainCar: Hc, bike: Ic, motorbike: xc, tree: jc, house: Nc, chair: Wc, desk: Dc, bed: qc, door: Gc, wheelchair: Xc, helicopter: Zc, airplane: e0, horse: l0, dog: h0, cat: c0, cow: d0, goat: f0, rabbit: u0, squirrel: g0, songbird: b0, crow: w0, chicken: k0, pigeon: v0, duck: S0, owl: M0, parrot: $0 };
|
|
7548
7548
|
function Ja(e, s = {}) {
|
|
7549
7549
|
const t = Ht[e];
|
|
7550
7550
|
if (!t) throw new Error(fe("prop preset", e, Object.keys(Ht)));
|
|
@@ -7819,7 +7819,7 @@ function _0(e, s = {}) {
|
|
|
7819
7819
|
figureStyles: ["fluid", "stick", "organic"],
|
|
7820
7820
|
body: {
|
|
7821
7821
|
"body.torso · body.arm · body.leg · body.neck": "Organic half-width profiles: [{ at: 0..1, width: fractionOfHeight }], increasing from 0 to 1; independent of ink width.",
|
|
7822
|
-
"body.measurements": `Organic torso from tape-measure girths { height, bust, underbust?, waist, hip } in any one unit, or a named shape (${Object.keys(
|
|
7822
|
+
"body.measurements": `Organic torso from tape-measure girths { height, bust, underbust?, waist, hip } in any one unit, or a named shape (${Object.keys(Cr).join(" | ")}). Sets the front width, the side depth (bust forward, seat back, belly) and the hip and thigh spacing; reads correctly at every turn. An explicit torso / torsoFront / torsoBack / hipWidth still wins.`,
|
|
7823
7823
|
"body.torsoFront · body.torsoBack": "Organic side-view depth from the spine line toward the chest/belly and toward the back/seat, same profile format; default torso × depth.",
|
|
7824
7824
|
"body.fill · body.outline · body.shading": "Shared skin fill, outline { color, width }, cel material { mode: cel | none, light: [x,y], shadow, opacity, highlight }.",
|
|
7825
7825
|
"softCartoonCharacter(name, options?)": "Original youngMan / youngWoman / childBoy / childGirl story presets. Children have larger head proportions, shorter limbs and rounded torsos; every face, hair, build, hand, clothing and material option can be overridden.",
|
|
@@ -7829,7 +7829,7 @@ function _0(e, s = {}) {
|
|
|
7829
7829
|
},
|
|
7830
7830
|
poses: Object.keys(_e),
|
|
7831
7831
|
dances: Object.keys(ft),
|
|
7832
|
-
expressions: Object.keys(
|
|
7832
|
+
expressions: Object.keys(Nr),
|
|
7833
7833
|
faceStyles: ["simple", "anime"],
|
|
7834
7834
|
faceShapes: ["round", "angular"],
|
|
7835
7835
|
gags: Object.keys(Xn),
|
|
@@ -7856,7 +7856,7 @@ function _0(e, s = {}) {
|
|
|
7856
7856
|
},
|
|
7857
7857
|
edits: Pa
|
|
7858
7858
|
},
|
|
7859
|
-
surfaces: { code: Gt, board:
|
|
7859
|
+
surfaces: { code: Gt, board: Ce, chart: nt, prop: Mt },
|
|
7860
7860
|
surfaceScript: {
|
|
7861
7861
|
"surfaceScript(figureId, { name: surface }, beats, options)": "compiles beats that act on surfaces: returns the script result with `tracks` (the figure’s, ridden, then every surface’s, keyed by its name) and `figureTracks`; options are scriptTracks’ plus `figureStyle` (for carry) and `ride` (default true)",
|
|
7862
7862
|
"checkSurfaceBeats(beats, surfaces, cast?)": "every problem checkBeats finds, plus unknown surfaces, places, edits and moments, with suggestions",
|
|
@@ -7882,6 +7882,7 @@ function _0(e, s = {}) {
|
|
|
7882
7882
|
"mathTarget(spec, { x, y })": "a canvas target for videos and canvas pages; tracks animate its values and item props",
|
|
7883
7883
|
"mathSteps(lesson, target, spec, { hidden })": "lesson steps: toValue, applyMatrix, drawOn, fadeIn, fadeOut, showStep (equations)",
|
|
7884
7884
|
"mountMath(element) / mountAllMath()": "lesson-page embeds: <figure data-tinyfly-math> with data-tinyfly-figure and data-tinyfly-timeline JSON scripts, stepped like any embed",
|
|
7885
|
+
"lossSurface3D({ expr, start, rate, momentum?, steps?, orbit? })": "a loss surface as scene-3d JSON with a ball rolling down the descent path: { scene, tracks, duration, path, losses }",
|
|
7885
7886
|
"mathSurface(figure, { x, y })": "a figure as a surface for surfaceScript: anchors box, item:ID, tip:ID, point:ID, node:GRAPH:NODE, term:ID:TEXT, value:NAME; edits drawOn, erase, show, hide, step, set",
|
|
7886
7887
|
"mathExplorable(element, spec, { sliders, drag })": "reader-driven figures: sliders on number values, drag vector tips or matrix columns",
|
|
7887
7888
|
"mathFigureToSvg(spec, props)": "a standalone SVG of a figure at some values",
|
|
@@ -8161,7 +8162,7 @@ function gf(e, s, t, o = {}) {
|
|
|
8161
8162
|
const i = (t - n.time) / n.length;
|
|
8162
8163
|
if (i <= 0 || i >= 1) continue;
|
|
8163
8164
|
const h = De(`${n.kind}:${n.time}:${n.x}`);
|
|
8164
|
-
n.kind === "dust" ? ih(e, { x: n.x, y: n.y }, i, { size: a, color: r, seed: h }) : n.kind === "exhaust" ?
|
|
8165
|
+
n.kind === "dust" ? ih(e, { x: n.x, y: n.y }, i, { size: a, color: r, seed: h }) : n.kind === "exhaust" ? C0(e, n, i, a, r, h) : n.kind === "skid" ? R0(e, n, i, t, r) : n.kind === "honk" ? W0(e, n, i, a, r) : n.kind === "smoke" ? K0(e, n, t, a, r) : n.kind === "leaves" && N0(e, n, i, a, o.leafColor ?? "#5cae5a", r, h);
|
|
8165
8166
|
}
|
|
8166
8167
|
}
|
|
8167
8168
|
function K0(e, s, t, o, r, a) {
|
|
@@ -8175,7 +8176,7 @@ function K0(e, s, t, o, r, a) {
|
|
|
8175
8176
|
}
|
|
8176
8177
|
e.restore();
|
|
8177
8178
|
}
|
|
8178
|
-
function
|
|
8179
|
+
function N0(e, s, t, o, r, a, n) {
|
|
8179
8180
|
const i = s.direction ?? 1, h = s.toY ?? s.y + o * 3;
|
|
8180
8181
|
e.save(), e.lineWidth = Math.max(1, o * 0.02), e.strokeStyle = a, e.fillStyle = r;
|
|
8181
8182
|
for (let c = 0; c < 4; c++) {
|
|
@@ -8184,7 +8185,7 @@ function C0(e, s, t, o, r, a, n) {
|
|
|
8184
8185
|
}
|
|
8185
8186
|
e.restore();
|
|
8186
8187
|
}
|
|
8187
|
-
function
|
|
8188
|
+
function C0(e, s, t, o, r, a) {
|
|
8188
8189
|
const n = s.direction ?? -1;
|
|
8189
8190
|
e.save(), e.strokeStyle = r, e.lineWidth = Math.max(1, o * 0.025);
|
|
8190
8191
|
for (let i = 0; i < 3; i++) {
|
|
@@ -8429,8 +8430,8 @@ ${r.map((M) => ` beat ${M.beat}: ${M.message}`).join(`
|
|
|
8429
8430
|
for (let Y = 0; ; Y = Math.min(y, Y + U0)) {
|
|
8430
8431
|
const se = k + va(w, Y / y) * v, { point: q, direction: I } = ka(A, Y);
|
|
8431
8432
|
W += ts(W, lt([0, 0], I)), l("x", se, q[0]), l("z", se, q[1]), l("rotateY", se, W);
|
|
8432
|
-
for (const [
|
|
8433
|
-
for (const [
|
|
8433
|
+
for (const [N, C] of Object.entries(M.perMetre ?? {})) l(N, se, x[N] + Y * C);
|
|
8434
|
+
for (const [N, C] of Object.entries(M.perSecond ?? {})) l(N, se, x[N] + (se - k) / 1e3 * C);
|
|
8434
8435
|
if (Y >= y) break;
|
|
8435
8436
|
}
|
|
8436
8437
|
for (const [Y, se] of Object.entries(M.perMetre ?? {})) a[Y] = x[Y] + y * se;
|
|
@@ -8585,10 +8586,10 @@ function dd(e) {
|
|
|
8585
8586
|
w.beginPath(), w.arc(j.x + F.u * j.w, j.y + F.v * (j.ground - j.y), F.size, 0, Math.PI * 2), w.fill();
|
|
8586
8587
|
w.globalAlpha = 1;
|
|
8587
8588
|
}
|
|
8588
|
-
const I = P(W, 6),
|
|
8589
|
-
if (I.up && (w.fillStyle = i.sun, w.beginPath(), w.arc(j.x + I.x / o * j.w, j.y + I.y / r * j.h,
|
|
8590
|
-
const F = j.x +
|
|
8591
|
-
w.fillStyle = i.moon, w.beginPath(), w.arc(F, Q,
|
|
8589
|
+
const I = P(W, 6), N = P(W, 18), C = Math.min(j.w, j.h) * 0.06;
|
|
8590
|
+
if (I.up && (w.fillStyle = i.sun, w.beginPath(), w.arc(j.x + I.x / o * j.w, j.y + I.y / r * j.h, C, 0, Math.PI * 2), w.fill()), N.up) {
|
|
8591
|
+
const F = j.x + N.x / o * j.w, Q = j.y + N.y / r * j.h;
|
|
8592
|
+
w.fillStyle = i.moon, w.beginPath(), w.arc(F, Q, C * 0.8, 0, Math.PI * 2), w.fill(), w.fillStyle = G, w.beginPath(), w.arc(F - C * 0.35, Q - C * 0.15, C * 0.7, 0, Math.PI * 2), w.fill();
|
|
8592
8593
|
}
|
|
8593
8594
|
const S = Math.max(0, Math.min(1, E("clouds"))), _ = Math.max(-1, Math.min(1, E("wind"))), V = Math.round(S * f.length);
|
|
8594
8595
|
w.fillStyle = Tt("#ffffff", i.cloud === "#ffffff" ? "#ffffff" : i.cloud, 1), w.globalAlpha = 0.55 + 0.4 * q;
|
|
@@ -8631,8 +8632,8 @@ function dd(e) {
|
|
|
8631
8632
|
const Y = j.h * 0.05, se = x * 0.45, q = Math.round(W * u.length);
|
|
8632
8633
|
w.beginPath();
|
|
8633
8634
|
for (let I = 0; I < q; I++) {
|
|
8634
|
-
const
|
|
8635
|
-
w.moveTo(j.x + S, j.y +
|
|
8635
|
+
const N = u[I], C = ((N.v * j.h + O * N.speed * 0.9) % j.h + j.h) % j.h, S = ((N.u * j.w + C * se) % j.w + j.w) % j.w;
|
|
8636
|
+
w.moveTo(j.x + S, j.y + C), w.lineTo(j.x + S + se * Y, j.y + C + Y);
|
|
8636
8637
|
}
|
|
8637
8638
|
w.stroke(), w.globalAlpha = 1;
|
|
8638
8639
|
}
|
|
@@ -8640,8 +8641,8 @@ function dd(e) {
|
|
|
8640
8641
|
w.fillStyle = i.snow, w.globalAlpha = 0.85;
|
|
8641
8642
|
const Y = Math.round(G * p.length);
|
|
8642
8643
|
for (let se = 0; se < Y; se++) {
|
|
8643
|
-
const q = p[se], I = ((q.v * j.h + O * q.speed * 0.08) % j.h + j.h) % j.h,
|
|
8644
|
-
w.beginPath(), w.arc(j.x +
|
|
8644
|
+
const q = p[se], I = ((q.v * j.h + O * q.speed * 0.08) % j.h + j.h) % j.h, N = Math.sin(O * 2e-3 + q.sway) * j.w * 0.02, C = ((q.u * j.w + N + x * I * 0.3) % j.w + j.w) % j.w;
|
|
8645
|
+
w.beginPath(), w.arc(j.x + C, j.y + I, q.size, 0, Math.PI * 2), w.fill();
|
|
8645
8646
|
}
|
|
8646
8647
|
w.globalAlpha = 1;
|
|
8647
8648
|
}
|
|
@@ -8748,7 +8749,7 @@ export {
|
|
|
8748
8749
|
m0 as BIRD_ACTING,
|
|
8749
8750
|
Vo as BOARD_MARKS,
|
|
8750
8751
|
Rt as BOARD_THEMES,
|
|
8751
|
-
|
|
8752
|
+
Cr as BODY_SHAPES,
|
|
8752
8753
|
zr as CANVAS_PROPERTIES,
|
|
8753
8754
|
zc as CHAIR_ACTING,
|
|
8754
8755
|
qo as CHARACTER_BEAT_3D_FIELDS,
|
|
@@ -8785,12 +8786,12 @@ export {
|
|
|
8785
8786
|
at as HELP_UP,
|
|
8786
8787
|
df as HORSE_ACTING,
|
|
8787
8788
|
cf as HORSE_GAITS,
|
|
8788
|
-
|
|
8789
|
+
Cc as HOUSE_ACTING,
|
|
8789
8790
|
th as HUMAN_ACTING_RIG,
|
|
8790
8791
|
Kr as HUMAN_BUILDS,
|
|
8791
8792
|
Tf as HUMAN_CYCLES,
|
|
8792
8793
|
ft as HUMAN_DANCES,
|
|
8793
|
-
|
|
8794
|
+
Nr as HUMAN_EXPRESSIONS,
|
|
8794
8795
|
Xn as HUMAN_GAGS,
|
|
8795
8796
|
_e as HUMAN_POSES,
|
|
8796
8797
|
ye as HUMAN_REST,
|
|
@@ -8818,7 +8819,7 @@ export {
|
|
|
8818
8819
|
Mc as VEHICLE_ACTING,
|
|
8819
8820
|
Be as VISEMES,
|
|
8820
8821
|
Vc as WHEELCHAIR_ACTING,
|
|
8821
|
-
|
|
8822
|
+
Ce as WHITEBOARD_SURFACE,
|
|
8822
8823
|
oh as actCharacterTracks,
|
|
8823
8824
|
wo as actKeyframes,
|
|
8824
8825
|
sh as actTracks,
|
|
@@ -8839,7 +8840,7 @@ export {
|
|
|
8839
8840
|
to as blendPose,
|
|
8840
8841
|
If as bodyProfileWidth,
|
|
8841
8842
|
xf as bodyShapeProfiles,
|
|
8842
|
-
|
|
8843
|
+
Nu as boilFrame,
|
|
8843
8844
|
Di as boxMesh,
|
|
8844
8845
|
jf as brushingPose,
|
|
8845
8846
|
Sf as buildScene,
|
|
@@ -8858,12 +8859,12 @@ export {
|
|
|
8858
8859
|
_f as characterAt,
|
|
8859
8860
|
Kf as characterHandPose,
|
|
8860
8861
|
Oe as characterJoints,
|
|
8861
|
-
|
|
8862
|
+
Nf as characterJointsInView,
|
|
8862
8863
|
_d as characterLookAtTracks,
|
|
8863
8864
|
Id as characterObjects,
|
|
8864
8865
|
ir as characterPartsInView,
|
|
8865
8866
|
dr as characterPoseOf,
|
|
8866
|
-
|
|
8867
|
+
Cf as characterPoseTracks,
|
|
8867
8868
|
rf as characterScript,
|
|
8868
8869
|
jd as characterScript3D,
|
|
8869
8870
|
qh as characterStrideLength,
|
|
@@ -8877,7 +8878,7 @@ export {
|
|
|
8877
8878
|
Fh as checkSurfaceBeats,
|
|
8878
8879
|
qu as checkTracks,
|
|
8879
8880
|
k0 as chicken,
|
|
8880
|
-
|
|
8881
|
+
Cd as circlePath,
|
|
8881
8882
|
Ta as clipErased,
|
|
8882
8883
|
Dd as codePanel,
|
|
8883
8884
|
ml as codeTokens,
|
|
@@ -8947,11 +8948,11 @@ export {
|
|
|
8947
8948
|
Zd as hairMotionAt,
|
|
8948
8949
|
Gf as hairMotionOf,
|
|
8949
8950
|
Yf as hairlineAt,
|
|
8950
|
-
|
|
8951
|
+
Nd as handAt,
|
|
8951
8952
|
Uf as handGrip,
|
|
8952
8953
|
To as handJoints,
|
|
8953
8954
|
Xf as handJointsAt,
|
|
8954
|
-
|
|
8955
|
+
Na as handPath,
|
|
8955
8956
|
bt as handPose,
|
|
8956
8957
|
tr as handProp,
|
|
8957
8958
|
Vf as headPoint,
|
|
@@ -8961,7 +8962,7 @@ export {
|
|
|
8961
8962
|
Jf as holdingLayers,
|
|
8962
8963
|
l0 as horse,
|
|
8963
8964
|
ff as horseStrideLength,
|
|
8964
|
-
|
|
8965
|
+
Nc as house,
|
|
8965
8966
|
Zf as humanCyclePose,
|
|
8966
8967
|
Zt as humanDanceFrame,
|
|
8967
8968
|
Ad as humanDanceTracks,
|
|
@@ -9004,7 +9005,7 @@ export {
|
|
|
9004
9005
|
$0 as parrot,
|
|
9005
9006
|
pt as parseAnchor,
|
|
9006
9007
|
oa as partialPath,
|
|
9007
|
-
|
|
9008
|
+
Cu as pathLength,
|
|
9008
9009
|
kf as pedallingKeys,
|
|
9009
9010
|
qn as pedallingPose,
|
|
9010
9011
|
af as persona,
|