@anime-studio/director 0.3.0 → 0.5.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.
Files changed (134) hide show
  1. package/dist/describe.d.ts +1 -1
  2. package/dist/direct/arcs.d.ts +17 -0
  3. package/dist/direct/arcs.d.ts.map +1 -0
  4. package/dist/direct/arcs.js +76 -0
  5. package/dist/direct/arcs.js.map +1 -0
  6. package/dist/direct/arms.d.ts +46 -0
  7. package/dist/direct/arms.d.ts.map +1 -0
  8. package/dist/direct/arms.js +233 -0
  9. package/dist/direct/arms.js.map +1 -0
  10. package/dist/direct/beat.d.ts +7 -0
  11. package/dist/direct/beat.d.ts.map +1 -0
  12. package/dist/direct/beat.js +339 -0
  13. package/dist/direct/beat.js.map +1 -0
  14. package/dist/direct/build.d.ts +7 -0
  15. package/dist/direct/build.d.ts.map +1 -0
  16. package/dist/direct/build.js +152 -0
  17. package/dist/direct/build.js.map +1 -0
  18. package/dist/direct/camera.d.ts +38 -0
  19. package/dist/direct/camera.d.ts.map +1 -0
  20. package/dist/direct/camera.js +279 -0
  21. package/dist/direct/camera.js.map +1 -0
  22. package/dist/direct/cast.d.ts +45 -0
  23. package/dist/direct/cast.d.ts.map +1 -0
  24. package/dist/direct/cast.js +172 -0
  25. package/dist/direct/cast.js.map +1 -0
  26. package/dist/direct/check.d.ts +17 -0
  27. package/dist/direct/check.d.ts.map +1 -0
  28. package/dist/direct/check.js +270 -0
  29. package/dist/direct/check.js.map +1 -0
  30. package/dist/direct/contact.d.ts +28 -0
  31. package/dist/direct/contact.d.ts.map +1 -0
  32. package/dist/direct/contact.js +222 -0
  33. package/dist/direct/contact.js.map +1 -0
  34. package/dist/direct/dialogue.d.ts +19 -0
  35. package/dist/direct/dialogue.d.ts.map +1 -0
  36. package/dist/direct/dialogue.js +110 -0
  37. package/dist/direct/dialogue.js.map +1 -0
  38. package/dist/direct/episode.d.ts +10 -0
  39. package/dist/direct/episode.d.ts.map +1 -0
  40. package/dist/direct/episode.js +286 -0
  41. package/dist/direct/episode.js.map +1 -0
  42. package/dist/direct/fixtures.d.ts +29 -0
  43. package/dist/direct/fixtures.d.ts.map +1 -0
  44. package/dist/direct/fixtures.js +147 -0
  45. package/dist/direct/fixtures.js.map +1 -0
  46. package/dist/direct/flight.d.ts +23 -0
  47. package/dist/direct/flight.d.ts.map +1 -0
  48. package/dist/direct/flight.js +110 -0
  49. package/dist/direct/flight.js.map +1 -0
  50. package/dist/direct/furniture.d.ts +59 -0
  51. package/dist/direct/furniture.d.ts.map +1 -0
  52. package/dist/direct/furniture.js +149 -0
  53. package/dist/direct/furniture.js.map +1 -0
  54. package/dist/direct/gestures.d.ts +31 -0
  55. package/dist/direct/gestures.d.ts.map +1 -0
  56. package/dist/direct/gestures.js +211 -0
  57. package/dist/direct/gestures.js.map +1 -0
  58. package/dist/direct/graphics.d.ts +20 -0
  59. package/dist/direct/graphics.d.ts.map +1 -0
  60. package/dist/direct/graphics.js +282 -0
  61. package/dist/direct/graphics.js.map +1 -0
  62. package/dist/direct/hand-holding.d.ts +28 -0
  63. package/dist/direct/hand-holding.d.ts.map +1 -0
  64. package/dist/direct/hand-holding.js +187 -0
  65. package/dist/direct/hand-holding.js.map +1 -0
  66. package/dist/direct/hiding.d.ts +19 -0
  67. package/dist/direct/hiding.d.ts.map +1 -0
  68. package/dist/direct/hiding.js +173 -0
  69. package/dist/direct/hiding.js.map +1 -0
  70. package/dist/direct/life.d.ts +67 -0
  71. package/dist/direct/life.d.ts.map +1 -0
  72. package/dist/direct/life.js +275 -0
  73. package/dist/direct/life.js.map +1 -0
  74. package/dist/direct/lighting.d.ts +22 -0
  75. package/dist/direct/lighting.d.ts.map +1 -0
  76. package/dist/direct/lighting.js +86 -0
  77. package/dist/direct/lighting.js.map +1 -0
  78. package/dist/direct/lying.d.ts +24 -0
  79. package/dist/direct/lying.d.ts.map +1 -0
  80. package/dist/direct/lying.js +205 -0
  81. package/dist/direct/lying.js.map +1 -0
  82. package/dist/direct/motion.d.ts +50 -0
  83. package/dist/direct/motion.d.ts.map +1 -0
  84. package/dist/direct/motion.js +270 -0
  85. package/dist/direct/motion.js.map +1 -0
  86. package/dist/direct/pictures.d.ts +24 -0
  87. package/dist/direct/pictures.d.ts.map +1 -0
  88. package/dist/direct/pictures.js +265 -0
  89. package/dist/direct/pictures.js.map +1 -0
  90. package/dist/direct/props-in-hand.d.ts +71 -0
  91. package/dist/direct/props-in-hand.d.ts.map +1 -0
  92. package/dist/direct/props-in-hand.js +285 -0
  93. package/dist/direct/props-in-hand.js.map +1 -0
  94. package/dist/direct/props.d.ts +32 -0
  95. package/dist/direct/props.d.ts.map +1 -0
  96. package/dist/direct/props.js +118 -0
  97. package/dist/direct/props.js.map +1 -0
  98. package/dist/direct/riding.d.ts +76 -0
  99. package/dist/direct/riding.d.ts.map +1 -0
  100. package/dist/direct/riding.js +290 -0
  101. package/dist/direct/riding.js.map +1 -0
  102. package/dist/direct/scene.d.ts +322 -0
  103. package/dist/direct/scene.d.ts.map +1 -0
  104. package/dist/direct/scene.js +287 -0
  105. package/dist/direct/scene.js.map +1 -0
  106. package/dist/direct/shared.d.ts +87 -0
  107. package/dist/direct/shared.d.ts.map +1 -0
  108. package/dist/direct/shared.js +42 -0
  109. package/dist/direct/shared.js.map +1 -0
  110. package/dist/direct/sitting.d.ts +62 -0
  111. package/dist/direct/sitting.d.ts.map +1 -0
  112. package/dist/direct/sitting.js +320 -0
  113. package/dist/direct/sitting.js.map +1 -0
  114. package/dist/direct/throws.d.ts +14 -0
  115. package/dist/direct/throws.d.ts.map +1 -0
  116. package/dist/direct/throws.js +89 -0
  117. package/dist/direct/throws.js.map +1 -0
  118. package/dist/direct/timeline.d.ts +23 -0
  119. package/dist/direct/timeline.d.ts.map +1 -0
  120. package/dist/direct/timeline.js +90 -0
  121. package/dist/direct/timeline.js.map +1 -0
  122. package/dist/direct/timing.d.ts +50 -0
  123. package/dist/direct/timing.d.ts.map +1 -0
  124. package/dist/direct/timing.js +138 -0
  125. package/dist/direct/timing.js.map +1 -0
  126. package/dist/direct/vocabulary.d.ts +33 -0
  127. package/dist/direct/vocabulary.d.ts.map +1 -0
  128. package/dist/direct/vocabulary.js +56 -0
  129. package/dist/direct/vocabulary.js.map +1 -0
  130. package/dist/direct.d.ts +8 -87
  131. package/dist/direct.d.ts.map +1 -1
  132. package/dist/direct.js +8 -6076
  133. package/dist/direct.js.map +1 -1
  134. package/package.json +3 -3
