@open-take/compositor 0.4.4 → 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.
- package/dist/index.d.ts +476 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2864 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +35 -0
- package/src/launch-evaluate.ts +129 -0
- package/src/launch-render.ts +929 -0
- package/src/launch-starter.ts +57 -0
- package/src/launch-story.ts +258 -0
- package/src/launch-template.ts +125 -0
- package/src/launch-types.ts +127 -0
- package/src/launch-validate.ts +374 -0
- package/src/motion-evaluate.ts +145 -0
- package/src/motion-quality.ts +632 -0
- package/src/motion-recipes.ts +1021 -0
- package/src/motion-types.ts +163 -0
- package/src/motion-validate.ts +400 -0
- package/src/render-lock.ts +8 -0
- package/src/render.ts +2 -8
- package/src/scene/launch-project.ts +11 -0
- package/src/scene/launch-scene.tsx +415 -0
- package/src/scene/motion-layers.tsx +260 -0
- package/src/types.ts +17 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { LaunchComposition } from "./launch-types";
|
|
2
|
+
|
|
3
|
+
/** A recording-led starting point. Scene lengths and styling remain editable.
|
|
4
|
+
* Output fps follows the recording so the footage keeps every captured frame;
|
|
5
|
+
* the default matches `make`'s 60. */
|
|
6
|
+
export function launchStarter(
|
|
7
|
+
videoAsset = "assets/capture.mp4",
|
|
8
|
+
clipDurationS = 12,
|
|
9
|
+
fps = 60,
|
|
10
|
+
): LaunchComposition {
|
|
11
|
+
if (!Number.isFinite(clipDurationS) || clipDurationS <= 0)
|
|
12
|
+
throw new Error("launch starter: clip duration must be a finite positive number");
|
|
13
|
+
if (!Number.isInteger(fps) || fps < 1 || fps > 120)
|
|
14
|
+
throw new Error("launch starter: fps must be an integer between 1 and 120");
|
|
15
|
+
return {
|
|
16
|
+
version: 1,
|
|
17
|
+
output: { width: 1920, height: 1080, fps },
|
|
18
|
+
theme: {
|
|
19
|
+
canvas: "#F5F2EA",
|
|
20
|
+
ink: "#172E28",
|
|
21
|
+
surface: "#DCE5D8",
|
|
22
|
+
accent: "#214F41",
|
|
23
|
+
dark: "#10231E",
|
|
24
|
+
fontFamily: "Avenir Next, Avenir, Helvetica Neue, Noto Sans, sans-serif",
|
|
25
|
+
},
|
|
26
|
+
scenes: [
|
|
27
|
+
{
|
|
28
|
+
id: "opening",
|
|
29
|
+
type: "title",
|
|
30
|
+
durationS: 2,
|
|
31
|
+
lines: ["Your product. In action."],
|
|
32
|
+
motion: "off",
|
|
33
|
+
transition: { type: "cut" },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "product",
|
|
37
|
+
type: "footage",
|
|
38
|
+
durationS: clipDurationS,
|
|
39
|
+
asset: videoAsset,
|
|
40
|
+
trimStartS: 0,
|
|
41
|
+
fit: "contain",
|
|
42
|
+
frame: { inset: 64, radius: 20 },
|
|
43
|
+
transition: { type: "cut" },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "end",
|
|
47
|
+
type: "end-card",
|
|
48
|
+
durationS: 2,
|
|
49
|
+
headline: "See what you can do.",
|
|
50
|
+
brand: "Your product",
|
|
51
|
+
cta: "Explore your product",
|
|
52
|
+
motion: "off",
|
|
53
|
+
transition: { type: "cut" },
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { launchSceneDurationS } from "./launch-evaluate";
|
|
2
|
+
import type {
|
|
3
|
+
LaunchComposition,
|
|
4
|
+
LaunchIssue,
|
|
5
|
+
LaunchScene,
|
|
6
|
+
LaunchStoryEvidence,
|
|
7
|
+
LaunchStoryRole,
|
|
8
|
+
} from "./launch-types";
|
|
9
|
+
import { evaluateMotionTrack } from "./motion-evaluate";
|
|
10
|
+
import { estimateMotionReadingSeconds } from "./motion-quality";
|
|
11
|
+
import type { MotionLayer, MotionScene } from "./motion-types";
|
|
12
|
+
|
|
13
|
+
const record = (value: unknown): value is Record<string, unknown> =>
|
|
14
|
+
value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15
|
+
const finite = (value: unknown): value is number =>
|
|
16
|
+
typeof value === "number" && Number.isFinite(value);
|
|
17
|
+
const roles: LaunchStoryRole[] = ["context", "promise", "proof", "payoff", "action"];
|
|
18
|
+
type LayerRef = { layer: MotionLayer; parents: MotionLayer[] };
|
|
19
|
+
function layerIndex(scene: LaunchScene): Map<string, LayerRef> {
|
|
20
|
+
const result = new Map<string, LayerRef>();
|
|
21
|
+
const visit = (layers: MotionLayer[], parents: MotionLayer[]) => {
|
|
22
|
+
for (const layer of layers) {
|
|
23
|
+
result.set(layer.id, { layer, parents });
|
|
24
|
+
if (layer.type === "group") visit(layer.children, [...parents, layer]);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
if (scene.type === "motion") visit(scene.layers, []);
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Validate unknown story JSON. Supply structurally validated scenes to check
|
|
32
|
+
* references and scene-local windows; omission checks the metadata shape only. */
|
|
33
|
+
export function validateLaunchStory(
|
|
34
|
+
value: unknown,
|
|
35
|
+
scenes?: readonly LaunchScene[],
|
|
36
|
+
): LaunchIssue[] {
|
|
37
|
+
if (value === undefined) return [];
|
|
38
|
+
const issues: LaunchIssue[] = [];
|
|
39
|
+
const error = (path: string, message: string) =>
|
|
40
|
+
issues.push({ severity: "error", path, message });
|
|
41
|
+
if (!record(value)) return [{ severity: "error", path: "story", message: "must be an object" }];
|
|
42
|
+
const fields = (obj: Record<string, unknown>, allowed: string[], path: string) => {
|
|
43
|
+
for (const key of Object.keys(obj))
|
|
44
|
+
if (!allowed.includes(key)) error(`${path}.${key}`, "unsupported story field");
|
|
45
|
+
};
|
|
46
|
+
const text = (v: unknown, path: string, limit: number) => {
|
|
47
|
+
if (typeof v !== "string" || !v.trim() || v.length > limit) {
|
|
48
|
+
error(path, `must be a non-empty string of at most ${limit} characters`);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
};
|
|
53
|
+
fields(value, ["intent", "audience", "takeaway", "beats"], "story");
|
|
54
|
+
if (
|
|
55
|
+
typeof value.intent !== "string" ||
|
|
56
|
+
!["teaser", "launch", "walkthrough"].includes(value.intent)
|
|
57
|
+
)
|
|
58
|
+
error("story.intent", "must be teaser, launch, or walkthrough");
|
|
59
|
+
text(value.audience, "story.audience", 1000);
|
|
60
|
+
text(value.takeaway, "story.takeaway", 2000);
|
|
61
|
+
if (!Array.isArray(value.beats)) {
|
|
62
|
+
error("story.beats", "must be an array");
|
|
63
|
+
return issues;
|
|
64
|
+
}
|
|
65
|
+
const ids = new Set<string>();
|
|
66
|
+
const byId = scenes && new Map(scenes.map((scene) => [scene.id, scene]));
|
|
67
|
+
const indexes = new Map<string, Map<string, LayerRef>>();
|
|
68
|
+
for (const [i, raw] of value.beats.entries()) {
|
|
69
|
+
const path = `story.beats[${i}]`;
|
|
70
|
+
if (!record(raw)) {
|
|
71
|
+
error(path, "must be an object");
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
fields(raw, ["id", "sceneId", "startS", "endS", "role", "message", "evidence"], path);
|
|
75
|
+
if (text(raw.id, `${path}.id`, 200)) {
|
|
76
|
+
const id = raw.id as string;
|
|
77
|
+
if (ids.has(id)) error(`${path}.id`, "duplicate story beat id");
|
|
78
|
+
ids.add(id);
|
|
79
|
+
}
|
|
80
|
+
text(raw.sceneId, `${path}.sceneId`, 200);
|
|
81
|
+
const scene = typeof raw.sceneId === "string" ? byId?.get(raw.sceneId) : undefined;
|
|
82
|
+
if (byId && typeof raw.sceneId === "string" && !scene)
|
|
83
|
+
error(`${path}.sceneId`, "does not name a scene in this composition");
|
|
84
|
+
if (typeof raw.role !== "string" || !roles.includes(raw.role as LaunchStoryRole))
|
|
85
|
+
error(`${path}.role`, "must be context, promise, proof, payoff, or action");
|
|
86
|
+
text(raw.message, `${path}.message`, 4000);
|
|
87
|
+
for (const key of ["startS", "endS"])
|
|
88
|
+
if (raw[key] !== undefined && (!finite(raw[key]) || raw[key] < 0))
|
|
89
|
+
error(`${path}.${key}`, "must be finite, nonnegative scene-local seconds");
|
|
90
|
+
const duration = scene ? launchSceneDurationS(scene) : undefined;
|
|
91
|
+
const start = raw.startS === undefined ? 0 : raw.startS;
|
|
92
|
+
const end = raw.endS === undefined ? duration : raw.endS;
|
|
93
|
+
if (finite(start) && finite(end) && end <= start)
|
|
94
|
+
error(`${path}.endS`, "must be after the resolved startS");
|
|
95
|
+
if (duration !== undefined) {
|
|
96
|
+
if (finite(start) && start >= duration)
|
|
97
|
+
error(`${path}.startS`, "must start within the referenced scene");
|
|
98
|
+
if (finite(end) && end > duration + 1e-6)
|
|
99
|
+
error(`${path}.endS`, "extends past the referenced scene; beat times are scene-local");
|
|
100
|
+
}
|
|
101
|
+
if (raw.evidence === undefined) continue;
|
|
102
|
+
if (!Array.isArray(raw.evidence)) {
|
|
103
|
+
error(`${path}.evidence`, "must be an array");
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
let layers = scene && indexes.get(scene.id);
|
|
107
|
+
if (scene && !layers) {
|
|
108
|
+
layers = layerIndex(scene);
|
|
109
|
+
indexes.set(scene.id, layers);
|
|
110
|
+
}
|
|
111
|
+
for (const [j, entry] of raw.evidence.entries()) {
|
|
112
|
+
const p = `${path}.evidence[${j}]`;
|
|
113
|
+
if (!record(entry)) {
|
|
114
|
+
error(p, "must be an object");
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
fields(entry, ["kind", "layerId"], p);
|
|
118
|
+
if (
|
|
119
|
+
typeof entry.kind !== "string" ||
|
|
120
|
+
!["recording", "screenshot", "illustration"].includes(entry.kind)
|
|
121
|
+
)
|
|
122
|
+
error(`${p}.kind`, "must be recording, screenshot, or illustration");
|
|
123
|
+
if (entry.layerId !== undefined) text(entry.layerId, `${p}.layerId`, 200);
|
|
124
|
+
if (!scene) continue;
|
|
125
|
+
if (entry.layerId === undefined) {
|
|
126
|
+
if (entry.kind === "screenshot" || (entry.kind === "recording" && scene.type !== "footage"))
|
|
127
|
+
error(
|
|
128
|
+
`${p}.layerId`,
|
|
129
|
+
"must name an image/video layer in the same motion scene; only footage recordings or illustrations may omit layerId",
|
|
130
|
+
);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const target =
|
|
134
|
+
typeof entry.layerId === "string" ? layers?.get(entry.layerId)?.layer : undefined;
|
|
135
|
+
if (!target || (target.type !== "image" && target.type !== "video"))
|
|
136
|
+
error(`${p}.layerId`, "must name an image or video layer in this same motion scene");
|
|
137
|
+
else if (
|
|
138
|
+
(entry.kind === "recording" && target.type !== "video") ||
|
|
139
|
+
(entry.kind === "screenshot" && target.type !== "image")
|
|
140
|
+
)
|
|
141
|
+
error(
|
|
142
|
+
`${p}.kind`,
|
|
143
|
+
`${entry.kind} does not match the referenced ${target.type} layer; recordings require video and screenshots require image`,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return issues;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function maximum(
|
|
151
|
+
layer: MotionLayer,
|
|
152
|
+
property: string,
|
|
153
|
+
fallback: number,
|
|
154
|
+
scene: MotionScene,
|
|
155
|
+
start: number,
|
|
156
|
+
end: number,
|
|
157
|
+
): number {
|
|
158
|
+
const track =
|
|
159
|
+
scene.motion !== "off" ? layer.animations?.find((t) => t.property === property) : undefined;
|
|
160
|
+
if (!track) return Number((layer as unknown as Record<string, unknown>)[property] ?? fallback);
|
|
161
|
+
return Math.max(
|
|
162
|
+
Number(evaluateMotionTrack(track, start)),
|
|
163
|
+
Number(evaluateMotionTrack(track, end)),
|
|
164
|
+
...track.keyframes.filter((f) => f.atS > start && f.atS < end).map((f) => Number(f.value)),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
/** Proves only zero/near-zero opacity or scale for the complete interval.
|
|
168
|
+
* It does not establish visible pixels, occlusion, framing, or semantic truth. */
|
|
169
|
+
function definitelyHidden(ref: LayerRef, scene: MotionScene, start: number, end: number): boolean {
|
|
170
|
+
return [...ref.parents, ref.layer].some(
|
|
171
|
+
(layer) =>
|
|
172
|
+
maximum(layer, "opacity", 1, scene, start, end) <= 0.001 ||
|
|
173
|
+
maximum(layer, "scaleX", 1, scene, start, end) <= 0.001 ||
|
|
174
|
+
maximum(layer, "scaleY", 1, scene, start, end) <= 0.001,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Editorial heuristics for structurally validated compositions. These are
|
|
179
|
+
* warnings, never an aesthetic score or verification of an evidence claim. */
|
|
180
|
+
export function analyzeLaunchStory(composition: LaunchComposition): LaunchIssue[] {
|
|
181
|
+
const story = composition.story;
|
|
182
|
+
if (!story) return [];
|
|
183
|
+
const issues: LaunchIssue[] = [];
|
|
184
|
+
const warn = (path: string, message: string) => issues.push({ severity: "warn", path, message });
|
|
185
|
+
const required: LaunchStoryRole[] =
|
|
186
|
+
story.intent === "teaser"
|
|
187
|
+
? ["promise"]
|
|
188
|
+
: story.intent === "launch"
|
|
189
|
+
? ["context", "promise", "action"]
|
|
190
|
+
: ["context", "action"];
|
|
191
|
+
for (const role of required)
|
|
192
|
+
if (!story.beats.some((beat) => beat.role === role))
|
|
193
|
+
warn(
|
|
194
|
+
"story.beats",
|
|
195
|
+
`No ${role} beat is declared for this ${story.intent}. Consider ${role === "promise" ? "stating the main message" : role === "context" ? "orienting the intended audience" : "giving the audience a useful next step"}; intentional omissions are allowed.`,
|
|
196
|
+
);
|
|
197
|
+
const promises = story.beats.filter((beat) => beat.role === "promise");
|
|
198
|
+
if (
|
|
199
|
+
new Set(promises.map((beat) => beat.message.trim().replace(/\s+/g, " ").toLowerCase())).size > 1
|
|
200
|
+
)
|
|
201
|
+
warn(
|
|
202
|
+
"story.beats",
|
|
203
|
+
"Several promise beats declare different messages. Check whether they support one main takeaway or compete for attention; this is an editorial prompt, not a semantic judgment.",
|
|
204
|
+
);
|
|
205
|
+
const scenes = new Map(composition.scenes.map((scene) => [scene.id, scene]));
|
|
206
|
+
const indexes = new Map<string, Map<string, LayerRef>>();
|
|
207
|
+
let actualEvidence = false;
|
|
208
|
+
story.beats.forEach((beat, i) => {
|
|
209
|
+
const scene = scenes.get(beat.sceneId)!;
|
|
210
|
+
const path = `story.beats[${i}]`,
|
|
211
|
+
start = beat.startS ?? 0,
|
|
212
|
+
end = beat.endS ?? launchSceneDurationS(scene);
|
|
213
|
+
const reading = estimateMotionReadingSeconds(beat.message);
|
|
214
|
+
if (end - start + 0.001 < reading)
|
|
215
|
+
warn(
|
|
216
|
+
`${path}.endS`,
|
|
217
|
+
`The ${(end - start).toFixed(2)}s editorial window is shorter than the roughly ${reading.toFixed(2)}s reading estimate for its message. Shorten the intended message or allow more time; this does not assert that the message is on-screen copy.`,
|
|
218
|
+
);
|
|
219
|
+
let layers = indexes.get(scene.id);
|
|
220
|
+
if (!layers) {
|
|
221
|
+
layers = layerIndex(scene);
|
|
222
|
+
indexes.set(scene.id, layers);
|
|
223
|
+
}
|
|
224
|
+
let beatActual = false;
|
|
225
|
+
(beat.evidence ?? []).forEach((evidence: LaunchStoryEvidence, j) => {
|
|
226
|
+
const p = `${path}.evidence[${j}]`,
|
|
227
|
+
ref = evidence.layerId ? layers.get(evidence.layerId) : undefined;
|
|
228
|
+
const hidden = ref && scene.type === "motion" && definitelyHidden(ref, scene, start, end);
|
|
229
|
+
if (hidden)
|
|
230
|
+
warn(
|
|
231
|
+
p,
|
|
232
|
+
"The referenced evidence has zero or near-zero opacity/scale throughout this beat, including its ancestors. It cannot supply visible evidence in this window.",
|
|
233
|
+
);
|
|
234
|
+
if (evidence.kind !== "illustration" && !hidden) beatActual = true;
|
|
235
|
+
if (evidence.kind === "recording" && ref?.layer.type === "video") {
|
|
236
|
+
const activeStart = ref.layer.startS ?? 0,
|
|
237
|
+
activeEnd = activeStart + ref.layer.durationS;
|
|
238
|
+
if (Math.min(end, activeEnd) <= Math.max(start, activeStart))
|
|
239
|
+
warn(
|
|
240
|
+
p,
|
|
241
|
+
"This beat does not overlap the recording layer's active playback span; the renderer holds an endpoint frame here. It may show a real still, but does not demonstrate recorded motion in this window.",
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
actualEvidence ||= beatActual;
|
|
246
|
+
if (beat.role === "proof" && !beatActual)
|
|
247
|
+
warn(
|
|
248
|
+
`${path}.evidence`,
|
|
249
|
+
`This ${story.intent} declares a proof beat without potentially visible recording/screenshot evidence. An illustration can explain an idea but is not actual UI proof.`,
|
|
250
|
+
);
|
|
251
|
+
});
|
|
252
|
+
if (story.intent !== "teaser" && !actualEvidence)
|
|
253
|
+
warn(
|
|
254
|
+
"story.beats",
|
|
255
|
+
"No potentially visible recording/screenshot evidence is declared. Add a relevant actual source for the main claim; illustrations do not count as actual UI proof. References alone cannot verify what an asset depicts or whether a claim is true.",
|
|
256
|
+
);
|
|
257
|
+
return issues;
|
|
258
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { LaunchComposition } from "./launch-types";
|
|
2
|
+
|
|
3
|
+
export function launchTemplate(
|
|
4
|
+
videoAsset = "assets/capture.mp4",
|
|
5
|
+
clipDurationS = 12,
|
|
6
|
+
): LaunchComposition {
|
|
7
|
+
const firstDuration = Math.min(5, Math.max(0.5, clipDurationS / 2));
|
|
8
|
+
const secondStart = firstDuration;
|
|
9
|
+
const secondDuration = Math.min(6, Math.max(0.5, clipDurationS - secondStart));
|
|
10
|
+
return {
|
|
11
|
+
version: 1,
|
|
12
|
+
output: { width: 1920, height: 1080, fps: 30 },
|
|
13
|
+
theme: {
|
|
14
|
+
canvas: "#F5F2EA",
|
|
15
|
+
ink: "#172E28",
|
|
16
|
+
surface: "#DCE5D8",
|
|
17
|
+
accent: "#214F41",
|
|
18
|
+
dark: "#10231E",
|
|
19
|
+
fontFamily: "Avenir Next, Avenir, Helvetica Neue, Noto Sans, sans-serif",
|
|
20
|
+
},
|
|
21
|
+
scenes: [
|
|
22
|
+
{
|
|
23
|
+
id: "opening",
|
|
24
|
+
type: "title",
|
|
25
|
+
durationS: 3,
|
|
26
|
+
lines: ["Real clicks.", "Ready for launch."],
|
|
27
|
+
brand: "Open Take",
|
|
28
|
+
staggerS: 0.38,
|
|
29
|
+
transition: { type: "fade", durationS: 0.45 },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "capture",
|
|
33
|
+
type: "footage",
|
|
34
|
+
durationS: firstDuration,
|
|
35
|
+
asset: videoAsset,
|
|
36
|
+
trimStartS: 0,
|
|
37
|
+
fit: "contain",
|
|
38
|
+
frame: { inset: 92, radius: 28 },
|
|
39
|
+
caption: "Capture the real thing.",
|
|
40
|
+
transition: { type: "slide", durationS: Math.min(0.5, firstDuration / 3) },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "compose",
|
|
44
|
+
type: "ui-morph",
|
|
45
|
+
states: [
|
|
46
|
+
{
|
|
47
|
+
icon: "record",
|
|
48
|
+
label: "Record",
|
|
49
|
+
prompt: "",
|
|
50
|
+
transitionS: 0.55,
|
|
51
|
+
typeDelayS: 0.54,
|
|
52
|
+
typeS: 0.01,
|
|
53
|
+
holdS: 0,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
icon: "record",
|
|
57
|
+
label: "Record",
|
|
58
|
+
prompt: "Record the real app.",
|
|
59
|
+
transitionS: 0.55,
|
|
60
|
+
typeDelayS: 0.18,
|
|
61
|
+
typeS: 0.7,
|
|
62
|
+
holdS: 0.32,
|
|
63
|
+
panelWidth: 1100,
|
|
64
|
+
panelHeight: 218,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
icon: "style",
|
|
68
|
+
label: "Style",
|
|
69
|
+
prompt: "Make it cinematic.",
|
|
70
|
+
transitionS: 0.6,
|
|
71
|
+
typeDelayS: 0.6,
|
|
72
|
+
typeS: 0.7,
|
|
73
|
+
holdS: 0.5,
|
|
74
|
+
panelWidth: 1040,
|
|
75
|
+
panelHeight: 218,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
icon: "refine",
|
|
79
|
+
label: "Refine",
|
|
80
|
+
prompt: "Tighten the focus.",
|
|
81
|
+
transitionS: 0.6,
|
|
82
|
+
typeDelayS: 0.6,
|
|
83
|
+
typeS: 0.7,
|
|
84
|
+
holdS: 1.15,
|
|
85
|
+
panelWidth: 1060,
|
|
86
|
+
panelHeight: 218,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
eyebrow: "Make it yours.",
|
|
90
|
+
panel: { width: 1100, compactHeight: 112, expandedHeight: 218, radius: 34 },
|
|
91
|
+
transition: { type: "fade", durationS: 0.35 },
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "editable",
|
|
95
|
+
type: "footage",
|
|
96
|
+
durationS: secondDuration,
|
|
97
|
+
asset: videoAsset,
|
|
98
|
+
trimStartS: secondStart,
|
|
99
|
+
fit: "contain",
|
|
100
|
+
background: "dark",
|
|
101
|
+
frame: { inset: 84, radius: 28 },
|
|
102
|
+
caption: "Keep every detail editable.",
|
|
103
|
+
transition: { type: "slide", durationS: Math.min(0.5, secondDuration / 3) },
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "payoff",
|
|
107
|
+
type: "title",
|
|
108
|
+
durationS: 3,
|
|
109
|
+
background: "dark",
|
|
110
|
+
lines: ["Record.", "Compose.", "Refine."],
|
|
111
|
+
staggerS: 0.42,
|
|
112
|
+
transition: { type: "fade", durationS: 0.4 },
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "end",
|
|
116
|
+
type: "end-card",
|
|
117
|
+
durationS: 3,
|
|
118
|
+
headline: "Your next release. In motion.",
|
|
119
|
+
brand: "Open Take",
|
|
120
|
+
cta: "npm create open-take@latest",
|
|
121
|
+
transition: { type: "fade", durationS: 0.45 },
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { MotionScene } from "./motion-types";
|
|
2
|
+
|
|
3
|
+
export type LaunchTransition = { type: "cut" | "fade" | "slide"; durationS?: number };
|
|
4
|
+
|
|
5
|
+
export type LaunchTheme = {
|
|
6
|
+
canvas: string;
|
|
7
|
+
ink: string;
|
|
8
|
+
surface: string;
|
|
9
|
+
accent: string;
|
|
10
|
+
dark: string;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type SceneBase = {
|
|
15
|
+
id: string;
|
|
16
|
+
durationS: number;
|
|
17
|
+
transition?: LaunchTransition;
|
|
18
|
+
background?: "canvas" | "dark";
|
|
19
|
+
colors?: Partial<LaunchTheme>;
|
|
20
|
+
/** Disable title/end-card entrances while keeping their copy visible. */
|
|
21
|
+
motion?: "on" | "off";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type LaunchTitleScene = SceneBase & {
|
|
25
|
+
type: "title";
|
|
26
|
+
lines: string[];
|
|
27
|
+
brand?: string;
|
|
28
|
+
staggerS?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type LaunchFootageScene = SceneBase & {
|
|
32
|
+
type: "footage";
|
|
33
|
+
asset: string;
|
|
34
|
+
trimStartS?: number;
|
|
35
|
+
fit?: "contain" | "cover";
|
|
36
|
+
frame?: { inset: number; radius: number };
|
|
37
|
+
caption?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type LaunchUiState = {
|
|
41
|
+
icon: "record" | "style" | "refine" | "camera" | "spark" | "target";
|
|
42
|
+
label: string;
|
|
43
|
+
prompt: string;
|
|
44
|
+
transitionS: number;
|
|
45
|
+
typeDelayS: number;
|
|
46
|
+
typeS: number;
|
|
47
|
+
holdS: number;
|
|
48
|
+
panelWidth?: number;
|
|
49
|
+
panelHeight?: number;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type LaunchUiMorphScene = Omit<SceneBase, "durationS"> & {
|
|
53
|
+
type: "ui-morph";
|
|
54
|
+
/** Optional assertion. Omit it to let state timings alone set scene length. */
|
|
55
|
+
durationS?: number;
|
|
56
|
+
states: LaunchUiState[];
|
|
57
|
+
eyebrow?: string;
|
|
58
|
+
panel?: { width: number; compactHeight: number; expandedHeight: number; radius: number };
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type LaunchEndCardScene = SceneBase & {
|
|
62
|
+
type: "end-card";
|
|
63
|
+
headline: string;
|
|
64
|
+
brand: string;
|
|
65
|
+
cta: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type LaunchScene =
|
|
69
|
+
| LaunchTitleScene
|
|
70
|
+
| LaunchFootageScene
|
|
71
|
+
| LaunchUiMorphScene
|
|
72
|
+
| LaunchEndCardScene
|
|
73
|
+
| MotionScene;
|
|
74
|
+
|
|
75
|
+
export type LaunchAudioTrack = {
|
|
76
|
+
id: string;
|
|
77
|
+
kind: "music" | "narration" | "sfx";
|
|
78
|
+
asset: string;
|
|
79
|
+
/** Absolute placement, or placement relative to the end of a scene. */
|
|
80
|
+
atS?: number;
|
|
81
|
+
afterSceneId?: string;
|
|
82
|
+
offsetS?: number;
|
|
83
|
+
trimStartS?: number;
|
|
84
|
+
durationS?: number;
|
|
85
|
+
gain?: number;
|
|
86
|
+
fadeInS?: number;
|
|
87
|
+
fadeOutS?: number;
|
|
88
|
+
duckMusic?: boolean;
|
|
89
|
+
/** Music only: repeat the source when shorter than the declared window. */
|
|
90
|
+
loop?: boolean;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type LaunchStoryIntent = "teaser" | "launch" | "walkthrough";
|
|
94
|
+
export type LaunchStoryRole = "context" | "promise" | "proof" | "payoff" | "action";
|
|
95
|
+
export type LaunchStoryEvidence = {
|
|
96
|
+
kind: "recording" | "screenshot" | "illustration";
|
|
97
|
+
/** Image/video layer in the beat's motion scene. Footage recording may omit this. */
|
|
98
|
+
layerId?: string;
|
|
99
|
+
};
|
|
100
|
+
export type LaunchStoryBeat = {
|
|
101
|
+
id: string;
|
|
102
|
+
sceneId: string;
|
|
103
|
+
/** Scene-local seconds. Defaults to zero and the scene's full duration. */
|
|
104
|
+
startS?: number;
|
|
105
|
+
endS?: number;
|
|
106
|
+
role: LaunchStoryRole;
|
|
107
|
+
/** Editorial intent, not a claim that this exact copy appears on screen. */
|
|
108
|
+
message: string;
|
|
109
|
+
evidence?: LaunchStoryEvidence[];
|
|
110
|
+
};
|
|
111
|
+
export type LaunchStory = {
|
|
112
|
+
intent: LaunchStoryIntent;
|
|
113
|
+
audience: string;
|
|
114
|
+
takeaway: string;
|
|
115
|
+
beats: LaunchStoryBeat[];
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type LaunchComposition = {
|
|
119
|
+
version: 1;
|
|
120
|
+
output: { width: number; height: number; fps: number };
|
|
121
|
+
theme: LaunchTheme;
|
|
122
|
+
scenes: LaunchScene[];
|
|
123
|
+
audio?: LaunchAudioTrack[];
|
|
124
|
+
story?: LaunchStory;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type LaunchIssue = { severity: "error" | "warn"; path: string; message: string };
|