@anime-studio/director 0.2.1 → 0.4.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/dist/describe.d.ts +1 -1
- package/dist/direct/arcs.d.ts +17 -0
- package/dist/direct/arcs.d.ts.map +1 -0
- package/dist/direct/arcs.js +76 -0
- package/dist/direct/arcs.js.map +1 -0
- package/dist/direct/arms.d.ts +46 -0
- package/dist/direct/arms.d.ts.map +1 -0
- package/dist/direct/arms.js +233 -0
- package/dist/direct/arms.js.map +1 -0
- package/dist/direct/beat.d.ts +7 -0
- package/dist/direct/beat.d.ts.map +1 -0
- package/dist/direct/beat.js +339 -0
- package/dist/direct/beat.js.map +1 -0
- package/dist/direct/build.d.ts +7 -0
- package/dist/direct/build.d.ts.map +1 -0
- package/dist/direct/build.js +152 -0
- package/dist/direct/build.js.map +1 -0
- package/dist/direct/camera.d.ts +38 -0
- package/dist/direct/camera.d.ts.map +1 -0
- package/dist/direct/camera.js +279 -0
- package/dist/direct/camera.js.map +1 -0
- package/dist/direct/cast.d.ts +45 -0
- package/dist/direct/cast.d.ts.map +1 -0
- package/dist/direct/cast.js +172 -0
- package/dist/direct/cast.js.map +1 -0
- package/dist/direct/check.d.ts +17 -0
- package/dist/direct/check.d.ts.map +1 -0
- package/dist/direct/check.js +270 -0
- package/dist/direct/check.js.map +1 -0
- package/dist/direct/contact.d.ts +28 -0
- package/dist/direct/contact.d.ts.map +1 -0
- package/dist/direct/contact.js +222 -0
- package/dist/direct/contact.js.map +1 -0
- package/dist/direct/dialogue.d.ts +19 -0
- package/dist/direct/dialogue.d.ts.map +1 -0
- package/dist/direct/dialogue.js +110 -0
- package/dist/direct/dialogue.js.map +1 -0
- package/dist/direct/episode.d.ts +10 -0
- package/dist/direct/episode.d.ts.map +1 -0
- package/dist/direct/episode.js +286 -0
- package/dist/direct/episode.js.map +1 -0
- package/dist/direct/fixtures.d.ts +29 -0
- package/dist/direct/fixtures.d.ts.map +1 -0
- package/dist/direct/fixtures.js +147 -0
- package/dist/direct/fixtures.js.map +1 -0
- package/dist/direct/flight.d.ts +23 -0
- package/dist/direct/flight.d.ts.map +1 -0
- package/dist/direct/flight.js +110 -0
- package/dist/direct/flight.js.map +1 -0
- package/dist/direct/furniture.d.ts +59 -0
- package/dist/direct/furniture.d.ts.map +1 -0
- package/dist/direct/furniture.js +149 -0
- package/dist/direct/furniture.js.map +1 -0
- package/dist/direct/gestures.d.ts +31 -0
- package/dist/direct/gestures.d.ts.map +1 -0
- package/dist/direct/gestures.js +211 -0
- package/dist/direct/gestures.js.map +1 -0
- package/dist/direct/graphics.d.ts +20 -0
- package/dist/direct/graphics.d.ts.map +1 -0
- package/dist/direct/graphics.js +282 -0
- package/dist/direct/graphics.js.map +1 -0
- package/dist/direct/hand-holding.d.ts +28 -0
- package/dist/direct/hand-holding.d.ts.map +1 -0
- package/dist/direct/hand-holding.js +187 -0
- package/dist/direct/hand-holding.js.map +1 -0
- package/dist/direct/hiding.d.ts +19 -0
- package/dist/direct/hiding.d.ts.map +1 -0
- package/dist/direct/hiding.js +173 -0
- package/dist/direct/hiding.js.map +1 -0
- package/dist/direct/life.d.ts +67 -0
- package/dist/direct/life.d.ts.map +1 -0
- package/dist/direct/life.js +275 -0
- package/dist/direct/life.js.map +1 -0
- package/dist/direct/lighting.d.ts +22 -0
- package/dist/direct/lighting.d.ts.map +1 -0
- package/dist/direct/lighting.js +86 -0
- package/dist/direct/lighting.js.map +1 -0
- package/dist/direct/lying.d.ts +24 -0
- package/dist/direct/lying.d.ts.map +1 -0
- package/dist/direct/lying.js +205 -0
- package/dist/direct/lying.js.map +1 -0
- package/dist/direct/motion.d.ts +50 -0
- package/dist/direct/motion.d.ts.map +1 -0
- package/dist/direct/motion.js +270 -0
- package/dist/direct/motion.js.map +1 -0
- package/dist/direct/pictures.d.ts +24 -0
- package/dist/direct/pictures.d.ts.map +1 -0
- package/dist/direct/pictures.js +265 -0
- package/dist/direct/pictures.js.map +1 -0
- package/dist/direct/props-in-hand.d.ts +71 -0
- package/dist/direct/props-in-hand.d.ts.map +1 -0
- package/dist/direct/props-in-hand.js +285 -0
- package/dist/direct/props-in-hand.js.map +1 -0
- package/dist/direct/props.d.ts +32 -0
- package/dist/direct/props.d.ts.map +1 -0
- package/dist/direct/props.js +118 -0
- package/dist/direct/props.js.map +1 -0
- package/dist/direct/riding.d.ts +76 -0
- package/dist/direct/riding.d.ts.map +1 -0
- package/dist/direct/riding.js +290 -0
- package/dist/direct/riding.js.map +1 -0
- package/dist/direct/scene.d.ts +322 -0
- package/dist/direct/scene.d.ts.map +1 -0
- package/dist/direct/scene.js +287 -0
- package/dist/direct/scene.js.map +1 -0
- package/dist/direct/shared.d.ts +87 -0
- package/dist/direct/shared.d.ts.map +1 -0
- package/dist/direct/shared.js +42 -0
- package/dist/direct/shared.js.map +1 -0
- package/dist/direct/sitting.d.ts +62 -0
- package/dist/direct/sitting.d.ts.map +1 -0
- package/dist/direct/sitting.js +320 -0
- package/dist/direct/sitting.js.map +1 -0
- package/dist/direct/throws.d.ts +14 -0
- package/dist/direct/throws.d.ts.map +1 -0
- package/dist/direct/throws.js +89 -0
- package/dist/direct/throws.js.map +1 -0
- package/dist/direct/timeline.d.ts +23 -0
- package/dist/direct/timeline.d.ts.map +1 -0
- package/dist/direct/timeline.js +90 -0
- package/dist/direct/timeline.js.map +1 -0
- package/dist/direct/timing.d.ts +50 -0
- package/dist/direct/timing.d.ts.map +1 -0
- package/dist/direct/timing.js +138 -0
- package/dist/direct/timing.js.map +1 -0
- package/dist/direct/vocabulary.d.ts +33 -0
- package/dist/direct/vocabulary.d.ts.map +1 -0
- package/dist/direct/vocabulary.js +56 -0
- package/dist/direct/vocabulary.js.map +1 -0
- package/dist/direct.d.ts +8 -87
- package/dist/direct.d.ts.map +1 -1
- package/dist/direct.js +8 -6052
- package/dist/direct.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sitting: on furniture or the floor, in 2D and on the 2.5D pipeline, seen from the front.
|
|
3
|
+
*/
|
|
4
|
+
import { rig3dPose, reach3d } from "@anime-studio/core";
|
|
5
|
+
import { r3 } from "./shared.js";
|
|
6
|
+
/** Sits on furniture (`seat` anchor), a set seat (mark with `seat`) or the ground: hips down, knees up, feet on the floor. */
|
|
7
|
+
export function sit(actor, on, at, view, how = {}) {
|
|
8
|
+
// Crossed legs are not something the engine can draw: they sit with the legs apart.
|
|
9
|
+
if (how.legs === "crossed") {
|
|
10
|
+
this.issue("warning", `${actor}: crossed legs are not supported by the engine — sitting with the legs apart`);
|
|
11
|
+
how = { ...how, legs: undefined };
|
|
12
|
+
}
|
|
13
|
+
if (this.ridingAt(actor, at))
|
|
14
|
+
return this.issue("error", `${actor} cannot sit: riding then (dismount first)`);
|
|
15
|
+
const rest = this.restAt(actor, at);
|
|
16
|
+
if (rest?.kind === "sit" && rest.on === on)
|
|
17
|
+
return;
|
|
18
|
+
const place = this.restPlace(actor, on, "sit");
|
|
19
|
+
if (!place)
|
|
20
|
+
return;
|
|
21
|
+
this.standUp(actor, at, 1.6);
|
|
22
|
+
const rig = this.member(actor)?.rig;
|
|
23
|
+
const s = this.scaleOf(actor);
|
|
24
|
+
const hip = this.hipOf(actor);
|
|
25
|
+
const thigh = ((rig?.legLength?.F ?? (rig?.height ?? 200) * 0.4) / 2) * s;
|
|
26
|
+
const legs = rig?.legLength ? rig.legLength.F * s : undefined;
|
|
27
|
+
const hipY = Math.abs(hip[1]) * s;
|
|
28
|
+
// A seat drawn for a room camera knows how far it is turned from the camera (`meta.seat.yaw`):
|
|
29
|
+
// facing it (front), turned a little (half: three-quarter) or sideways (the profile sit).
|
|
30
|
+
const seatYaw = on && on !== "ground" && this.furnitureOf.has(on) ? this.kit.characters[this.characterOf(on)]?.meta?.seat?.yaw : undefined;
|
|
31
|
+
const d3 = this.is3d(actor);
|
|
32
|
+
const seatView = view ?? (d3 && seatYaw !== undefined ? this.nearestView(actor, Math.abs(seatYaw)) : seatYaw !== undefined ? (Math.abs(seatYaw) < 15 ? "front" : Math.abs(seatYaw) < 60 ? "half" : undefined) : this.viewAt(actor, at) === "front" ? "front" : undefined);
|
|
33
|
+
// Facing the audience (a sofa in front of the TV, a school desk): thighs towards the camera.
|
|
34
|
+
// A 2.5D rig sits in 3D and is drawn from whatever angle the seat is turned to.
|
|
35
|
+
const front = !d3 && (seatView === "front" || seatView === "half");
|
|
36
|
+
// Someone already sitting there (or settling there, their walk over still under way): the next
|
|
37
|
+
// seat (furniture `seat2`, `seat3`…; along a set seat).
|
|
38
|
+
const taken = on && on !== "ground" ? this.rests.filter((r) => r.kind === "sit" && r.on === on && r.t1 > at).length : 0;
|
|
39
|
+
let sitX, seatY, floor, dir;
|
|
40
|
+
if ("furniture" in place) {
|
|
41
|
+
const anchor = taken ? `seat${taken + 1}` : "seat";
|
|
42
|
+
const seat = this.furniturePoint(place.furniture, anchor);
|
|
43
|
+
if (!seat)
|
|
44
|
+
return this.issue("error", taken ? `"${place.furniture}" has no free seat for ${actor} (anchor "${anchor}" missing)` : `"${place.furniture}" has no "seat" anchor to sit on`);
|
|
45
|
+
dir = seatYaw !== undefined ? (seatYaw < 0 ? -1 : 1) : this.facing(place.furniture, at) ? 1 : -1;
|
|
46
|
+
// (Walks over first; with no time for that before the beat, sits on arriving.)
|
|
47
|
+
if (Math.abs(this.xAt(actor, at - 0.9) - seat[0]) > 30)
|
|
48
|
+
at = Math.max(at, this.walk(actor, seat[0], at - 0.9, 0.8) + 0.1);
|
|
49
|
+
this.face(actor, dir > 0 ? "right" : "left", at);
|
|
50
|
+
if (front || (d3 && seatView))
|
|
51
|
+
this.view(actor, seatView, at);
|
|
52
|
+
// Facing the camera the body sinks a little into the cushion (`meta.sitFront.sink`).
|
|
53
|
+
const sink = front ? (this.sitFrontOf(actor)?.sink ?? 0) : 0;
|
|
54
|
+
// Facing the way the seat is turned (not the way its drawing faces: a seat drawn turned left is
|
|
55
|
+
// still an unflipped drawing).
|
|
56
|
+
this.push({ at: this.t(at), actor, action: "mount", on: place.furniture, anchor, point: [hip[0], hip[1] - sink], duration: 0.5, facing: "own" });
|
|
57
|
+
this.shadow(actor, at, { hide: true }, 0.3);
|
|
58
|
+
[sitX, seatY, floor] = [seat[0], seat[1], this.furnitureOf.get(place.furniture).y];
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const x = place.x !== undefined ? place.x + taken * this.spacing(actor) * (front ? 0.7 : 1) : this.xAt(actor, at);
|
|
62
|
+
if (Math.abs(this.xAt(actor, at - 0.9) - x) > 30)
|
|
63
|
+
at = Math.max(at, this.walk(actor, x, at - 0.9, 0.8) + 0.1);
|
|
64
|
+
dir = this.facing(actor, at) ? 1 : -1;
|
|
65
|
+
if (front || (d3 && seatView))
|
|
66
|
+
this.view(actor, seatView, at);
|
|
67
|
+
floor = this.groundY(actor, at);
|
|
68
|
+
const h = place.h;
|
|
69
|
+
// The body goes down until the hips are on the seat (or the ground); the shadow stays on the floor.
|
|
70
|
+
const drop = Math.round(-h + hipY * (h > 0 ? 1 : 0.9));
|
|
71
|
+
this.set(actor, "y", Math.round(floor + drop), at, 0.5, "easeOut");
|
|
72
|
+
this.shadow(actor, at, { drop }, 0.5);
|
|
73
|
+
[sitX, seatY] = [x, floor - (h > 0 ? h : hipY * 0.1)];
|
|
74
|
+
}
|
|
75
|
+
// A seat much higher than the knee (a sofa drawn too tall for the cast): seated, they look like
|
|
76
|
+
// they are standing in front of it.
|
|
77
|
+
if (legs && floor - seatY > hipY * 0.95 && floor - seatY <= legs * 1.05)
|
|
78
|
+
this.issue("warning", `${actor}'s seat on "${on}" is too high (${Math.round(floor - seatY)} px, ${Math.round(((floor - seatY) / hipY) * 100)}% of the hip height): seated they would look like standing — lower the seat or scale the furniture`);
|
|
79
|
+
if (legs && floor - seatY > legs * 1.05)
|
|
80
|
+
this.issue("warning", `${actor}'s feet do not reach the floor from "${on}" (seat ${Math.round(floor - seatY)} px high, legs ${Math.round(legs)} px): they dangle`);
|
|
81
|
+
if (d3)
|
|
82
|
+
this.sit3d(actor, (floor - seatY) / s, at, how, !("furniture" in place) && !place.h);
|
|
83
|
+
else if (front)
|
|
84
|
+
this.frontLegs(actor, sitX, seatY + ("furniture" in place ? (this.sitFrontOf(actor)?.sink ?? 0) * s : 0), floor, dir, at, how, seatView);
|
|
85
|
+
// Feet on the floor ahead, or (seat too high) dangling: knees bent, shins hanging.
|
|
86
|
+
else if (!d3)
|
|
87
|
+
this.feetDown(actor, sitX + dir * thigh * (floor - seatY > hipY * 0.3 ? 0.95 : 1.3), dir, Math.min(floor, seatY + (legs ?? 0) * 0.6), at, 0.5);
|
|
88
|
+
this.rests.push({ actor, kind: "sit", on, t0: at, t1: Infinity, y: floor, front, hipY: seatY + (front && "furniture" in place ? (this.sitFrontOf(actor)?.sink ?? 0) * s : 0) });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Sitting seen from the front: the thighs point at the camera (foreshortened: shorter and rounder),
|
|
92
|
+
* the shins hang straight down to the floor under the knees; on the ground both are foreshortened.
|
|
93
|
+
*/
|
|
94
|
+
/** A 2.5D rig (`rig3d`): poses are 3D, drawn from any angle. */
|
|
95
|
+
export function is3d(actor) {
|
|
96
|
+
return !!this.kit.characters[this.characterOf(actor)]?.rig3d;
|
|
97
|
+
}
|
|
98
|
+
/** The view of a 2.5D rig drawn nearest to a yaw (degrees, 0 = facing the camera). */
|
|
99
|
+
export function nearestView(actor, yaw) {
|
|
100
|
+
const views = this.kit.characters[this.characterOf(actor)].rig3d.views;
|
|
101
|
+
return Object.entries(views).sort((a, b) => Math.abs(a[1] - yaw) - Math.abs(b[1] - yaw))[0][0];
|
|
102
|
+
}
|
|
103
|
+
/** Which side of the body's middle a leg's hip is on (−1: −x, +1: +x) in the rig's 3D build; the near leg at −x when they share it. */
|
|
104
|
+
export function hipSide(actor, side) {
|
|
105
|
+
const hip = this.kit.characters[this.characterOf(actor)]?.rig3d?.bones?.[`leg${side}1`]?.from[0] ?? 0;
|
|
106
|
+
return hip < 0 ? -1 : hip > 0 ? 1 : side === "F" ? -1 : 1;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A leg's channels opened outwards by `deg` in a pose: the knee away from the body's middle, on
|
|
110
|
+
* its hip's side. Found on the rig's own forward kinematics (`rig3dPose`): `spread` (about the
|
|
111
|
+
* forward axis) swings a hanging limb sideways, `turn` (about the vertical) a raised one —
|
|
112
|
+
* whichever moves the knee out the most, with the sign that does; nothing when neither does.
|
|
113
|
+
*/
|
|
114
|
+
export function legOut(actor, values, side, deg) {
|
|
115
|
+
const doc = this.kit.characters[this.characterOf(actor)];
|
|
116
|
+
const bone = `leg${side}1`, cur = { ...(values[bone] ?? {}) };
|
|
117
|
+
const base = doc?.rig3d?.bones?.[bone] ? rig3dPose(doc, values)[bone] : undefined;
|
|
118
|
+
if (!base)
|
|
119
|
+
return cur;
|
|
120
|
+
const away = this.hipSide(actor, side);
|
|
121
|
+
let best = cur, gain = 0;
|
|
122
|
+
for (const ch of ["spread", "turn"])
|
|
123
|
+
for (const sign of [1, -1]) {
|
|
124
|
+
const v = { ...cur, [ch]: (cur[ch] ?? 0) + sign * deg };
|
|
125
|
+
const knee = rig3dPose(doc, { ...values, [bone]: v })[bone].to;
|
|
126
|
+
const g = (knee[0] - base.to[0]) * away;
|
|
127
|
+
if (g > gain)
|
|
128
|
+
[best, gain] = [v, g];
|
|
129
|
+
}
|
|
130
|
+
return best;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Sitting in 3D (a 2.5D rig): thighs forward (knees up when the seat is low), shins down to the
|
|
134
|
+
* floor, the body a little back; hands on the knees or in the lap. The same pose reads from any
|
|
135
|
+
* angle the rig is drawn at.
|
|
136
|
+
*/
|
|
137
|
+
export function sit3d(actor, seatH, at, how, ground = false) {
|
|
138
|
+
if (ground)
|
|
139
|
+
return this.sitFloor3d(actor, at, how.legs ?? "straight");
|
|
140
|
+
const rig = this.member(actor)?.rig;
|
|
141
|
+
const tl = (rig?.legLength?.F ?? 200) / 2, sl = tl;
|
|
142
|
+
// A low seat (shins longer than it is high): the knees rise a little and the shins slope forward
|
|
143
|
+
// to the floor, feet ahead — people put their feet out rather than their knees up to the chest.
|
|
144
|
+
// A high one: the shins hang (the feet dangle).
|
|
145
|
+
const up = (Math.asin(Math.max(-0.35, Math.min(0.2, (sl - seatH) / tl))) * 180) / Math.PI;
|
|
146
|
+
const slope = (Math.acos(Math.min(1, (seatH + tl * Math.sin((up * Math.PI) / 180)) / sl)) * 180) / Math.PI;
|
|
147
|
+
const set = (ch, v) => this.set(actor, ch, r3(v), at, 0.5, "easeOut");
|
|
148
|
+
for (const side of ["F", "B"]) {
|
|
149
|
+
set(`bones.leg${side}1.rotation`, -90 - up);
|
|
150
|
+
set(`bones.leg${side}2.rotation`, 90 + up - slope);
|
|
151
|
+
if (this.hasChain(actor, `foot${side}`))
|
|
152
|
+
this.set(actor, `ik.foot${side}.mix`, 0, at, 0.3);
|
|
153
|
+
}
|
|
154
|
+
set("bones.body.rotation", 4);
|
|
155
|
+
// Hands on the knees or in the lap: reached in 3D, so they
|
|
156
|
+
// land there whatever the build (a belly, wide shoulders) and the seat.
|
|
157
|
+
const lap = how.hands === "lap";
|
|
158
|
+
const v = { body: { rotation: 4 } };
|
|
159
|
+
for (const side of ["F", "B"])
|
|
160
|
+
v[`leg${side}1`] = { rotation: -90 - up }, v[`leg${side}2`] = { rotation: 90 + up - slope };
|
|
161
|
+
this.pose3d.set(actor, v);
|
|
162
|
+
this.handsOnLegs(actor, at, v, (P, side) => {
|
|
163
|
+
return lap ? P.on(`leg${side}1`, 0.55, side === "F" ? 0.45 : -0.45) : P.on(`leg${side}1`, 0.85, 0);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Sitting on the floor in 3D: `straight` — legs out in front, leaning back on the hands behind;
|
|
168
|
+
* `hug` — knees up to the chest, arms around them.
|
|
169
|
+
*/
|
|
170
|
+
export function sitFloor3d(actor, at, legs) {
|
|
171
|
+
const set = (ch, v) => this.set(actor, ch, v, at, 0.5, "easeOut");
|
|
172
|
+
for (const side of ["F", "B"])
|
|
173
|
+
if (this.hasChain(actor, `foot${side}`))
|
|
174
|
+
this.set(actor, `ik.foot${side}.mix`, 0, at, 0.3);
|
|
175
|
+
const out = (side) => this.hipSide(actor, side);
|
|
176
|
+
const v = { body: { rotation: legs === "straight" ? 16 : legs === "hug" ? -8 : 0 } };
|
|
177
|
+
for (const side of ["F", "B"]) {
|
|
178
|
+
if (legs === "hug") {
|
|
179
|
+
v[`leg${side}1`] = { rotation: -138 };
|
|
180
|
+
v[`leg${side}2`] = { rotation: 128 };
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
v[`leg${side}1`] = { rotation: -86 };
|
|
184
|
+
v[`leg${side}2`] = { rotation: 4 };
|
|
185
|
+
// Toes up (a foot stays level with the body unless turned).
|
|
186
|
+
if (this.hasBone(actor, `foot${side}`))
|
|
187
|
+
set(`bones.foot${side}.rotation`, -70);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// The legs a little apart: each knee out, away from the body's middle.
|
|
191
|
+
for (const side of ["F", "B"])
|
|
192
|
+
v[`leg${side}1`] = this.legOut(actor, v, side, legs === "hug" ? 4 : 6);
|
|
193
|
+
for (const [b, val] of Object.entries(v))
|
|
194
|
+
if (b.startsWith("leg"))
|
|
195
|
+
for (const [k, x] of Object.entries(val))
|
|
196
|
+
set(`bones.${b}.${k}`, x);
|
|
197
|
+
set("bones.body.rotation", v.body.rotation);
|
|
198
|
+
this.pose3d.set(actor, v);
|
|
199
|
+
// Straight: leaning back on the hands, flat on the floor behind the hips; hug: hands clasped in
|
|
200
|
+
// front of the shins, elbows out.
|
|
201
|
+
this.handsOnLegs(actor, at, v, (P, side) => {
|
|
202
|
+
if (legs === "hug")
|
|
203
|
+
return P.around(side);
|
|
204
|
+
return P.behind(side);
|
|
205
|
+
}, legs === "hug" ? (side) => [out(side), 0.1, 0.25] : undefined);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Puts a 2.5D rig's hands on its legs in a pose (`values`: the legs and the body's lean): arms
|
|
209
|
+
* reached in 3D (`reach3d`) to points the callback picks — `on(bone, t, inward)`: the top of a
|
|
210
|
+
* thigh at `t` of its length, moved towards the middle by `inward` of the hips' half width;
|
|
211
|
+
* `around(side)`: in front of the shins (hugging the knees); `behind(side)`: on the floor behind
|
|
212
|
+
* the hips. Elbows go back and out, unless `pole` says otherwise.
|
|
213
|
+
*/
|
|
214
|
+
export function handsOnLegs(actor, at, values, pick, pole) {
|
|
215
|
+
const doc = this.kit.characters[this.characterOf(actor)];
|
|
216
|
+
const bones = doc.rig3d?.bones;
|
|
217
|
+
if (!bones?.armF1 || !bones.armF2 || !bones.legF1 || !bones.legF2)
|
|
218
|
+
return;
|
|
219
|
+
const pose = rig3dPose(doc, values);
|
|
220
|
+
const thighLen = Math.hypot(bones.legF1.to[0] - bones.legF1.from[0], bones.legF1.to[1] - bones.legF1.from[1], bones.legF1.to[2] - bones.legF1.from[2]);
|
|
221
|
+
const rr = thighLen * 0.13, hx = Math.abs(bones.legF1.from[0]);
|
|
222
|
+
const P = {
|
|
223
|
+
on: (bone, t, inward) => {
|
|
224
|
+
const b = pose[bone];
|
|
225
|
+
const q = [0, 1, 2].map((k) => b.from[k] + (b.to[k] - b.from[k]) * t);
|
|
226
|
+
return [q[0] + inward * hx, q[1] - rr, q[2]];
|
|
227
|
+
},
|
|
228
|
+
around: (side) => {
|
|
229
|
+
const a = pose.legF2, b = pose.legB2;
|
|
230
|
+
const mid = (k, s) => ((a.from[k] + a.to[k]) / 2 + (b.from[k] + b.to[k]) / 2) / 2 + s;
|
|
231
|
+
return [mid(0, side === "F" ? -rr * 0.6 : rr * 0.6), mid(1, -thighLen * 0.15), Math.max(a.from[2], a.to[2], b.from[2], b.to[2]) + rr * 1.4];
|
|
232
|
+
},
|
|
233
|
+
behind: (side) => {
|
|
234
|
+
const hip = pose[`leg${side}1`].from;
|
|
235
|
+
return [hip[0] * 2.6, hip[1] + rr, hip[2] - thighLen * 0.8];
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
for (const side of ["F", "B"]) {
|
|
239
|
+
if (!bones[`arm${side}1`] || !bones[`arm${side}2`])
|
|
240
|
+
continue;
|
|
241
|
+
const out = this.hipSide(actor, side);
|
|
242
|
+
const sol = reach3d(doc, `arm${side}1`, `arm${side}2`, pick(P, side), values, pole?.(side) ?? [out * 0.6, 0.15, -1]);
|
|
243
|
+
this.restArms.set(actor, { ...(this.restArms.get(actor) ?? {}), ...sol });
|
|
244
|
+
for (const [b, val] of Object.entries(sol))
|
|
245
|
+
for (const [k, x] of Object.entries(val))
|
|
246
|
+
this.set(actor, `bones.${b}.${k}`, x, at, 0.5, "easeOut");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
export function unsit3d(actor, at) {
|
|
250
|
+
this.pose3d.delete(actor);
|
|
251
|
+
this.restArms.delete(actor);
|
|
252
|
+
const set = (ch, v) => this.set(actor, ch, v, at, 0.45, "easeOut");
|
|
253
|
+
for (const side of ["F", "B"]) {
|
|
254
|
+
for (const b of [`leg${side}1`, `leg${side}2`, `arm${side}1`, `arm${side}2`])
|
|
255
|
+
set(`bones.${b}.rotation`, 0);
|
|
256
|
+
for (const b of [`leg${side}1`, `leg${side}2`]) {
|
|
257
|
+
set(`bones.${b}.turn`, 0);
|
|
258
|
+
set(`bones.${b}.spread`, 0);
|
|
259
|
+
}
|
|
260
|
+
set(`bones.arm${side}1.spread`, 0);
|
|
261
|
+
set(`bones.arm${side}2.turn`, 0);
|
|
262
|
+
set(`bones.arm${side}1.turn`, 0);
|
|
263
|
+
set(`bones.arm${side}2.spread`, 0);
|
|
264
|
+
if (this.hasBone(actor, `foot${side}`))
|
|
265
|
+
set(`bones.foot${side}.rotation`, 0);
|
|
266
|
+
if (this.hasChain(actor, `foot${side}`))
|
|
267
|
+
this.set(actor, `ik.foot${side}.mix`, 1, at + 0.3, 0.3);
|
|
268
|
+
}
|
|
269
|
+
set("bones.body.rotation", 0);
|
|
270
|
+
}
|
|
271
|
+
/** A rig's seated-facing-the-camera description (`meta.sitFront`). */
|
|
272
|
+
export function sitFrontOf(actor) {
|
|
273
|
+
return this.kit.characters[this.characterOf(actor)]?.meta?.sitFront;
|
|
274
|
+
}
|
|
275
|
+
export function frontLegs(actor, x, seatY, floor, dir, at, how = {}, view = "front") {
|
|
276
|
+
void how;
|
|
277
|
+
void view;
|
|
278
|
+
const doc = this.kit.characters[this.characterOf(actor)];
|
|
279
|
+
const bone = (id) => doc.skeleton.find((b) => b.id === id)?.from;
|
|
280
|
+
const s = this.scaleOf(actor);
|
|
281
|
+
const drop = floor - seatY;
|
|
282
|
+
// How much of the thigh shows (seen from a little above: the top of the lap) and how far apart
|
|
283
|
+
// the knees and feet are (`meta.sitFront` of the rig).
|
|
284
|
+
const seen = doc.meta?.sitFront?.thigh ?? 0.4, spread = doc.meta?.sitFront?.spread ?? 1;
|
|
285
|
+
for (const side of ["F", "B"]) {
|
|
286
|
+
const [hipJ, knee, ankle] = [bone(`leg${side}1`), bone(`leg${side}2`), bone(`foot${side}`)];
|
|
287
|
+
if (!hipJ || !knee || !ankle || !this.hasChain(actor, `foot${side}`))
|
|
288
|
+
continue;
|
|
289
|
+
const thigh = Math.hypot(knee[0] - hipJ[0], knee[1] - hipJ[1]) * s;
|
|
290
|
+
const shin = Math.hypot(ankle[0] - knee[0], ankle[1] - knee[1]) * s;
|
|
291
|
+
const ax = (ankle[0] + (doc.meta?.views?.move?.front?.[`leg${side}1`]?.[0] ?? 0)) * s;
|
|
292
|
+
const footX = Math.round(x + dir * ax * spread);
|
|
293
|
+
// The thigh points at the camera (seen end-on: short); the shin hangs from the knee, foreshortened
|
|
294
|
+
// too when the seat is low (knees up), and the foot rests on the floor or dangles.
|
|
295
|
+
const fore = thigh * seen;
|
|
296
|
+
const shinSq = Math.max(-0.6, Math.min(0, (drop - fore) / shin - 1));
|
|
297
|
+
this.set(actor, `bones.leg${side}1.squash`, r3(seen - 1), at, 0.5, "easeOut");
|
|
298
|
+
this.set(actor, `bones.leg${side}2.squash`, r3(shinSq), at, 0.5, "easeOut");
|
|
299
|
+
// A rig can draw the thigh seen end-on (a "lap": short and round, the knee on top).
|
|
300
|
+
// A rig with a `seat` pose control draws the whole seated look itself (the lap, a skirt over it).
|
|
301
|
+
if (this.hasControl(actor, "seat")) {
|
|
302
|
+
if (side === "F")
|
|
303
|
+
this.push({ at: this.t(at + 0.25), actor, action: "pose", control: "seat", value: "front", duration: 0 });
|
|
304
|
+
}
|
|
305
|
+
else if (this.hasPart(actor, `lap${side}`))
|
|
306
|
+
this.set(actor, `parts.lap${side}.variant`, "on", at + 0.25);
|
|
307
|
+
// Hands on the knees (`sitFront.hands: "knees"`): the forearm comes towards the camera, so it
|
|
308
|
+
// is foreshortened, and the elbow folds outwards, close to the body.
|
|
309
|
+
if (doc.meta?.sitFront?.hands === "knees" && this.hasChain(actor, `hand${side}`)) {
|
|
310
|
+
const kneeY = Math.round(seatY + fore * 0.85);
|
|
311
|
+
this.set(actor, `bones.arm${side}2.squash`, -0.25, at + 0.1, 0.5, "easeOut");
|
|
312
|
+
this.push({ at: this.t(at + 0.1), actor, action: "reach", chain: `hand${side}`, target: [footX, kneeY], duration: 0.5 });
|
|
313
|
+
if (side === "F")
|
|
314
|
+
this.set(actor, "ik.handF.bend", -1, at + 0.1);
|
|
315
|
+
}
|
|
316
|
+
const footY = Math.min(floor + (drop < fore + shin * 0.5 ? 8 * s : 0), seatY + fore + shin * (1 + shinSq));
|
|
317
|
+
this.push({ at: this.t(at), actor, action: "reach", chain: `foot${side}`, target: [footX, Math.round(footY)], duration: 0.5 });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=sitting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sitting.js","sourceRoot":"","sources":["../../src/direct/sitting.ts"],"names":[],"m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GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QAC3G,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACjI,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props in flight and on the ground: keyed moves, throws, rolls and dribbles.
|
|
3
|
+
*/
|
|
4
|
+
import type { Place } from "../types.js";
|
|
5
|
+
import type { BlockScene } from "./scene.js";
|
|
6
|
+
export declare function propKeys(this: BlockScene, prop: string, keys: [number, number, number, number, number?][], ease?: string): void;
|
|
7
|
+
/** Throw up and land in front of the thrower (or at a place). */
|
|
8
|
+
export declare function throwProp(this: BlockScene, who: string, prop: string, at: number, to?: Place): void;
|
|
9
|
+
/** Roll (with a couple of small bounces) to a place; crossing to the far ground if it is there. */
|
|
10
|
+
export declare function roll(this: BlockScene, prop: string, to: Place, at: number, until: number): void;
|
|
11
|
+
/** Bouncing a prop in sync with the `dribble` clip: the palm meets it at the top of each bounce. */
|
|
12
|
+
export declare function dribble(this: BlockScene, who: string, prop: string, at: number, until: number): void;
|
|
13
|
+
export declare function facing(this: BlockScene, actor: string, abs: number): boolean;
|
|
14
|
+
//# sourceMappingURL=throws.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.d.ts","sourceRoot":"","sources":["../../src/direct/throws.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,IAAI,SAAc,QAS7H;AAED,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,KAAK,QAa5F;AAED,mGAAmG;AACnG,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAyBxF;AAED,oGAAoG;AACpG,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAkB7F;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAO5E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { r3 } from "./shared.js";
|
|
2
|
+
export function propKeys(prop, keys, ease = "sineInOut") {
|
|
3
|
+
const st = this.propStates.get(prop);
|
|
4
|
+
if (!st)
|
|
5
|
+
return this.issue("error", `unknown prop "${prop}"`);
|
|
6
|
+
for (const [abs, x, y, s, rot] of keys) {
|
|
7
|
+
st.x.push([this.t(abs), Math.round(x), ease]);
|
|
8
|
+
st.y.push([this.t(abs), Math.round(y), ease]);
|
|
9
|
+
st.scale.push([this.t(abs), r3(s), ease]);
|
|
10
|
+
if (rot !== undefined)
|
|
11
|
+
st.rotation.push([this.t(abs), Math.round(rot), ease]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Throw up and land in front of the thrower (or at a place). */
|
|
15
|
+
export function throwProp(who, prop, at, to) {
|
|
16
|
+
this.play(who, "toss", at - 0.4);
|
|
17
|
+
const st = this.propStates.get(prop);
|
|
18
|
+
const dir = this.facing(who, at) ? 1 : -1;
|
|
19
|
+
const x0 = this.xAt(who, at) + dir * 80 * this.scaleOf(who);
|
|
20
|
+
const x1 = to ? this.placeX(to, at) : x0 + dir * 30;
|
|
21
|
+
const g = this.setDef.ground.near - st.radius;
|
|
22
|
+
this.release(prop, at);
|
|
23
|
+
const top = this.setDef.ground.near - (this.member(who)?.rig.height ?? 250) * this.scaleOf(who) - 140;
|
|
24
|
+
const yk = [[this.t(at), Math.round(g - 120)], [this.t(at + 0.6), Math.round(top), "easeOut"], [this.t(at + 1.3), Math.round(g), "easeIn"]];
|
|
25
|
+
st.x.push([this.t(at), Math.round(x0)], [this.t(at + 1.3), Math.round(x1), "linear"]);
|
|
26
|
+
st.y.push(...yk);
|
|
27
|
+
st.scale.push([this.t(at), 1]);
|
|
28
|
+
}
|
|
29
|
+
/** Roll (with a couple of small bounces) to a place; crossing to the far ground if it is there. */
|
|
30
|
+
export function roll(prop, to, at, until) {
|
|
31
|
+
const st = this.propStates.get(prop);
|
|
32
|
+
if (!st)
|
|
33
|
+
return this.issue("error", `unknown prop "${prop}"`);
|
|
34
|
+
const x0 = this.propX(prop, at);
|
|
35
|
+
const x1 = this.placeX(to, at);
|
|
36
|
+
const near = this.setDef.ground.near - st.radius;
|
|
37
|
+
const markY = this.markOf(to)?.y;
|
|
38
|
+
const far = markY !== undefined && this.setDef.ground.far !== undefined && Math.abs(markY - this.setDef.ground.far) < Math.abs(markY - this.setDef.ground.near);
|
|
39
|
+
const ds = this.setDef.depthScale ?? 0.6;
|
|
40
|
+
const T = Math.max(0.8, until - at);
|
|
41
|
+
const keys = [];
|
|
42
|
+
const steps = 16;
|
|
43
|
+
for (let i = 0; i <= steps; i++) {
|
|
44
|
+
const u = i / steps;
|
|
45
|
+
const e = 1 - (1 - u) ** 2;
|
|
46
|
+
const x = x0 + (x1 - x0) * e;
|
|
47
|
+
const depth = far ? Math.min(1, Math.max(0, (u - 0.25) / 0.6)) : 0;
|
|
48
|
+
const s = 1 + (ds - 1) * depth;
|
|
49
|
+
const ground = far ? near + ((this.setDef.ground.far - st.radius * ds) - near) * depth : near;
|
|
50
|
+
const hop = Math.abs(Math.sin(u * Math.PI * 3)) * 60 * (1 - u) * s;
|
|
51
|
+
keys.push([at + u * T, x, ground - hop, s, ((x - x0) / (st.radius * s)) * (180 / Math.PI)]);
|
|
52
|
+
}
|
|
53
|
+
this.release(prop, at);
|
|
54
|
+
this.propKeys(prop, keys);
|
|
55
|
+
if (far)
|
|
56
|
+
this.props.find((p) => p.id === prop).z = 0.5;
|
|
57
|
+
}
|
|
58
|
+
/** Bouncing a prop in sync with the `dribble` clip: the palm meets it at the top of each bounce. */
|
|
59
|
+
export function dribble(who, prop, at, until) {
|
|
60
|
+
const st = this.propStates.get(prop);
|
|
61
|
+
if (!st)
|
|
62
|
+
return this.issue("error", `unknown prop "${prop}"`);
|
|
63
|
+
const period = this.kit.characters[this.characterOf(who)]?.clips?.dribble?.duration ?? 0.6;
|
|
64
|
+
const top = this.handIn(who, "dribble", 0);
|
|
65
|
+
const push = this.handIn(who, "dribble", period * 0.2);
|
|
66
|
+
const s = this.scaleOf(who);
|
|
67
|
+
const dir = this.facing(who, at) ? 1 : -1;
|
|
68
|
+
const x = this.xAt(who, at);
|
|
69
|
+
const contact = 10 * s + st.radius;
|
|
70
|
+
const X = (lx) => Math.round(x + dir * lx * s);
|
|
71
|
+
const Y = (ly) => Math.round(this.setDef.ground.near + ly * s + contact);
|
|
72
|
+
this.release(prop, at);
|
|
73
|
+
this.play(who, "dribble", at, until - at, { fadeIn: 0.05 });
|
|
74
|
+
for (let t = at; t <= until + 1e-6; t += period) {
|
|
75
|
+
st.x.push([this.t(t), X(top[0])], [this.t(t + period * 0.2), X(push[0])]);
|
|
76
|
+
st.y.push([this.t(t), Y(top[1])], [this.t(t + period * 0.2), Y(push[1]), "linear"], [this.t(t + period * 0.45), Math.round(this.setDef.ground.near - st.radius), "easeIn"]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function facing(actor, abs) {
|
|
80
|
+
let right = this.facing0[actor] ?? true;
|
|
81
|
+
for (const a of this.script.filter((a) => a.actor === actor && a.at <= this.t(abs)).sort((x, y) => x.at - y.at)) {
|
|
82
|
+
if (a.action === "face")
|
|
83
|
+
right = a.direction === "right";
|
|
84
|
+
if (a.action === "walkTo")
|
|
85
|
+
right = a.x >= this.xAt(actor, this.t0 + a.at - 0.01);
|
|
86
|
+
}
|
|
87
|
+
return right;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=throws.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.js","sourceRoot":"","sources":["../../src/direct/throws.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,EAAY,MAAM,UAAU,CAAC;AAExC,MAAM,UAAU,QAAQ,CAAmB,IAAY,EAAE,IAAiD,EAAE,IAAI,GAAG,WAAW;IAC5H,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,iBAAiB,IAAI,GAAG,CAAC,CAAC;IAC9D,KAAK,MAAM,C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|
+
*/
|
|
4
|
+
import { type MouthCue } from "@anime-studio/core";
|
|
5
|
+
import type { Line, When, Block } from "../types.js";
|
|
6
|
+
export declare class Timeline {
|
|
7
|
+
readonly lines: Line[];
|
|
8
|
+
constructor(lines: Line[]);
|
|
9
|
+
start(i: number): number;
|
|
10
|
+
get end(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Episode time of a `When`. An unknown line throws; a word the line does not have (or a line
|
|
13
|
+
* without word timings) falls back to the line's start (or end) and is reported to `miss`.
|
|
14
|
+
*/
|
|
15
|
+
at(w: When, miss?: (message: string) => void): number;
|
|
16
|
+
blockStart(b: Block): number;
|
|
17
|
+
blockEnd(b: Block): number;
|
|
18
|
+
}
|
|
19
|
+
/** Volume of a music envelope at a time (linear between its keys). */
|
|
20
|
+
export declare function volumeAt(keys: [number, number][], t: number): number;
|
|
21
|
+
/** Mouth cues of a line from its word timings (relative to the line start). */
|
|
22
|
+
export declare function lineCues(l: Line): MouthCue[];
|
|
23
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/direct/timeline.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,QAAQ,EAA2B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIlD,qBAAa,QAAQ;IACP,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE;IAAlC,YAAqB,KAAK,EAAE,IAAI,EAAE,EAAI;IACtC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvB;IACD,IAAI,GAAG,IAAI,MAAM,CAGhB;IACD;;;OAGG;IACH,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAWpD;IACD,UAAU,CAAC,CAAC,EAAE,KAAK,UAKlB;IACD,QAAQ,CAAC,CAAC,EAAE,KAAK,UAEhB;CACF;AAED,sEAAsE;AACtE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAWpE;AAED,+EAA+E;AAC/E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,GAAG,QAAQ,EAAE,CAqB5C"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timing: lines and words to episode time, volume envelopes and lip-sync cues of a line.
|
|
3
|
+
*/
|
|
4
|
+
import { cuesFromText, mergeCues } from "@anime-studio/core";
|
|
5
|
+
import { norm, LEAD, CROSSFADE, r3 } from "./shared.js";
|
|
6
|
+
import { closest } from "./vocabulary.js";
|
|
7
|
+
export class Timeline {
|
|
8
|
+
lines;
|
|
9
|
+
constructor(lines) {
|
|
10
|
+
this.lines = lines;
|
|
11
|
+
}
|
|
12
|
+
start(i) {
|
|
13
|
+
return this.lines[i]?.s ?? this.end;
|
|
14
|
+
}
|
|
15
|
+
get end() {
|
|
16
|
+
const last = this.lines[this.lines.length - 1];
|
|
17
|
+
return last ? last.e + 0.6 : 0;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Episode time of a `When`. An unknown line throws; a word the line does not have (or a line
|
|
21
|
+
* without word timings) falls back to the line's start (or end) and is reported to `miss`.
|
|
22
|
+
*/
|
|
23
|
+
at(w, miss) {
|
|
24
|
+
const l = this.lines[w.line];
|
|
25
|
+
if (!l)
|
|
26
|
+
throw new Error(`line ${w.line} does not exist (${this.lines.length} lines)`);
|
|
27
|
+
let t = w.end ? l.e : l.s;
|
|
28
|
+
if (w.word) {
|
|
29
|
+
const target = norm(w.word);
|
|
30
|
+
const word = l.words?.find((x) => norm(x.w) === target) ?? l.words?.find((x) => norm(x.w).startsWith(target));
|
|
31
|
+
if (word)
|
|
32
|
+
t = w.end ? word.e : word.s;
|
|
33
|
+
else
|
|
34
|
+
miss?.(l.words?.length ? `line ${w.line} has no word "${w.word}"${closest(w.word, l.words.map((x) => x.w))}: timed on the line's ${w.end ? "end" : "start"} instead` : `line ${w.line} has no word timings for "${w.word}": timed on the line's ${w.end ? "end" : "start"} instead`);
|
|
35
|
+
}
|
|
36
|
+
return t + (w.offset ?? 0);
|
|
37
|
+
}
|
|
38
|
+
blockStart(b) {
|
|
39
|
+
// (A block faded into needs the crossfade's length before its first line: the shot begins that
|
|
40
|
+
// early in the scene, so the fade ends on the beat.)
|
|
41
|
+
const lead = b.transition === "crossfade" ? Math.max(LEAD, CROSSFADE) : LEAD;
|
|
42
|
+
return b.from <= 0 ? 0 : Math.max(0, this.start(b.from) - lead);
|
|
43
|
+
}
|
|
44
|
+
blockEnd(b) {
|
|
45
|
+
return b.to >= this.lines.length ? this.end : this.start(b.to) - LEAD;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Volume of a music envelope at a time (linear between its keys). */
|
|
49
|
+
export function volumeAt(keys, t) {
|
|
50
|
+
if (!keys.length)
|
|
51
|
+
return 1;
|
|
52
|
+
if (t <= keys[0][0])
|
|
53
|
+
return keys[0][1];
|
|
54
|
+
for (let i = 1; i < keys.length; i++) {
|
|
55
|
+
const [t1, v1] = keys[i];
|
|
56
|
+
if (t <= t1) {
|
|
57
|
+
const [t0, v0] = keys[i - 1];
|
|
58
|
+
return t1 > t0 ? v0 + ((v1 - v0) * (t - t0)) / (t1 - t0) : v1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return keys[keys.length - 1][1];
|
|
62
|
+
}
|
|
63
|
+
/** Mouth cues of a line from its word timings (relative to the line start). */
|
|
64
|
+
export function lineCues(l) {
|
|
65
|
+
if (!l.words?.length)
|
|
66
|
+
return cuesFromText(l.text, { duration: l.e - l.s });
|
|
67
|
+
const cues = [];
|
|
68
|
+
const last = l.words.length - 1;
|
|
69
|
+
for (const [i, w] of l.words.entries()) {
|
|
70
|
+
// Aligners often end the last word early (a drawn-out last word): keep the mouth moving until
|
|
71
|
+
// the voice ends — `voiceEnd` when known, else the line end minus its usual trailing silence.
|
|
72
|
+
const voiceEnd = l.voiceEnd ?? l.e - 0.22;
|
|
73
|
+
const end = i === last ? Math.max(w.e, voiceEnd) : w.e;
|
|
74
|
+
for (const c of cuesFromText(w.w, { start: Math.max(0, w.s - l.s), duration: Math.max(0.08, end - w.s) }))
|
|
75
|
+
if (c.value !== "X" || c.end - c.start > 0.06)
|
|
76
|
+
cues.push(c);
|
|
77
|
+
}
|
|
78
|
+
cues.sort((a, b) => a.start - b.start);
|
|
79
|
+
const out = [];
|
|
80
|
+
let t = 0;
|
|
81
|
+
for (const c of cues) {
|
|
82
|
+
if (c.start > t + 0.02)
|
|
83
|
+
out.push({ start: r3(t), end: r3(c.start), value: "X" });
|
|
84
|
+
out.push({ start: r3(Math.max(c.start, t)), end: r3(c.end), value: c.value });
|
|
85
|
+
t = Math.max(t, c.end);
|
|
86
|
+
}
|
|
87
|
+
out.push({ start: r3(t), end: r3(t + 0.1), value: "X" });
|
|
88
|
+
return mergeCues(out.filter((c) => c.end > c.start));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/direct/timeline.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,OAAO,QAAQ;IACE,KAAK;IAA1B,YAAqB,KAAa;qBAAb,KAAK;IAAW,CAAC;IACtC,KAAK,CAAC,CAAS;QACb,OAAO,IAAI,CAAC,KA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