@@ -52,7 +52,7 @@ export declare function describeKit(kit: Kit): {
52
52
  wear: Record<string, string[]>;
53
53
  };
54
54
  };
55
- fx: ("anger" | "aura" | "birds" | "burst" | "caption" | "dust" | "exclaim" | "focusLines" | "ghost" | "gloom" | "hearts" | "impact" | "impactFrame" | "lightbulb" | "notes" | "question" | "sparkle" | "speedLines" | "stars" | "surprise" | "sweat" | "zzz")[];
55
+ fx: ("anger" | "aura" | "beam" | "birds" | "burst" | "caption" | "dust" | "exclaim" | "explosion" | "fire" | "focusLines" | "ghost" | "gloom" | "hearts" | "impact" | "impactFrame" | "lightbulb" | "lightning" | "magicCircle" | "notes" | "question" | "shockwave" | "smoke" | "sparkle" | "speedLines" | "splash" | "stars" | "surprise" | "sweat" | "zzz")[];
56
56
  cameras: string[];
57
57
  actions: string[];
58
58
  lightMoods: string[];
@@ -0,0 +1,17 @@
1
+ /**
2
+ * IK moves along arcs (`animation.arcs`): every pair of `set`s moving one chain's target on both
3
+ * axes (`ik.<id>.x` and `.y`, same actor, moment and duration, eased) gets a key halfway, pushed
4
+ * across the chord by `arcs × 0.3 × |chord|` away from the chain's root (unknown, or on the chord's
5
+ * line: upwards; a vertical chord there: forwards), as the scene's reach blends do. The two halves
6
+ * keep the move's sineInOut along the chord and meet at the midpoint at its speed (cubic-bezier
7
+ * eases per axis), so the hand flows through it. `joints` gives the chain's root and rest tip
8
+ * (character space). A pair taking over a move still under way, or taken over itself, is left straight.
9
+ */
10
+ export declare function arcIk<A extends Record<string, unknown> & {
11
+ at: number;
12
+ action: string;
13
+ }>(script: A[], arcs: number, joints: (actor: string, chain: string) => {
14
+ rest?: [number, number];
15
+ root?: [number, number];
16
+ } | undefined): A[];
17
+ //# sourceMappingURL=arcs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcs.d.ts","sourceRoot":"","sources":["../../src/direct/arcs.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK;IAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,SAAS,GAAG,CAAC,EAAE,CAoDpO"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * IK moves along arcs (`animation.arcs`).
3
+ */
4
+ import { r3 } from "./shared.js";
5
+ /**
6
+ * IK moves along arcs (`animation.arcs`): every pair of `set`s moving one chain's target on both
7
+ * axes (`ik.<id>.x` and `.y`, same actor, moment and duration, eased) gets a key halfway, pushed
8
+ * across the chord by `arcs × 0.3 × |chord|` away from the chain's root (unknown, or on the chord's
9
+ * line: upwards; a vertical chord there: forwards), as the scene's reach blends do. The two halves
10
+ * keep the move's sineInOut along the chord and meet at the midpoint at its speed (cubic-bezier
11
+ * eases per axis), so the hand flows through it. `joints` gives the chain's root and rest tip
12
+ * (character space). A pair taking over a move still under way, or taken over itself, is left straight.
13
+ */
14
+ export function arcIk(script, arcs, joints) {
15
+ if (!(arcs > 0))
16
+ return script;
17
+ const IK = /^ik\.(.+)\.(x|y)$/;
18
+ const sets = script.filter((a) => a.action === "set" && typeof a.channel === "string" && IK.test(a.channel));
19
+ const out = [...script];
20
+ for (const x of sets) {
21
+ const [, chain, axis] = IK.exec(x.channel);
22
+ if (axis !== "x")
23
+ continue;
24
+ const dur = x.duration ?? 0;
25
+ if (!(dur > 0) || x.ease === "linear" || x.ease === "step")
26
+ continue;
27
+ const y = sets.find((s) => s.actor === x.actor && s.channel === `ik.${chain}.y` && Math.abs(s.at - x.at) < 1e-6 && Math.abs((s.duration ?? 0) - dur) < 1e-6 && s.ease === x.ease);
28
+ if (!y || typeof x.value !== "number" || typeof y.value !== "number")
29
+ continue;
30
+ // Where the target was: the last set of each axis, ended by then (else it is taken over mid-move).
31
+ const before = (ch) => sets.filter((s) => s.actor === x.actor && s.channel === ch && s.at < x.at - 1e-6).sort((p, q) => p.at - q.at).pop();
32
+ const px = before(x.channel), py = before(y.channel);
33
+ if ([px, py].some((p) => p && p.at + (p.duration ?? 0) > x.at + 1e-6))
34
+ continue;
35
+ // (Nor one taken over before it arrives: its second half would never play.)
36
+ if (sets.some((s) => s.actor === x.actor && (s.channel === x.channel || s.channel === y.channel) && s.at > x.at + 1e-6 && s.at < x.at + dur - 1e-6))
37
+ continue;
38
+ const p0 = [Number(px?.value ?? 0) || 0, Number(py?.value ?? 0) || 0];
39
+ const p1 = [x.value, y.value];
40
+ const cx = p1[0] - p0[0], cy = p1[1] - p0[1], len = Math.hypot(cx, cy);
41
+ if (len < 1)
42
+ continue;
43
+ // Across the chord, away from the root (the target offsets are from the rest tip).
44
+ const j = joints(x.actor, chain);
45
+ let nx = -cy / len, ny = cx / len;
46
+ const rest = j?.rest ?? [0, 0];
47
+ const side = j?.root ? (j.root[0] - (rest[0] + p0[0])) * nx + (j.root[1] - (rest[1] + p0[1])) * ny : 0;
48
+ if (side > 1e-6 * len || (Math.abs(side) <= 1e-6 * len && (ny > 1e-9 || (Math.abs(ny) <= 1e-9 && nx < 0))))
49
+ [nx, ny] = [-nx, -ny];
50
+ const h = arcs * 0.3 * len;
51
+ const mid = [p0[0] + cx / 2 + nx * h, p0[1] + cy / 2 + ny * h].map((v, i) => {
52
+ // (An axis that moves must not land exactly where it started a half: its ease is relative to that change.)
53
+ const c = i ? cy : cx, v1 = r3(v);
54
+ return c !== 0 && (Math.abs(v1 - p0[i]) < 0.01 || Math.abs(p1[i] - v1) < 0.01) ? r3(v1 + 0.01 * Math.sign(c)) : v1;
55
+ });
56
+ // Per axis: into the midpoint from rest at the chord's speed there (π/4 of the axis' chord per
57
+ // half), out of it the same way: cubic-bezier eases with those end slopes (x1 = ⅓, x2 = ⅔: the
58
+ // ease is the cubic itself).
59
+ const half = r3(dur / 2);
60
+ const ease = (from, to, c, end) => {
61
+ const d = to - from;
62
+ if (Math.abs(d) < 1e-6)
63
+ return "sineInOut";
64
+ const m = (c * Math.PI) / 4 / d;
65
+ return end ? [1 / 3, 0, 2 / 3, r3(1 - m / 3)] : [1 / 3, r3(m / 3), 2 / 3, 1];
66
+ };
67
+ for (const [a, i] of [[x, 0], [y, 1]]) {
68
+ const c = i ? cy : cx;
69
+ const into = { ...a, value: mid[i], duration: half, ease: ease(p0[i], mid[i], c, true) };
70
+ const outOf = { ...a, at: r3(a.at + half), value: a.value, duration: r3(dur - half), ease: ease(mid[i], p1[i], c, false) };
71
+ out.splice(out.indexOf(a), 1, into, outOf);
72
+ }
73
+ }
74
+ return out;
75
+ }
76
+ //# sourceMappingURL=arcs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcs.js","sourceRoot":"","sources":["../../src/direct/arcs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CAAqE,MAAW,EAAE,IAAY,EAAE,MAA0G;IAC7N,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC;IAC/B,MAAM,EAAE,GAAG,mBAAmB,CAAC;IAC/B,MAAM,I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,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 2.5D arms: reaching for points in 3D, resting, cutting reaches, taking, holding and putting back props.
3
+ */
4
+ import { type Rig3dValues } from "@anime-studio/core";
5
+ import type { BlockScene } from "./scene.js";
6
+ /**
7
+ * A 2.5D rig's near arm (F) reached in 3D to a body-space point, arriving at `at` after `dur`
8
+ * (the elbow down and out). Returns false for other rigs.
9
+ */
10
+ export declare function arm3d(this: BlockScene, actor: string, target: [number, number, number], at: number, dur: number, side?: "F" | "B", final?: Rig3dValues): boolean;
11
+ /**
12
+ * Drops an arm's moves planned while a new one lasts (it takes over; one under way when it starts
13
+ * turns into it smoothly).
14
+ */
15
+ export declare function cutArm(this: BlockScene, actor: string, side: "F" | "B", from: number, until?: number): void;
16
+ /** A 2.5D rig's arm channels as last set by a moment (else at rest). */
17
+ export declare function armNow(this: BlockScene, actor: string, side: "F" | "B", t: number): Rig3dValues;
18
+ /** The near arm back to where it rests (on the knees, on the floor behind… or hanging). */
19
+ export declare function armRest(this: BlockScene, actor: string, at: number, dur: number, side?: "F" | "B"): void;
20
+ /** A 3D point of the rig (`rig3d.points`) in the actor's current pose. */
21
+ export declare function point3d(this: BlockScene, actor: string, name: string): import("@anime-studio/core").V3 | undefined;
22
+ /**
23
+ * How a prop is held in the hand: by its `grip` (else a third of the way from the point that sat on
24
+ * the body to the other one), standing up — the free end (the other point of its fit) upward.
25
+ */
26
+ export declare function handHold(this: BlockScene, prop: string): {
27
+ grip?: [number, number];
28
+ up?: [number, number];
29
+ };
30
+ /** Held in the hand by its grip, standing up between the fingers. */
31
+ export declare function inHand(this: BlockScene, actor: string, prop: string, at: number): void;
32
+ /**
33
+ * Takes a prop hung on the body (a cigarette from the lips): the near hand goes to it, takes it by
34
+ * its grip and brings it in front of the chest, standing between the fingers.
35
+ */
36
+ export declare function take(this: BlockScene, actor: string, prop: string, at: number): void;
37
+ /** Holds a prop up in front of the chest (taking it from the body first if it hangs there) until `until`. */
38
+ export declare function holdProp(this: BlockScene, actor: string, prop: string, at: number, until?: number): void;
39
+ /** Puts a held prop back where it hung on the body (the lips) and the arm back to rest. */
40
+ export declare function putBack(this: BlockScene, actor: string, prop: string, at: number): void;
41
+ /** The phone / smoke / drink gestures with a held prop that has contact points: `use` it. */
42
+ export declare function useForGesture(this: BlockScene, actor: string, clip: string, at: number, until?: number): boolean;
43
+ export declare function release(this: BlockScene, prop: string, abs: number): void;
44
+ /** Hand position of an actor (scene space) while playing a clip at clip time `ct`. */
45
+ export declare function handIn(this: BlockScene, actor: string, clip: string, ct: number): [number, number];
46
+ //# sourceMappingURL=arms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arms.d.ts","sourceRoot":"","sources":["../../src/direct/arms.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,WAAW,EAA+E,MAAM,oBAAoB,CAAC;AAEnI,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,GAAG,GAAG,GAAS,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAiCrK;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,SAAW,QAWtG;AAED,wEAAwE;AACxE,wBAAgB,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A6F;AAC7F,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,WAoBtG;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAQlE;AAED,sFAAsF;AACtF,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBlG"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * 2.5D arms: reaching for points in 3D, resting, cutting reaches, taking, holding and putting back props.
3
+ */
4
+ import { rig3dPose, reach3d, rig3dPoint, anchorPosition, compileScene } from "@anime-studio/core";
5
+ import { blendValues } from "./check.js";
6
+ /**
7
+ * A 2.5D rig's near arm (F) reached in 3D to a body-space point, arriving at `at` after `dur`
8
+ * (the elbow down and out). Returns false for other rigs.
9
+ */
10
+ export function arm3d(actor, target, at, dur, side = "F", final) {
11
+ const doc = this.kit.characters[this.characterOf(actor)];
12
+ if (!doc?.rig3d?.bones?.[`arm${side}1`] || !doc.rig3d.bones[`arm${side}2`])
13
+ return false;
14
+ // One motion of an arm at a time: this one takes over while it lasts.
15
+ this.cutArm(actor, side, at - dur, at);
16
+ this.armBusy.push({ actor, side, t0: at - dur, t1: at });
17
+ const pose = this.pose3d.get(actor) ?? {};
18
+ const pole = [side === "F" ? -0.5 : 0.5, 1, -0.25];
19
+ // Each pose solved near the one before (no jump to an equivalent way of turning the shoulder).
20
+ let guess = this.armNow(actor, side, at - dur);
21
+ const solve = (p) => (guess = reach3d(doc, `arm${side}1`, `arm${side}2`, p, pose, pole, guess));
22
+ const apply = (v, t, d, ease) => {
23
+ this.inArc = true;
24
+ for (const [b, val] of Object.entries(v))
25
+ for (const [k, x] of Object.entries(val))
26
+ this.set(actor, `bones.${b}.${k}`, x, t, d, ease);
27
+ this.inArc = false;
28
+ };
29
+ // The hand travels from where it is along an arc in front of the body (the arm swings round the
30
+ // front, never through the chest): in-betweens solved again, not angles blended.
31
+ const from = rig3dPose(doc, { ...pose, ...guess })[`arm${side}2`]?.to;
32
+ const dist = from ? Math.hypot(target[0] - from[0], target[1] - from[1], target[2] - from[2]) : 0;
33
+ if (from && dur > 0 && dist > 10) {
34
+ const n = 3;
35
+ const start = guess;
36
+ for (let i = 1; i <= n; i++) {
37
+ const u = i / (n + 1), bulge = Math.sin(u * Math.PI) * dist * 0.25;
38
+ const p = [from[0] + (target[0] - from[0]) * u, from[1] + (target[1] - from[1]) * u, from[2] + (target[2] - from[2]) * u + bulge];
39
+ // (Towards a known pose — back to rest, into a clip's first pose — the angles turn the short
40
+ // way to it, continuously; towards a free target the hand's arc is solved.)
41
+ apply(final ? blendValues(start, final, u) : solve(p), at - dur + (dur * (i - 1)) / (n + 1), dur / (n + 1), i === 1 ? "easeIn" : "linear");
42
+ }
43
+ apply(final ?? solve(target), at - dur / (n + 1), dur / (n + 1), "easeOut");
44
+ }
45
+ else
46
+ apply(final ?? solve(target), at - dur, dur, "easeInOut");
47
+ return true;
48
+ }
49
+ /**
50
+ * Drops an arm's moves planned while a new one lasts (it takes over; one under way when it starts
51
+ * turns into it smoothly).
52
+ */
53
+ export function cutArm(actor, side, from, until = Infinity) {
54
+ // The same window for the script and the angle history: every move starting in [from, until).
55
+ const t = this.t(from), u = until === Infinity ? Infinity : this.t(until);
56
+ const re = new RegExp(`^bones\\.arm${side}[12]\\.(rotation|turn|spread)$`);
57
+ for (let i = this.script.length - 1; i >= 0; i--) {
58
+ const a = this.script[i];
59
+ if (a.action !== "set" || a.actor !== actor || !a.channel || !re.test(a.channel))
60
+ continue;
61
+ // (A move under way when this one starts is taken over smoothly by the scene.)
62
+ if (a.at >= t - 1e-6 && a.at < u - 1e-6)
63
+ this.script.splice(i, 1);
64
+ }
65
+ for (const [k, hist] of this.angles)
66
+ if (k.startsWith(`${actor}|bones.arm${side}`))
67
+ this.angles.set(k, hist.filter((h) => !(h[2] >= from - 1e-6 && h[2] < until - 1e-6)));
68
+ }
69
+ /** A 2.5D rig's arm channels as last set by a moment (else at rest). */
70
+ export function armNow(actor, side, t) {
71
+ const out = {};
72
+ for (const b of [`arm${side}1`, `arm${side}2`]) {
73
+ const rest = this.restArms.get(actor)?.[b] ?? {};
74
+ const v = {};
75
+ for (const k of ["rotation", "turn", "spread"]) {
76
+ const hist = (this.angles.get(`${actor}|bones.${b}.${k}`) ?? []).filter((h) => h[0] <= t + 1e-6).sort((a, c) => a[0] - c[0]);
77
+ v[k] = hist.length ? hist[hist.length - 1][1] : (rest[k] ?? 0);
78
+ }
79
+ out[b] = v;
80
+ }
81
+ return out;
82
+ }
83
+ /** The near arm back to where it rests (on the knees, on the floor behind… or hanging). */
84
+ export function armRest(actor, at, dur, side = "F") {
85
+ const zero = { rotation: 0, spread: 0, turn: 0 };
86
+ const rest = this.restArms.get(actor) ?? {};
87
+ const final = Object.fromEntries([`arm${side}1`, `arm${side}2`].map((b) => [b, { ...zero, ...(rest[b] ?? {}) }]));
88
+ // Back along the same kind of arc as it came (where the hand rests: the tip of the arm at rest).
89
+ const doc = this.kit.characters[this.characterOf(actor)];
90
+ const hand = doc?.rig3d ? rig3dPose(doc, { ...(this.pose3d.get(actor) ?? {}), ...final })[`arm${side}2`]?.to : undefined;
91
+ if (hand && this.arm3d(actor, hand, at + dur, dur, side, final))
92
+ return;
93
+ for (const [b, v] of Object.entries(final))
94
+ for (const [k, x] of Object.entries(v))
95
+ this.set(actor, `bones.${b}.${k}`, x, at, dur, "easeInOut");
96
+ }
97
+ /** A 3D point of the rig (`rig3d.points`) in the actor's current pose. */
98
+ export function point3d(actor, name) {
99
+ const doc = this.kit.characters[this.characterOf(actor)];
100
+ return doc?.rig3d ? rig3dPoint(doc, this.pose3d.get(actor) ?? {}, name) : undefined;
101
+ }
102
+ /**
103
+ * How a prop is held in the hand: by its `grip` (else a third of the way from the point that sat on
104
+ * the body to the other one), standing up — the free end (the other point of its fit) upward.
105
+ */
106
+ export function handHold(prop) {
107
+ const points = this.kit.props[this.propKinds.get(prop) ?? ""]?.points ?? {};
108
+ const fit = this.lastHang.get(prop);
109
+ const keys = fit ? Object.keys(fit) : [];
110
+ const on = keys[0] ? points[keys[0]] : undefined;
111
+ const free = keys[1] ? points[keys[1]] : Object.entries(points).find(([k]) => k !== "grip" && k !== keys[0])?.[1];
112
+ const grip = points.grip ?? (on && free ? [on[0] + (free[0] - on[0]) * 0.3, on[1] + (free[1] - on[1]) * 0.3] : on);
113
+ return { grip, up: free ?? on };
114
+ }
115
+ /** Held in the hand by its grip, standing up between the fingers. */
116
+ export function inHand(actor, prop, at) {
117
+ // A hung prop is held up hanging from the near hand (a lantern raised in front of the chest).
118
+ if (this.hangOf(prop)) {
119
+ this.switchHand(actor, prop, "F", at);
120
+ if (this.hasPart(actor, "handF"))
121
+ this.set(actor, "parts.handF.variant", "grip", at - 0.15);
122
+ return;
123
+ }
124
+ const { grip, up } = this.handHold(prop);
125
+ this.push({ at: this.t(at), action: "release", actor, prop });
126
+ this.push({ at: this.t(at), action: "grab", actor, prop, anchor: "hand", ...(grip ? { fit: [{ point: grip, anchor: "hand" }, ...(up ? [{ point: up, angle: -90, fixed: true }] : [])] } : {}) });
127
+ if (this.hasPart(actor, "handF"))
128
+ this.set(actor, "parts.handF.variant", "grip", at - 0.15);
129
+ }
130
+ /**
131
+ * Takes a prop hung on the body (a cigarette from the lips): the near hand goes to it, takes it by
132
+ * its grip and brings it in front of the chest, standing between the fingers.
133
+ */
134
+ export function take(actor, prop, at) {
135
+ const h = this.hung.get(prop);
136
+ if (!h || h.actor !== actor)
137
+ return this.issue("error", `${actor} cannot take "${prop}": it is not on ${actor}'s body (put it there with use … hands: false)`);
138
+ const anchor = Object.values(h.fit).find((a) => typeof a === "string");
139
+ const where = this.point3d(actor, anchor);
140
+ if (where)
141
+ this.arm3d(actor, [where[0], where[1], where[2] + 4], at, 0.35);
142
+ this.hung.delete(prop);
143
+ this.inHand(actor, prop, at);
144
+ const chest = this.point3d(actor, "chest");
145
+ if (chest)
146
+ this.arm3d(actor, chest, at + 0.45, 0.45);
147
+ }
148
+ /** Holds a prop up in front of the chest (taking it from the body first if it hangs there) until `until`. */
149
+ export function holdProp(actor, prop, at, until) {
150
+ if (this.hung.get(prop)?.actor === actor)
151
+ this.take(actor, prop, at);
152
+ else {
153
+ if (!this.propStates.get(prop)?.heldBy.some((x) => x.actor === actor && x.t1 === Infinity))
154
+ return this.issue("error", `${actor} cannot hold "${prop}": not holding it (pick it up first, or heldBy)`);
155
+ this.inHand(actor, prop, at);
156
+ const chest = this.point3d(actor, "chest");
157
+ if (chest)
158
+ this.arm3d(actor, chest, at + 0.4, 0.4);
159
+ }
160
+ if (until !== undefined)
161
+ this.armRest(actor, until, 0.45);
162
+ }
163
+ /** Puts a held prop back where it hung on the body (the lips) and the arm back to rest. */
164
+ export function putBack(actor, prop, at) {
165
+ const fit = this.lastHang.get(prop);
166
+ if (!fit)
167
+ return this.issue("error", `${actor} cannot put "${prop}" back: it never hung on the body (use … hands: false)`);
168
+ const anchor = Object.values(fit).find((a) => typeof a === "string");
169
+ const where = this.point3d(actor, anchor);
170
+ if (where)
171
+ this.arm3d(actor, [where[0], where[1], where[2] + 4], at, 0.4);
172
+ this.use(actor, prop, fit, at, undefined, false);
173
+ this.armRest(actor, at + 0.05, 0.45);
174
+ if (this.hasPart(actor, "handF"))
175
+ this.set(actor, "parts.handF.variant", null, at + 0.1);
176
+ }
177
+ /** The phone / smoke / drink gestures with a held prop that has contact points: `use` it. */
178
+ export function useForGesture(actor, clip, at, until) {
179
+ // Drinking: the lip at the mouth, the bottom up and forward (it turns as the head tips back).
180
+ const fits = {
181
+ // The phone along the jaw: the earpiece on the ear, the mouthpiece down and forward.
182
+ phone: [{ ear: "ear", mouth: 62 }, 3],
183
+ smoke: [{ tip: "mouth" }, 1.3],
184
+ drink: [{ lip: "mouth", bottom: -38 }, 1.8],
185
+ };
186
+ const f = fits[clip];
187
+ const prop = f && this.heldProp(actor, at);
188
+ if (!f || !prop)
189
+ return false;
190
+ const points = this.kit.props[this.propKinds.get(prop) ?? ""]?.points ?? {};
191
+ const anchors = (this.kit.characters[this.characterOf(actor)]?.anchors ?? {});
192
+ const fit = Object.fromEntries(Object.entries(f[0]).filter(([pt, an]) => points[pt] && (typeof an === "number" || anchors[an])));
193
+ if (!Object.keys(fit).length)
194
+ return false;
195
+ // The arm comes up with the clip (the head tips back to drink), then the prop fits. A 2.5D rig's
196
+ // arm comes up in 3D instead (`use`): the clip's 2D arm swing would go round the front.
197
+ if (!this.is3d(actor))
198
+ this.play(actor, clip, at - 0.1, until ? until - at + 0.1 : undefined);
199
+ this.use(actor, prop, fit, at + 0.25, until ?? at + f[1]);
200
+ return true;
201
+ }
202
+ export function release(prop, abs) {
203
+ const st = this.propStates.get(prop);
204
+ if (!st)
205
+ return;
206
+ const h = st.heldBy.find((h) => h.t1 === Infinity);
207
+ if (!h)
208
+ return;
209
+ h.t1 = abs;
210
+ this.endCarry(prop, abs);
211
+ this.push({ at: this.t(abs), action: "release", actor: h.actor, prop });
212
+ }
213
+ /** Hand position of an actor (scene space) while playing a clip at clip time `ct`. */
214
+ export function handIn(actor, clip, ct) {
215
+ const doc = this.kit.characters[this.characterOf(actor)];
216
+ const probe = {
217
+ format: "toon-scene", version: 1, width: 100, height: 100, fps: 30, duration: 4,
218
+ characters: { c: "c" }, actors: [{ id: "a", character: "c", x: 0, y: 0, scale: 1 }],
219
+ script: [
220
+ { at: 0, actor: "a", action: "play", clip, loop: true, fadeIn: 0 },
221
+ { at: 0, actor: "a", action: "set", channel: "behaviors.breathe.mix", value: 0 },
222
+ ],
223
+ };
224
+ try {
225
+ const p = anchorPosition(compileScene(probe, { characters: { c: doc } }), "a", "hand", ct);
226
+ return [p[0], p[1]];
227
+ }
228
+ catch {
229
+ const h = this.member(actor)?.rig.hand.F ?? [20, -70];
230
+ return [h[0], h[1]];
231
+ }
232
+ }
233
+ //# sourceMappingURL=arms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arms.js","sourceRoot":"","sources":["../../src/direct/arms.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAoB,SAAS,EAAE,OAAO,EAAE,UAAU,EAAiB,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnI,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAmB,KAAa,EAAE,MAAgC,EAAE,EAAU,EAAE,GAAW,EAAE,IAAI,GAAc,GAAG,EAAE,KAAmB;IAC1J,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAA+C,CAAC;IACvG,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACzF,sEAAsE;IACtE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1C,MAAM,IAAI,GAA6B,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAA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,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE;YAClE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,EAAE;SACjF;KACqB,CAAC;IACzB,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,cAAc,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAC3F,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Beats to actions: the dispatcher from a staging beat to the scene's actions.
3
+ */
4
+ import type { Beat } from "../types.js";
5
+ import type { BlockScene } from "./scene.js";
6
+ export declare function beat(this: BlockScene, b: Beat): void;
7
+ //# sourceMappingURL=beat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beat.d.ts","sourceRoot":"","sources":["../../src/direct/beat.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,QAmR7C"}