@pinepaper.studio/mcp-server 1.6.6 → 1.6.8
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.de.md +24 -1
- package/README.es.md +24 -1
- package/README.fr.md +24 -1
- package/README.hi.md +21 -1
- package/README.ja.md +22 -1
- package/README.ko.md +22 -1
- package/README.md +329 -14
- package/README.pt-BR.md +24 -1
- package/README.zh-CN.md +20 -1
- package/assets/edit-whenever.svg +75 -0
- package/dist/agent/export-manager.d.ts.map +1 -1
- package/dist/agent/export-manager.js +2 -2
- package/dist/agent/export-manager.js.map +1 -1
- package/dist/agent/session-manager.d.ts.map +1 -1
- package/dist/agent/session-manager.js.map +1 -1
- package/dist/assets/repositories/fontawesome.d.ts.map +1 -1
- package/dist/assets/repositories/fontawesome.js.map +1 -1
- package/dist/assets/repositories/openclipart.d.ts.map +1 -1
- package/dist/character/data/concepts.json +1 -0
- package/dist/character/data/depictions.json +1 -0
- package/dist/character/data/styles.json +1 -0
- package/dist/character/duration-scale.d.ts +13 -0
- package/dist/character/duration-scale.d.ts.map +1 -0
- package/dist/character/duration-scale.js +13 -0
- package/dist/character/duration-scale.js.map +1 -0
- package/dist/character/path-bbox.d.ts +82 -0
- package/dist/character/path-bbox.d.ts.map +1 -0
- package/dist/character/path-bbox.js +496 -0
- package/dist/character/path-bbox.js.map +1 -0
- package/dist/character/perform.d.ts +149 -0
- package/dist/character/perform.d.ts.map +1 -0
- package/dist/character/perform.js +626 -0
- package/dist/character/perform.js.map +1 -0
- package/dist/character/resolve.d.ts +51 -0
- package/dist/character/resolve.d.ts.map +1 -0
- package/dist/character/resolve.js +239 -0
- package/dist/character/resolve.js.map +1 -0
- package/dist/design/design-systems.d.ts +126 -0
- package/dist/design/design-systems.d.ts.map +1 -0
- package/dist/design/design-systems.js +240 -0
- package/dist/design/design-systems.js.map +1 -0
- package/dist/execution/canvas-state.d.ts +7 -0
- package/dist/execution/canvas-state.d.ts.map +1 -1
- package/dist/execution/canvas-state.js +20 -8
- package/dist/execution/canvas-state.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/ontology/design-graph.d.ts +9 -0
- package/dist/ontology/design-graph.d.ts.map +1 -1
- package/dist/ontology/design-graph.js +98 -4
- package/dist/ontology/design-graph.js.map +1 -1
- package/dist/ontology/types.d.ts +42 -0
- package/dist/ontology/types.d.ts.map +1 -1
- package/dist/ontology/vocabulary.d.ts.map +1 -1
- package/dist/ontology/vocabulary.js +139 -0
- package/dist/ontology/vocabulary.js.map +1 -1
- package/dist/taxonomy/classifier.js +1 -1
- package/dist/taxonomy/classifier.js.map +1 -1
- package/dist/taxonomy/error-recovery.d.ts.map +1 -1
- package/dist/taxonomy/matcher.d.ts.map +1 -1
- package/dist/taxonomy/matcher.js.map +1 -1
- package/dist/tools/compact-descriptions.d.ts.map +1 -1
- package/dist/tools/compact-descriptions.js +25 -0
- package/dist/tools/compact-descriptions.js.map +1 -1
- package/dist/tools/definitions.d.ts +1 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +1236 -45
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/engine-methods.d.ts +18 -0
- package/dist/tools/engine-methods.d.ts.map +1 -0
- package/dist/tools/engine-methods.js +239 -0
- package/dist/tools/engine-methods.js.map +1 -0
- package/dist/tools/handlers/character.d.ts +121 -0
- package/dist/tools/handlers/character.d.ts.map +1 -0
- package/dist/tools/handlers/character.js +315 -0
- package/dist/tools/handlers/character.js.map +1 -0
- package/dist/tools/handlers.d.ts +2 -0
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/handlers.js +386 -22
- package/dist/tools/handlers.js.map +1 -1
- package/dist/tools/minimal-descriptions.d.ts.map +1 -1
- package/dist/tools/minimal-descriptions.js +24 -4
- package/dist/tools/minimal-descriptions.js.map +1 -1
- package/dist/tools/toolkits.d.ts.map +1 -1
- package/dist/tools/toolkits.js +21 -0
- package/dist/tools/toolkits.js.map +1 -1
- package/dist/types/code-generator.d.ts +141 -2
- package/dist/types/code-generator.d.ts.map +1 -1
- package/dist/types/code-generator.js +2246 -78
- package/dist/types/code-generator.js.map +1 -1
- package/dist/types/schemas.d.ts +9295 -603
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +1134 -61
- package/dist/types/schemas.js.map +1 -1
- package/dist/vendor/design/art-deco-generator.d.ts +52 -0
- package/dist/vendor/design/art-deco-generator.d.ts.map +1 -0
- package/dist/vendor/design/art-deco-generator.js +144 -0
- package/dist/vendor/design/art-deco-generator.js.map +1 -0
- package/dist/vendor/design/art-nouveau-generator.d.ts +46 -0
- package/dist/vendor/design/art-nouveau-generator.d.ts.map +1 -0
- package/dist/vendor/design/art-nouveau-generator.js +134 -0
- package/dist/vendor/design/art-nouveau-generator.js.map +1 -0
- package/dist/vendor/design/bauhaus-generator.d.ts +53 -0
- package/dist/vendor/design/bauhaus-generator.d.ts.map +1 -0
- package/dist/vendor/design/bauhaus-generator.js +126 -0
- package/dist/vendor/design/bauhaus-generator.js.map +1 -0
- package/dist/vendor/design/brutalist-generator.d.ts +53 -0
- package/dist/vendor/design/brutalist-generator.d.ts.map +1 -0
- package/dist/vendor/design/brutalist-generator.js +148 -0
- package/dist/vendor/design/brutalist-generator.js.map +1 -0
- package/dist/vendor/design/claymorphism-generator.d.ts +46 -0
- package/dist/vendor/design/claymorphism-generator.d.ts.map +1 -0
- package/dist/vendor/design/claymorphism-generator.js +135 -0
- package/dist/vendor/design/claymorphism-generator.js.map +1 -0
- package/dist/vendor/design/corporate-memphis-generator.d.ts +47 -0
- package/dist/vendor/design/corporate-memphis-generator.d.ts.map +1 -0
- package/dist/vendor/design/corporate-memphis-generator.js +144 -0
- package/dist/vendor/design/corporate-memphis-generator.js.map +1 -0
- package/dist/vendor/design/cyberpunk-generator.d.ts +52 -0
- package/dist/vendor/design/cyberpunk-generator.d.ts.map +1 -0
- package/dist/vendor/design/cyberpunk-generator.js +162 -0
- package/dist/vendor/design/cyberpunk-generator.js.map +1 -0
- package/dist/vendor/design/de-stijl-generator.d.ts +50 -0
- package/dist/vendor/design/de-stijl-generator.d.ts.map +1 -0
- package/dist/vendor/design/de-stijl-generator.js +154 -0
- package/dist/vendor/design/de-stijl-generator.js.map +1 -0
- package/dist/vendor/design/design-style.d.ts +3 -0
- package/dist/vendor/design/design-style.d.ts.map +1 -0
- package/dist/vendor/design/design-style.js +12 -0
- package/dist/vendor/design/design-style.js.map +1 -0
- package/dist/vendor/design/design-systems-dtcg.d.ts +59 -0
- package/dist/vendor/design/design-systems-dtcg.d.ts.map +1 -0
- package/dist/vendor/design/design-systems-dtcg.js +571 -0
- package/dist/vendor/design/design-systems-dtcg.js.map +1 -0
- package/dist/vendor/design/frutiger-aero-generator.d.ts +46 -0
- package/dist/vendor/design/frutiger-aero-generator.d.ts.map +1 -0
- package/dist/vendor/design/frutiger-aero-generator.js +133 -0
- package/dist/vendor/design/frutiger-aero-generator.js.map +1 -0
- package/dist/vendor/design/memphis-generator.d.ts +56 -0
- package/dist/vendor/design/memphis-generator.d.ts.map +1 -0
- package/dist/vendor/design/memphis-generator.js +158 -0
- package/dist/vendor/design/memphis-generator.js.map +1 -0
- package/dist/vendor/design/mid-century-upa-generator.d.ts +46 -0
- package/dist/vendor/design/mid-century-upa-generator.d.ts.map +1 -0
- package/dist/vendor/design/mid-century-upa-generator.js +137 -0
- package/dist/vendor/design/mid-century-upa-generator.js.map +1 -0
- package/dist/vendor/design/neumorphic-generator.d.ts +53 -0
- package/dist/vendor/design/neumorphic-generator.d.ts.map +1 -0
- package/dist/vendor/design/neumorphic-generator.js +182 -0
- package/dist/vendor/design/neumorphic-generator.js.map +1 -0
- package/dist/vendor/design/op-art-generator.d.ts +45 -0
- package/dist/vendor/design/op-art-generator.d.ts.map +1 -0
- package/dist/vendor/design/op-art-generator.js +116 -0
- package/dist/vendor/design/op-art-generator.js.map +1 -0
- package/dist/vendor/design/pixel-art-generator.d.ts +45 -0
- package/dist/vendor/design/pixel-art-generator.d.ts.map +1 -0
- package/dist/vendor/design/pixel-art-generator.js +143 -0
- package/dist/vendor/design/pixel-art-generator.js.map +1 -0
- package/dist/vendor/design/pop-art-generator.d.ts +53 -0
- package/dist/vendor/design/pop-art-generator.d.ts.map +1 -0
- package/dist/vendor/design/pop-art-generator.js +164 -0
- package/dist/vendor/design/pop-art-generator.js.map +1 -0
- package/dist/vendor/design/risograph-generator.d.ts +53 -0
- package/dist/vendor/design/risograph-generator.d.ts.map +1 -0
- package/dist/vendor/design/risograph-generator.js +170 -0
- package/dist/vendor/design/risograph-generator.js.map +1 -0
- package/dist/vendor/design/swiss-style-generator.d.ts +55 -0
- package/dist/vendor/design/swiss-style-generator.d.ts.map +1 -0
- package/dist/vendor/design/swiss-style-generator.js +147 -0
- package/dist/vendor/design/swiss-style-generator.js.map +1 -0
- package/dist/vendor/design/vaporwave-generator.d.ts +51 -0
- package/dist/vendor/design/vaporwave-generator.d.ts.map +1 -0
- package/dist/vendor/design/vaporwave-generator.js +139 -0
- package/dist/vendor/design/vaporwave-generator.js.map +1 -0
- package/manifest.json +65 -1
- package/package.json +18 -9
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/* VENDORED from mcp-cloud/src/services/path-bbox.ts.
|
|
2
|
+
* sha256: ab22b612e8355355552c2db1f07e48b11c17ab6c1bb44bf66c51d973c201d585
|
|
3
|
+
* Generator: scripts/sync-character-modules.mjs
|
|
4
|
+
*
|
|
5
|
+
* Do NOT edit here — change it in mcp-cloud and re-run the generator, or the
|
|
6
|
+
* two implementations drift and a figure performs differently depending on
|
|
7
|
+
* which surface a caller reached. Guarded by character.test.ts.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* THE TRUE BOUNDING BOX OF AN SVG PATH.
|
|
11
|
+
*
|
|
12
|
+
* Written for one reason: `x`/`y` is supposed to BE an item's centre — that is
|
|
13
|
+
* what `itemCenter()` states and what every other shape does — and a `path`
|
|
14
|
+
* was the exception nobody had noticed. The two renderers place a path by its
|
|
15
|
+
* ORIGIN and agree, then disagree the moment a keyframe touches it, because
|
|
16
|
+
* the engine's keyframe sets `item.position` (the centre) while the Worker
|
|
17
|
+
* animates a translate delta from `it.x` (the origin). The gap is exactly this
|
|
18
|
+
* box's centre. See docs/PATH_CENTRE_DIVERGENCE.md.
|
|
19
|
+
*
|
|
20
|
+
* CONTROL POINTS ARE NOT THE BOX. A cubic lies inside the hull of its control
|
|
21
|
+
* points and generally nowhere near its edges, so min/max over the numbers in
|
|
22
|
+
* the `d` string overshoots — for the measurement that sized this bug it
|
|
23
|
+
* overshot by design, and using it to FIX the bug would move every path by a
|
|
24
|
+
* wrong amount, in both renderers instead of one. So curves are solved:
|
|
25
|
+
*
|
|
26
|
+
* cubic B'(t) = 0 is a quadratic in t; take the real roots in (0,1)
|
|
27
|
+
* quadratic B'(t) = 0 is linear; one root
|
|
28
|
+
* arc the ellipse's own extrema, from the centre parameterisation,
|
|
29
|
+
* kept only where they fall inside the swept angle
|
|
30
|
+
*
|
|
31
|
+
* The grammar is the whole of SVG 1.1 path data: M L H V C S Q T A Z, absolute
|
|
32
|
+
* and relative, with implicit repetition (`M 0 0 10 10` is a moveto and a
|
|
33
|
+
* lineto) and S/T reflecting the previous control point. A model writes these
|
|
34
|
+
* strings, so the parser has to accept what a model writes, not a subset.
|
|
35
|
+
*/
|
|
36
|
+
/** Numbers, including exponent and the `.5.5` run SVG allows. */
|
|
37
|
+
function* tokens(d) {
|
|
38
|
+
const re = /[MmLlHhVvCcSsQqTtAaZz]|-?\d*\.?\d+(?:[eE][-+]?\d+)?/g;
|
|
39
|
+
let m;
|
|
40
|
+
while ((m = re.exec(d)))
|
|
41
|
+
yield m[0];
|
|
42
|
+
}
|
|
43
|
+
const isCmd = (t) => /^[MmLlHhVvCcSsQqTtAaZz]$/.test(t);
|
|
44
|
+
/** Real roots of at² + bt + c in the open interval (0,1). */
|
|
45
|
+
function rootsIn01(a, b, c) {
|
|
46
|
+
const out = [];
|
|
47
|
+
if (Math.abs(a) < 1e-12) {
|
|
48
|
+
if (Math.abs(b) > 1e-12)
|
|
49
|
+
out.push(-c / b);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const disc = b * b - 4 * a * c;
|
|
53
|
+
if (disc < 0)
|
|
54
|
+
return out;
|
|
55
|
+
const s = Math.sqrt(disc);
|
|
56
|
+
out.push((-b + s) / (2 * a), (-b - s) / (2 * a));
|
|
57
|
+
}
|
|
58
|
+
return out.filter((t) => t > 0 && t < 1);
|
|
59
|
+
}
|
|
60
|
+
const cubicAt = (p0, p1, p2, p3, t) => {
|
|
61
|
+
const u = 1 - t;
|
|
62
|
+
return u * u * u * p0 + 3 * u * u * t * p1 + 3 * u * t * t * p2 + t * t * t * p3;
|
|
63
|
+
};
|
|
64
|
+
const quadAt = (p0, p1, p2, t) => {
|
|
65
|
+
const u = 1 - t;
|
|
66
|
+
return u * u * p0 + 2 * u * t * p1 + t * t * p2;
|
|
67
|
+
};
|
|
68
|
+
/** Extrema of one cubic axis, endpoints included by the caller. */
|
|
69
|
+
function cubicExtrema(p0, p1, p2, p3) {
|
|
70
|
+
// B'(t) = 3[(-p0+3p1-3p2+p3)t² + 2(p0-2p1+p2)t + (p1-p0)]
|
|
71
|
+
const a = -p0 + 3 * p1 - 3 * p2 + p3;
|
|
72
|
+
const b = 2 * (p0 - 2 * p1 + p2);
|
|
73
|
+
const c = p1 - p0;
|
|
74
|
+
return rootsIn01(a, b, c).map((t) => cubicAt(p0, p1, p2, p3, t));
|
|
75
|
+
}
|
|
76
|
+
function quadExtrema(p0, p1, p2) {
|
|
77
|
+
// B'(t) = 2[(p0-2p1+p2)t + (p1-p0)]
|
|
78
|
+
const a = p0 - 2 * p1 + p2;
|
|
79
|
+
const b = p1 - p0;
|
|
80
|
+
if (Math.abs(a) < 1e-12)
|
|
81
|
+
return [];
|
|
82
|
+
const t = -b / a;
|
|
83
|
+
return t > 0 && t < 1 ? [quadAt(p0, p1, p2, t)] : [];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Extrema of an elliptical arc, solved rather than sampled.
|
|
87
|
+
*
|
|
88
|
+
* Endpoint parameterisation in, centre parameterisation out (SVG F.6.5), then
|
|
89
|
+
* the four axis extrema of the rotated ellipse — dx/dθ = 0 gives
|
|
90
|
+
* tan θ = -(ry/rx)·tan φ, and dy/dθ = 0 gives tan θ = (ry/rx)·cot φ — each
|
|
91
|
+
* kept only if it lies inside the swept angle.
|
|
92
|
+
*/
|
|
93
|
+
function arcExtrema(x0, y0, rxIn, ryIn, rotDeg, largeArc, sweep, x1, y1) {
|
|
94
|
+
let rx = Math.abs(rxIn), ry = Math.abs(ryIn);
|
|
95
|
+
if (rx < 1e-12 || ry < 1e-12)
|
|
96
|
+
return [[x1, y1]]; // degenerates to a line
|
|
97
|
+
const phi = (rotDeg * Math.PI) / 180;
|
|
98
|
+
const cosP = Math.cos(phi), sinP = Math.sin(phi);
|
|
99
|
+
const dx2 = (x0 - x1) / 2, dy2 = (y0 - y1) / 2;
|
|
100
|
+
const x1p = cosP * dx2 + sinP * dy2;
|
|
101
|
+
const y1p = -sinP * dx2 + cosP * dy2;
|
|
102
|
+
// Scale radii up if they cannot span the chord (SVG F.6.6).
|
|
103
|
+
const lam = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);
|
|
104
|
+
if (lam > 1) {
|
|
105
|
+
const s = Math.sqrt(lam);
|
|
106
|
+
rx *= s;
|
|
107
|
+
ry *= s;
|
|
108
|
+
}
|
|
109
|
+
const sign = largeArc === sweep ? -1 : 1;
|
|
110
|
+
const num = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
111
|
+
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
112
|
+
const co = sign * Math.sqrt(Math.max(0, num / den));
|
|
113
|
+
const cxp = (co * rx * y1p) / ry;
|
|
114
|
+
const cyp = (-co * ry * x1p) / rx;
|
|
115
|
+
const cx = cosP * cxp - sinP * cyp + (x0 + x1) / 2;
|
|
116
|
+
const cy = sinP * cxp + cosP * cyp + (y0 + y1) / 2;
|
|
117
|
+
const ang = (ux, uy, vx, vy) => {
|
|
118
|
+
const d = (ux * vx + uy * vy) / (Math.hypot(ux, uy) * Math.hypot(vx, vy));
|
|
119
|
+
const a = Math.acos(Math.min(1, Math.max(-1, d)));
|
|
120
|
+
return ux * vy - uy * vx < 0 ? -a : a;
|
|
121
|
+
};
|
|
122
|
+
const theta0 = ang(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);
|
|
123
|
+
let delta = ang((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);
|
|
124
|
+
if (!sweep && delta > 0)
|
|
125
|
+
delta -= 2 * Math.PI;
|
|
126
|
+
if (sweep && delta < 0)
|
|
127
|
+
delta += 2 * Math.PI;
|
|
128
|
+
const at = (t) => [
|
|
129
|
+
cx + rx * Math.cos(t) * cosP - ry * Math.sin(t) * sinP,
|
|
130
|
+
cy + rx * Math.cos(t) * sinP + ry * Math.sin(t) * cosP,
|
|
131
|
+
];
|
|
132
|
+
const inSweep = (t) => {
|
|
133
|
+
let k = (t - theta0) / (delta || 1);
|
|
134
|
+
// Normalise the candidate into the sweep's own parameter space.
|
|
135
|
+
for (let n = -2; n <= 2; n++) {
|
|
136
|
+
k = (t + n * 2 * Math.PI - theta0) / (delta || 1);
|
|
137
|
+
if (k >= 0 && k <= 1)
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
};
|
|
142
|
+
const cands = [];
|
|
143
|
+
const tx = Math.atan2(-ry * sinP, rx * cosP);
|
|
144
|
+
const ty = Math.atan2(ry * cosP, rx * sinP);
|
|
145
|
+
for (const base of [tx, ty])
|
|
146
|
+
for (const k of [0, Math.PI])
|
|
147
|
+
cands.push(base + k);
|
|
148
|
+
const out = [at(theta0), [x1, y1]];
|
|
149
|
+
for (const t of cands)
|
|
150
|
+
if (inSweep(t))
|
|
151
|
+
out.push(at(t));
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The bounding box of a path's own coordinate space, or null if it has none
|
|
156
|
+
* (empty string, no drawable command, non-finite numbers).
|
|
157
|
+
*/
|
|
158
|
+
export function pathBBox(d) {
|
|
159
|
+
if (typeof d !== "string" || !d.trim())
|
|
160
|
+
return null;
|
|
161
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
162
|
+
const hit = (x, y) => {
|
|
163
|
+
if (!Number.isFinite(x) || !Number.isFinite(y))
|
|
164
|
+
return;
|
|
165
|
+
if (x < minX)
|
|
166
|
+
minX = x;
|
|
167
|
+
if (x > maxX)
|
|
168
|
+
maxX = x;
|
|
169
|
+
if (y < minY)
|
|
170
|
+
minY = y;
|
|
171
|
+
if (y > maxY)
|
|
172
|
+
maxY = y;
|
|
173
|
+
};
|
|
174
|
+
const ts = [...tokens(d)];
|
|
175
|
+
let i = 0, cmd = "", cx = 0, cy = 0, sx = 0, sy = 0;
|
|
176
|
+
// Previous curve control point, for S/T reflection.
|
|
177
|
+
let px = null, py = null, pq = false;
|
|
178
|
+
const num = () => Number(ts[i++]);
|
|
179
|
+
while (i < ts.length) {
|
|
180
|
+
if (isCmd(ts[i])) {
|
|
181
|
+
cmd = ts[i];
|
|
182
|
+
i++;
|
|
183
|
+
if (cmd === "Z" || cmd === "z") {
|
|
184
|
+
cx = sx;
|
|
185
|
+
cy = sy;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (!cmd) {
|
|
190
|
+
i++;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
// Implicit repetition: a moveto's extra pairs are linetos.
|
|
194
|
+
else if (cmd === "M")
|
|
195
|
+
cmd = "L";
|
|
196
|
+
else if (cmd === "m")
|
|
197
|
+
cmd = "l";
|
|
198
|
+
const rel = cmd === cmd.toLowerCase();
|
|
199
|
+
const ox = rel ? cx : 0, oy = rel ? cy : 0;
|
|
200
|
+
switch (cmd.toUpperCase()) {
|
|
201
|
+
case "M": {
|
|
202
|
+
cx = num() + ox;
|
|
203
|
+
cy = num() + oy;
|
|
204
|
+
sx = cx;
|
|
205
|
+
sy = cy;
|
|
206
|
+
hit(cx, cy);
|
|
207
|
+
px = py = null;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
case "L": {
|
|
211
|
+
cx = num() + ox;
|
|
212
|
+
cy = num() + oy;
|
|
213
|
+
hit(cx, cy);
|
|
214
|
+
px = py = null;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case "H": {
|
|
218
|
+
cx = num() + ox;
|
|
219
|
+
hit(cx, cy);
|
|
220
|
+
px = py = null;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case "V": {
|
|
224
|
+
cy = num() + oy;
|
|
225
|
+
hit(cx, cy);
|
|
226
|
+
px = py = null;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
case "C": {
|
|
230
|
+
const x1 = num() + ox, y1 = num() + oy, x2 = num() + ox, y2 = num() + oy, x = num() + ox, y = num() + oy;
|
|
231
|
+
hit(cx, cy);
|
|
232
|
+
hit(x, y);
|
|
233
|
+
for (const v of cubicExtrema(cx, x1, x2, x))
|
|
234
|
+
hit(v, cy);
|
|
235
|
+
for (const v of cubicExtrema(cy, y1, y2, y))
|
|
236
|
+
hit(cx, v);
|
|
237
|
+
px = x2;
|
|
238
|
+
py = y2;
|
|
239
|
+
pq = false;
|
|
240
|
+
cx = x;
|
|
241
|
+
cy = y;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
case "S": {
|
|
245
|
+
const rx = pq || px === null ? cx : 2 * cx - px, ry = pq || py === null ? cy : 2 * cy - py;
|
|
246
|
+
const x2 = num() + ox, y2 = num() + oy, x = num() + ox, y = num() + oy;
|
|
247
|
+
hit(cx, cy);
|
|
248
|
+
hit(x, y);
|
|
249
|
+
for (const v of cubicExtrema(cx, rx, x2, x))
|
|
250
|
+
hit(v, cy);
|
|
251
|
+
for (const v of cubicExtrema(cy, ry, y2, y))
|
|
252
|
+
hit(cx, v);
|
|
253
|
+
px = x2;
|
|
254
|
+
py = y2;
|
|
255
|
+
pq = false;
|
|
256
|
+
cx = x;
|
|
257
|
+
cy = y;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
case "Q": {
|
|
261
|
+
const x1 = num() + ox, y1 = num() + oy, x = num() + ox, y = num() + oy;
|
|
262
|
+
hit(cx, cy);
|
|
263
|
+
hit(x, y);
|
|
264
|
+
for (const v of quadExtrema(cx, x1, x))
|
|
265
|
+
hit(v, cy);
|
|
266
|
+
for (const v of quadExtrema(cy, y1, y))
|
|
267
|
+
hit(cx, v);
|
|
268
|
+
px = x1;
|
|
269
|
+
py = y1;
|
|
270
|
+
pq = true;
|
|
271
|
+
cx = x;
|
|
272
|
+
cy = y;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case "T": {
|
|
276
|
+
const rqx = !pq || px === null ? cx : 2 * cx - px;
|
|
277
|
+
const rqy = !pq || py === null ? cy : 2 * cy - py;
|
|
278
|
+
const x = num() + ox, y = num() + oy;
|
|
279
|
+
hit(cx, cy);
|
|
280
|
+
hit(x, y);
|
|
281
|
+
for (const v of quadExtrema(cx, rqx, x))
|
|
282
|
+
hit(v, cy);
|
|
283
|
+
for (const v of quadExtrema(cy, rqy, y))
|
|
284
|
+
hit(cx, v);
|
|
285
|
+
px = rqx;
|
|
286
|
+
py = rqy;
|
|
287
|
+
pq = true;
|
|
288
|
+
cx = x;
|
|
289
|
+
cy = y;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case "A": {
|
|
293
|
+
const rx = num(), ry = num(), rot = num(), la = num() !== 0, sw = num() !== 0;
|
|
294
|
+
const x = num() + ox, y = num() + oy;
|
|
295
|
+
for (const [ax, ay] of arcExtrema(cx, cy, rx, ry, rot, la, sw, x, y))
|
|
296
|
+
hit(ax, ay);
|
|
297
|
+
px = py = null;
|
|
298
|
+
cx = x;
|
|
299
|
+
cy = y;
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
default:
|
|
303
|
+
i++;
|
|
304
|
+
break; // unknown letter: skip rather than loop forever
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (!Number.isFinite(minX) || !Number.isFinite(minY))
|
|
308
|
+
return null;
|
|
309
|
+
return { minX, minY, maxX, maxY };
|
|
310
|
+
}
|
|
311
|
+
/** The centre of `pathBBox`, or null. */
|
|
312
|
+
export function pathCentre(d) {
|
|
313
|
+
const b = pathBBox(d);
|
|
314
|
+
return b ? { cx: (b.minX + b.maxX) / 2, cy: (b.minY + b.maxY) / 2 } : null;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Rewrite `d` so its own bounding box is centred on the origin, and report how
|
|
318
|
+
* far it moved. Feeding that offset back into the item's x/y leaves the drawn
|
|
319
|
+
* result IDENTICAL — it is a pure change of coordinates — while making `x,y`
|
|
320
|
+
* mean the centre for a path, as it already does for every other shape.
|
|
321
|
+
*/
|
|
322
|
+
export function recentrePath(d) {
|
|
323
|
+
const c = pathCentre(d);
|
|
324
|
+
if (!c || (c.cx === 0 && c.cy === 0))
|
|
325
|
+
return null;
|
|
326
|
+
// shiftPath, not a blind numeric replace: an arc's radii, rotation and flags
|
|
327
|
+
// are not coordinates, and shifting a sweep flag turns the arc inside out.
|
|
328
|
+
return { path: shiftPath(d, -c.cx, -c.cy), dx: c.cx, dy: c.cy };
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Translate every COORDINATE in `d` by (dx,dy), leaving relative commands,
|
|
332
|
+
* arc radii, rotation and flags alone. Relative commands describe deltas, so
|
|
333
|
+
* they are already translation-invariant; only absolute ones move.
|
|
334
|
+
*/
|
|
335
|
+
export function shiftPath(d, dx, dy) {
|
|
336
|
+
const ts = [...tokens(d)];
|
|
337
|
+
const out = [];
|
|
338
|
+
let cmd = "", i = 0;
|
|
339
|
+
// The first moveto anchors the path. A leading `m` is relative to the
|
|
340
|
+
// implicit origin — i.e. absolute — so it shifts like an `M`; a later `m` is
|
|
341
|
+
// a genuine delta and must not. Missing this left relative paths uncentred.
|
|
342
|
+
let seenMove = false;
|
|
343
|
+
const r = (v) => String(Math.round(v * 1e4) / 1e4);
|
|
344
|
+
while (i < ts.length) {
|
|
345
|
+
const t = ts[i];
|
|
346
|
+
if (isCmd(t)) {
|
|
347
|
+
cmd = t;
|
|
348
|
+
out.push(t);
|
|
349
|
+
i++;
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if (!cmd) {
|
|
353
|
+
out.push(t);
|
|
354
|
+
i++;
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
const U = cmd.toUpperCase();
|
|
358
|
+
const leadingMove = U === "M" && !seenMove;
|
|
359
|
+
const rel = cmd === cmd.toLowerCase() && !leadingMove;
|
|
360
|
+
if (U === "M")
|
|
361
|
+
seenMove = true;
|
|
362
|
+
const take = (n, shift) => {
|
|
363
|
+
for (let k = 0; k < n && i < ts.length; k++) {
|
|
364
|
+
const v = Number(ts[i++]);
|
|
365
|
+
const s = shift[k];
|
|
366
|
+
out.push(rel || s === null ? String(v) : r(v + (s === 0 ? dx : dy)));
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
switch (U) {
|
|
370
|
+
// A LEADING `m` IS ABSOLUTE; ITS IMPLICIT LINETOS ARE NOT.
|
|
371
|
+
//
|
|
372
|
+
// The follow-on command was taken from `rel`, which had just been forced
|
|
373
|
+
// false to make the leading moveto shift — so `m x y a b` continued as an
|
|
374
|
+
// ABSOLUTE `L` and the implicit lineto was shifted like a coordinate. It
|
|
375
|
+
// is a delta. Measured on an Open Peeps face: `m182.2 226 .7-.2` shifted
|
|
376
|
+
// by (315,248) became `m 497.2 474 315.7 247.8` — a 0.7-unit detail
|
|
377
|
+
// turned into a 300-unit line drawn across the frame, and every optimised
|
|
378
|
+
// SVG in the world starts exactly like that.
|
|
379
|
+
//
|
|
380
|
+
// The command's own case is the answer, not the leading-move exception.
|
|
381
|
+
case "M":
|
|
382
|
+
case "L":
|
|
383
|
+
case "T":
|
|
384
|
+
take(2, [0, 1]);
|
|
385
|
+
if (U === "M")
|
|
386
|
+
cmd = cmd === "m" ? "l" : "L";
|
|
387
|
+
break;
|
|
388
|
+
case "H":
|
|
389
|
+
take(1, [0]);
|
|
390
|
+
break;
|
|
391
|
+
case "V":
|
|
392
|
+
take(1, [1]);
|
|
393
|
+
break;
|
|
394
|
+
case "C":
|
|
395
|
+
take(6, [0, 1, 0, 1, 0, 1]);
|
|
396
|
+
break;
|
|
397
|
+
case "S":
|
|
398
|
+
case "Q":
|
|
399
|
+
take(4, [0, 1, 0, 1]);
|
|
400
|
+
break;
|
|
401
|
+
// rx ry rot large sweep x y — only the endpoint is a coordinate.
|
|
402
|
+
case "A":
|
|
403
|
+
take(7, [null, null, null, null, null, 0, 1]);
|
|
404
|
+
break;
|
|
405
|
+
case "Z": break;
|
|
406
|
+
default:
|
|
407
|
+
out.push(ts[i++]);
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
// Re-join with the spacing SVG readers expect; commands keep their letters.
|
|
412
|
+
return out.join(" ").replace(/\s+/g, " ").trim();
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Scale every LENGTH in `d` by (sx,sy) about the origin.
|
|
416
|
+
*
|
|
417
|
+
* The sibling of shiftPath, and the difference between them is the whole
|
|
418
|
+
* subtlety: a translation leaves relative commands alone because a delta is
|
|
419
|
+
* translation-invariant, and a scale does NOT — a delta is a length, and
|
|
420
|
+
* lengths scale. Getting that backwards leaves a figure whose absolute
|
|
421
|
+
* anchors move and whose curves keep their original size, which reads as the
|
|
422
|
+
* drawing coming apart rather than as a wrong scale.
|
|
423
|
+
*
|
|
424
|
+
* An arc's radii scale; its x-axis rotation and its two flags are not lengths
|
|
425
|
+
* and must be left exactly as they are. Written for baking external artwork
|
|
426
|
+
* into the design graph — a corpus asset arrives in its own coordinate space
|
|
427
|
+
* and has to be placed in the frame's.
|
|
428
|
+
*
|
|
429
|
+
* NON-UNIFORM SCALING OF AN ARC IS APPROXIMATE: an ellipse under an unequal
|
|
430
|
+
* scale needs its rotation adjusted too, which is a longer computation than it
|
|
431
|
+
* is worth here. Stated rather than hidden; every caller so far scales
|
|
432
|
+
* uniformly, and the corpus paths carry no arcs.
|
|
433
|
+
*/
|
|
434
|
+
export function scalePath(d, sx, sy = sx) {
|
|
435
|
+
const ts = [...tokens(d)];
|
|
436
|
+
const out = [];
|
|
437
|
+
let cmd = "", i = 0;
|
|
438
|
+
const r = (v) => String(Math.round(v * 1e4) / 1e4);
|
|
439
|
+
while (i < ts.length) {
|
|
440
|
+
const t = ts[i];
|
|
441
|
+
if (isCmd(t)) {
|
|
442
|
+
cmd = t;
|
|
443
|
+
out.push(t);
|
|
444
|
+
i++;
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
if (!cmd) {
|
|
448
|
+
out.push(t);
|
|
449
|
+
i++;
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
const U = cmd.toUpperCase();
|
|
453
|
+
// `axis` is 0 for an x length, 1 for a y length, null for something that is
|
|
454
|
+
// not a length at all.
|
|
455
|
+
const take = (n, axis) => {
|
|
456
|
+
for (let k = 0; k < n && i < ts.length; k++) {
|
|
457
|
+
const v = Number(ts[i++]);
|
|
458
|
+
const a = axis[k];
|
|
459
|
+
out.push(a === null ? String(v) : r(v * (a === 0 ? sx : sy)));
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
switch (U) {
|
|
463
|
+
case "M":
|
|
464
|
+
case "L":
|
|
465
|
+
case "T":
|
|
466
|
+
take(2, [0, 1]);
|
|
467
|
+
if (U === "M")
|
|
468
|
+
cmd = cmd === "m" ? "l" : "L";
|
|
469
|
+
break;
|
|
470
|
+
case "H":
|
|
471
|
+
take(1, [0]);
|
|
472
|
+
break;
|
|
473
|
+
case "V":
|
|
474
|
+
take(1, [1]);
|
|
475
|
+
break;
|
|
476
|
+
case "C":
|
|
477
|
+
take(6, [0, 1, 0, 1, 0, 1]);
|
|
478
|
+
break;
|
|
479
|
+
case "S":
|
|
480
|
+
case "Q":
|
|
481
|
+
take(4, [0, 1, 0, 1]);
|
|
482
|
+
break;
|
|
483
|
+
// rx ry rot large sweep x y — the radii and the endpoint are lengths;
|
|
484
|
+
// the rotation and the two flags are not.
|
|
485
|
+
case "A":
|
|
486
|
+
take(7, [0, 1, null, null, null, 0, 1]);
|
|
487
|
+
break;
|
|
488
|
+
case "Z": break;
|
|
489
|
+
default:
|
|
490
|
+
out.push(ts[i++]);
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return out.join(" ").replace(/\s+/g, " ").trim();
|
|
495
|
+
}
|
|
496
|
+
//# sourceMappingURL=path-bbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-bbox.js","sourceRoot":"","sources":["../../src/character/path-bbox.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,iEAAiE;AACjE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAS;IACxB,MAAM,EAAE,GAAG,sDAAsD,CAAC;IAClE,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhE,6DAA6D;AAC7D,SAAS,SAAS,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAChD,MA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,CAAC;gBAAC,MAAM;YAC9B,KAAK,GAAG;gBAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;YAC9B,KAAK,GAAG;gBAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;YAC7C,KAAK,GAAG,CAAC;YAAC,KAAK,GAAG;gBAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;YACjD,sEAAsE;YACtE,0CAA0C;YAC1C,KAAK,GAAG;gBAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;YACzD,KAAK,GAAG,CAAC,CAAC,MAAM;YAChB;gBAAS,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,CAAE,CAAC,CAAC;gBAAC,MAAM;QACrC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
export interface CharacterPart {
|
|
2
|
+
at: [number, number];
|
|
3
|
+
path: string;
|
|
4
|
+
fill?: string;
|
|
5
|
+
/**
|
|
6
|
+
* HOW MUCH OF THE STYLE'S INK THIS PART TAKES. 1 (default) is the full
|
|
7
|
+
* silhouette weight; a fraction is interior linework; 0 is unlined.
|
|
8
|
+
*
|
|
9
|
+
* ONE WEIGHT FOR EVERYTHING IS WHAT MAKES A FIGURE READ AS STICKERS. The ink
|
|
10
|
+
* rule already refuses to outline a part that is itself ink, which stopped
|
|
11
|
+
* faces smearing — but every other part got the identical silhouette stroke,
|
|
12
|
+
* so a wing lying ON a body was drawn with exactly the line that separates
|
|
13
|
+
* the body from the sky. Rendered at 0.6s and 0.9s of `ledge-at-dusk`, the
|
|
14
|
+
* pigeon reads as a circle-with-an-outline sitting on an ellipse-with-an-
|
|
15
|
+
* outline: the seams between primitives are drawn at full strength, which is
|
|
16
|
+
* the "the head is not connected" complaint in one sentence.
|
|
17
|
+
*
|
|
18
|
+
* Flat illustration has a hierarchy — a heavy contour where form meets
|
|
19
|
+
* background, a lighter line where form meets form. This is that, as a
|
|
20
|
+
* property of the drawing rather than a constant in the renderer.
|
|
21
|
+
*/
|
|
22
|
+
inkWeight?: number;
|
|
23
|
+
/**
|
|
24
|
+
* THE BONE. Which part carries this one.
|
|
25
|
+
*
|
|
26
|
+
* Everything Rive and Lottie do to keep a figure whole, this one field does:
|
|
27
|
+
* a carried part has NO motion of its own, it inherits its carrier's, so the
|
|
28
|
+
* beak cannot lag the skull because the beak is not animated at all.
|
|
29
|
+
*
|
|
30
|
+
* What it replaces is coordination by duplication. `pp:Pigeon` kept the head
|
|
31
|
+
* together with FOUR channels — bob, bobCollar, bobBeak, bobEye — each
|
|
32
|
+
* independently declaring amplitude 0.62, 800ms, easeInOut and spanPart
|
|
33
|
+
* "head", and each computing its own keyframes from those numbers. Agreement
|
|
34
|
+
* was a coincidence maintained by hand, and the concept file records what it
|
|
35
|
+
* cost: the neck tore open at the shoulder, was "fixed" by cutting the
|
|
36
|
+
* amplitude to 0.22 — which fixed the tear by deleting the motion, measured
|
|
37
|
+
* at SSIM 0.9824, a still with a tremor — and the verdict on that was
|
|
38
|
+
* "nothing believable". The amplitude went back to 0.62 and the tear came
|
|
39
|
+
* back with it, because five copies of a number is not a rig.
|
|
40
|
+
*
|
|
41
|
+
* We have shipped, separately, every divergence needed to tear it: easings
|
|
42
|
+
* resolving to linear, clocks wrapping at the last keyframe, a rest scale
|
|
43
|
+
* applied twice. Any one of them hits one channel and not its siblings.
|
|
44
|
+
*
|
|
45
|
+
* With a carrier the question cannot arise. One track is computed, for the
|
|
46
|
+
* carrier, and every part bound to it is displaced by that same track.
|
|
47
|
+
*/
|
|
48
|
+
carriedBy?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface CharacterDepiction {
|
|
51
|
+
concept: string;
|
|
52
|
+
height: number;
|
|
53
|
+
palette: Record<string, string>;
|
|
54
|
+
parts: Record<string, CharacterPart>;
|
|
55
|
+
/**
|
|
56
|
+
* The style's ink, applied to every part as it is drawn.
|
|
57
|
+
*
|
|
58
|
+
* A STYLE IS NOT A PROPERTY OF THE DRAWING. `explainer-ink` declares a 4px
|
|
59
|
+
* #1b1b1b outline and no depiction part has ever carried a stroke role, so
|
|
60
|
+
* the ink was never applied to anything. It showed as soon as corpus art
|
|
61
|
+
* arrived: a flat-filled bird dropped into a scene whose brief says
|
|
62
|
+
* "everything outlined in one dark ink" reads as pasted in from somewhere
|
|
63
|
+
* else, because it was.
|
|
64
|
+
*
|
|
65
|
+
* Inking here rather than baking it into the geometry is what lets one
|
|
66
|
+
* drawing serve several styles — which is the entire reason depiction and
|
|
67
|
+
* style are separate rows.
|
|
68
|
+
*/
|
|
69
|
+
ink?: {
|
|
70
|
+
color: string;
|
|
71
|
+
width: number;
|
|
72
|
+
join?: string;
|
|
73
|
+
cap?: string;
|
|
74
|
+
union?: boolean;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** A named channel on the concept — how a symbol becomes a change on a part. */
|
|
78
|
+
export interface Channel {
|
|
79
|
+
name: string;
|
|
80
|
+
kind: "alternate" | "alternate-cycle" | "speak" | "shift" | "transform" | "cycle";
|
|
81
|
+
base?: string;
|
|
82
|
+
alternate?: string;
|
|
83
|
+
/** For `speak`: the mouth shapes, closed first, most open last. */
|
|
84
|
+
states?: string[];
|
|
85
|
+
holdMs?: number;
|
|
86
|
+
rateHz?: number;
|
|
87
|
+
/** For `speak`: syllables per second, before the rhythm varies it. */
|
|
88
|
+
syllablesPerSecond?: number;
|
|
89
|
+
unitsPerValue?: number;
|
|
90
|
+
/** The part(s) a channel acts on. A list means "these move as one thing". */
|
|
91
|
+
part?: string | string[];
|
|
92
|
+
property?: "scaleX" | "scaleY" | "rotation" | "x" | "y" | "opacity";
|
|
93
|
+
/** Resting value, and the value at the peak of the gesture. */
|
|
94
|
+
rest?: number;
|
|
95
|
+
peak?: number;
|
|
96
|
+
/** Time to reach the peak and to come back, in ms. */
|
|
97
|
+
attackMs?: number;
|
|
98
|
+
releaseMs?: number;
|
|
99
|
+
easing?: string;
|
|
100
|
+
/** For `cycle`: how far, as a FRACTION of the part for x/y, degrees for rotation. */
|
|
101
|
+
amplitude?: number;
|
|
102
|
+
/**
|
|
103
|
+
* For `cycle`: measure the amplitude against ANOTHER part's size.
|
|
104
|
+
*
|
|
105
|
+
* A beak and an eye sit ON a head. When the head is thrown forward they
|
|
106
|
+
* travel exactly as far as it does — they are carried, not independently
|
|
107
|
+
* animated. Reading the fraction off each part's own span made a small part
|
|
108
|
+
* move a small distance, so a pigeon's beak lagged its head by tens of
|
|
109
|
+
* pixels mid-bob and the face came apart, which is the same failure as
|
|
110
|
+
* rotating each part about its own centre instead of shifting the figure.
|
|
111
|
+
*/
|
|
112
|
+
spanPart?: string;
|
|
113
|
+
/** For `cycle`: one throw and recovery, in ms. */
|
|
114
|
+
durationMs?: number;
|
|
115
|
+
}
|
|
116
|
+
/** One instruction: at this instant, on this channel. */
|
|
117
|
+
export interface Beat {
|
|
118
|
+
at: number;
|
|
119
|
+
channel: string;
|
|
120
|
+
/** For `shift` channels: how far, in channel units (negative is left). */
|
|
121
|
+
value?: number;
|
|
122
|
+
/** For channels that occupy a span rather than an instant. */
|
|
123
|
+
until?: number;
|
|
124
|
+
}
|
|
125
|
+
export interface PerformInput {
|
|
126
|
+
id: string;
|
|
127
|
+
depiction: CharacterDepiction;
|
|
128
|
+
at: {
|
|
129
|
+
x: number;
|
|
130
|
+
y: number;
|
|
131
|
+
};
|
|
132
|
+
height: number;
|
|
133
|
+
channels: Channel[];
|
|
134
|
+
beats: Beat[];
|
|
135
|
+
/** Total scene duration, so tracks can be written across it. */
|
|
136
|
+
durationSeconds: number;
|
|
137
|
+
}
|
|
138
|
+
type Op = {
|
|
139
|
+
tool: string;
|
|
140
|
+
args: Record<string, unknown>;
|
|
141
|
+
};
|
|
142
|
+
export declare function performCharacter(input: PerformInput): {
|
|
143
|
+
ops: Op[];
|
|
144
|
+
parts: string[];
|
|
145
|
+
tracks: number;
|
|
146
|
+
unknownChannels: string[];
|
|
147
|
+
};
|
|
148
|
+
export {};
|
|
149
|
+
//# sourceMappingURL=perform.d.ts.map
|