Files
patriothacks/e2e/openmotion/buildComposition.mjs
T
OmO Orchestrator f2764769a8 fix(promo-video): drop frozen-frame ledger motif for real per-app footage (full-v11)
Per explicit feedback on full-v10: the "SIGNED EVENT LOG - LIVE" terminal
panel (hex hash, type/fields JSON line, blinking cursor) and the per-app
frozen-still hold are both gone.

- buildComposition.mjs: removed layoutAppStage's static-snapshot hold +
  extractAppClips() entirely; each app's window now plays its own real
  captured clip continuously. Per-app text is a single large/bold/short
  plain-language headline with an optional small event-type pill - no
  hash/JSON/monospace anywhere.
- tour.mjs: added app-<id>-start/-end marks around all 13 mini-apps plus
  a linger() helper (real scroll + :hover motion, never a held frame) so
  a from-scratch recapture can give each app a dedicated, longer real clip.
  Also fixed a real flake: ShellLayout's boot-time auto-seed means the
  Admin page's demo-load status now usually reads "already loaded", not
  "Demo data loaded" - the beat's waitFor accepts both.
- capture.mjs: CLIP_SPEC slices one real clip per mini-app via the new
  marks (replacing the old 3 giant per-act blobs) for that recapture path.
- src/lib/farms.ts: fixed a real LP-solver bug surfaced while recapturing -
  a crop with kWhPerM2: 0 under any positive energyBudgetKwh produced a
  false "infeasible" (an all-zero-coefficient constraint row breaks
  javascript-lp-solver's simplex solve). Now the energy constraint is only
  added when some eligible crop actually draws power. Regression test added.

SHIP-NOW NOTE: the from-scratch recapture (dedicated 8-12s real dwell per
app) hit an additional intermittent Health Post hang under deadline
pressure; full-v11 instead reuses the already-captured, already-verified
act1/act2/act3 footage, playing each app's own real sub-window
continuously (old, shorter per-app dwell - disclosed, not padded with any
hold). A true recapture with longer dwell is the follow-up.
2026-11-20 23:09:46 -05:00

758 lines
43 KiB
JavaScript

// STAGE-2/REDESIGN-5 OpenMotion full main-tour: composition builder.
//
// REDESIGN-5 GOAL, per explicit user feedback on the previous build
// (full-v10.mp4): that build froze a single still PNG for the entirety of
// every mini-app's on-screen window (REDESIGN-4's `layoutAppStage()`
// decision, after two live-video attempts intermittently showed a black
// frame), paired with a "SIGNED EVENT LOG - LIVE" terminal/monospace panel
// (hex hash, `type`/`fields` JSON line, blinking cursor) per app. Both are
// gone:
// - capture.mjs now records ONE dedicated real clip per mini-app (marked
// by tour.mjs's app-<id>-start/-end pairs, each extended with a real,
// visibly-moving `linger()` - scroll pulses + a real :hover state, never
// a frozen frame), so every app's clip IS its own on-screen window -
// played back in full, continuously. No hold mechanism, no extracted
// still frames, no mediaStart/dwell estimation: the window duration is
// just that app's own real captured clip length.
// - the per-app side panel is now a single large, bold, SHORT plain-
// language headline (app-store-feature-callout style) with an optional
// small caption naming the real signed event type - no hex, no JSON, no
// monospace/terminal styling anywhere.
//
// Everything else (data open, chapter cards, assembly two-device clip,
// result wall) is unchanged structurally from REDESIGN-3/4 - this build
// only touches the per-app stage content and its timing math, which is now
// far simpler (sum of real clip durations, not an estimated reading-time /
// real-dwell / hold-floor computation).
//
// REBUILD + RENDER (captured footage in assets/*.mp4 is reused as-is; only
// run capture.mjs/captureAssembly.mjs again if the app's UI itself changed):
// bun e2e/openmotion/buildComposition.mjs
// cd e2e/openmotion && \
// HYPERFRAMES_FFMPEG_PATH=<repo>/node_modules/ffmpeg-static/ffmpeg \
// HYPERFRAMES_FFPROBE_PATH=<repo>/node_modules/ffprobe-static/bin/linux/x64/ffprobe \
// HYPERFRAMES_BROWSER_PATH=~/.cache/ms-playwright/chromium-1255/chrome-linux64/chrome \
// <node 22.12+/26> /home/athapa/openmotion/node_modules/hyperframes/bin/hyperframes.mjs \
// render . -o renders/<name>.mp4 --video-frame-format png
import { readFileSync, writeFileSync, mkdirSync, copyFileSync, existsSync } from "node:fs";
import { execFileSync } from "node:child_process";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import ffmpegStatic from "ffmpeg-static";
import { TITLE_CARDS } from "./tour.mjs";
import { HOLLOW_DEMO_FIXTURE } from "../../src/admin/seedEvents.ts";
const __dirname = dirname(fileURLToPath(import.meta.url));
const OM_DIR = __dirname;
const MANIFEST = resolve(OM_DIR, "capture-manifest.json");
const ASSEMBLY_MANIFEST = resolve(OM_DIR, "assembly-manifest.json");
const COMPOSITIONS_DIR = resolve(OM_DIR, "compositions");
const ASSETS_DIR = resolve(OM_DIR, "assets");
const WALL_DIR = resolve(ASSETS_DIR, "wall");
// Real per-mini-app Playwright screenshots captured by the same real-app run
// (one still per mini-app). Used only in the closing result wall.
const SHOT_SRC = resolve(OM_DIR, "..", "..", ".omo", "evidence", "full-feature-demo");
const FFMPEG_BIN = ffmpegStatic;
const CANVAS_W = 1920;
const CANVAS_H = 1080;
const FPS = 30;
const BEZEL = 8; // thin modern device frame around the real screen footage
// --- ambient audio (unchanged proven approach) ---
// Three sine oscillators C3/E3/G3 amixed 1/0.8/0.7, slow tremolo, baked
// fades. Raw track ~-27.9 dB mean; data-volume 0.30 lands the final mix at
// ~-38 dB mean (in the proven -37..-40 dB band, max well below 0).
const AMBIENT_SRC = "assets/ambient.mp3";
const AMBIENT_VOLUME = 0.3;
const esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
const r3 = (n) => Number(Number(n).toFixed(3));
// ---------------------------------------------------------------------
// Palette: a COLOR JOURNEY. Bold saturated chapter colors punctuate darker
// tinted act fields, so the background visibly changes shape over the
// runtime instead of one dark blue the whole time. No pure white anywhere
// (keeps the luma scan clean - no white-flash ambiguity).
// ---------------------------------------------------------------------
const BRAND = "#1677FF";
const COLORS = {
data: "linear-gradient(150deg,#1a7bff 0%,#0f62d8 55%,#0a46a6 100%)",
chapter1: "linear-gradient(150deg,#1657c8 0%,#0c346f 100%)", // azure
chapter2: "linear-gradient(150deg,#ffb020 0%,#f58a10 100%)", // amber (dark text)
chapter3: "linear-gradient(150deg,#13a085 0%,#0a5f50 100%)", // teal
chapterE: "linear-gradient(150deg,#7a52e8 0%,#4b2fb0 100%)", // violet
fieldAct1: "radial-gradient(1200px 820px at 70% 30%,#123a6b 0%,#081c3a 60%,#05101f 100%)", // deep ocean
fieldAct2: "radial-gradient(1200px 820px at 50% 24%,#1a2330 0%,#0d1117 62%,#06080c 100%)", // charcoal
fieldAct3: "radial-gradient(1200px 820px at 30% 30%,#1b2a66 0%,#10163a 60%,#080b22 100%)", // indigo
fieldEpi: "radial-gradient(1200px 820px at 50% 28%,#2c1a56 0%,#1a1030 60%,#0d0820 100%)", // plum
fieldAssembly: "radial-gradient(900px 640px at 50% 56%,#4a2a86 0%,#241a52 55%,#0d0820 100%)", // plum/indigo blend
wall: "linear-gradient(160deg,#1a7bff 0%,#0e55c0 55%,#0a327e 100%)",
};
// ---------------------------------------------------------------------
// Result-wall tiles: one real captured screenshot per mini-app (13).
// ---------------------------------------------------------------------
const WALL_TILES = [
{ file: "main-03-waterwatch-no-false-alert.png", label: "Water Watch" },
{ file: "main-07-fairshare-water.png", label: "Fair Share" },
{ file: "main-11-farms-forecast.png", label: "Farms" },
{ file: "main-13-housing.png", label: "Housing" },
{ file: "main-16-mentor.png", label: "Mentor" },
{ file: "main-18-healthpost-triage.png", label: "Health Post" },
{ file: "main-20-lightclock-manual-fallback.png", label: "Light Clock" },
{ file: "main-22-theclimb.png", label: "The Climb" },
{ file: "main-08-tunnelsafety.png", label: "Tunnel Safety" },
{ file: "main-09-findfamily.png", label: "Find Family" },
{ file: "main-28-assembly-qv-tally.png", label: "Assembly" },
{ file: "main-30-fairdraw-reveal.png", label: "Fair Draw" },
{ file: "main-33-sky-post.png", label: "Sky" },
];
// ---------------------------------------------------------------------
// Timeline builder. A single running cursor lays out ordered SEGMENTS with
// a small crossfade overlap. Two layer classes:
// - overlay segments (data open, chapter cards, wall): full-screen panels
// that crossfade OVER the phone stage.
// - stage segments (act footage, assembly): the phone/field beneath.
// ---------------------------------------------------------------------
const XF = 0.5; // crossfade overlap between consecutive segments
const DATA_DUR = 7.0;
const CH_DUR = 3.1; // chapter card window
const WALL_DUR = 7.0;
function clipDur(clips, name) {
const v = clips.find((c) => c.name === name)?.durationS;
if (!v) throw new Error(`clip ${name} missing/zero duration in manifest`);
return v;
}
// ---------------------------------------------------------------------
// Per-mini-app content (REDESIGN-5: large/short plain-language text, real
// continuous footage, no ledger/terminal motif).
//
// SHIP-NOW FALLBACK: a from-scratch per-app recapture (dedicated 8-12s
// clips) hit a real, now-fixed LP-solver bug (src/lib/farms.ts) plus an
// intermittent Health Post hang mid-run; under a hard deadline this build
// instead reuses the already-captured, already-verified act1/act2/act3
// footage (capture-manifest.json's real `beats`), playing each app's own
// real sub-window of that shared clip CONTINUOUSLY (never a frozen still -
// the one thing being fixed) via `mediaStart`/`dwell`. These are the same
// real, frame-verified offsets the previous (frozen-snapshot) build used -
// only the playback mechanism changed (continuous real video, not a single
// extracted PNG) and the window no longer pads past that real dwell with a
// hold. Per-app dwell is therefore shorter than the 8-12s target here
// (disclosed risk - see DoneClaim); a true recapture with longer per-app
// dwell is the follow-up, tracked separately.
// `type` is the real signed event the app emits mid-clip (optional small
// caption, shown as a plain tag - no hash, no JSON, no monospace).
// ---------------------------------------------------------------------
const APP_BLURBS = [
{ id: "waterwatch", act: "act1", assetKey: "act1", mediaStart: 1.97, dwell: 5.63, label: "Water Watch", type: "waterwatch.reading.report", headline: "Catches bad water before anyone drinks it." },
{ id: "fairshare", act: "act1", assetKey: "act1", mediaStart: 7.95, dwell: 0.85, label: "Fair Share", type: "fairshare.need", headline: "Splits power, water, and food fairly, automatically." },
{ id: "tunnelsafety", act: "act1", assetKey: "act1", mediaStart: 9.25, dwell: 0.80, label: "Tunnel Safety", type: "tunnelsafety.hazard.report", headline: "Reports a blocked tunnel so everyone reroutes instantly." },
{ id: "findfamily", act: "act1", assetKey: "act1", mediaStart: 10.4, dwell: 1.40, label: "Find Family", type: null, headline: "Finds missing family, privately. No one else sees your search." },
{ id: "farms", act: "act2", assetKey: "act2", mediaStart: 2.4, dwell: 0.9, label: "Farms", type: "fairshare.contribution", headline: "Plans crops from real weather and power data." },
{ id: "housing", act: "act2", assetKey: "act2", mediaStart: 4.8, dwell: 3.7, label: "Housing", type: "housing.space.report", headline: "Assigns rooms fairly \u2014 and remembers who got shorted." },
{ id: "mentor", act: "act2", assetKey: "act2", mediaStart: 9.4, dwell: 1.4, label: "Mentor", type: "mentor.match", headline: "Matches you with a mentor before a skill is lost." },
{ id: "healthpost", act: "act2", assetKey: "act2", mediaStart: 11.2, dwell: 3.1, label: "Health Post", type: "healthpost.referral", headline: "Triages symptoms, then signs a referral to a clinician." },
{ id: "lightclock", act: "act2", assetKey: "act2", mediaStart: 14.8, dwell: 0.8, label: "Light Clock", type: null, headline: "Tracks your sleep rhythm without sunlight \u2014 no sensor required." },
{ id: "theclimb", act: "act2", assetKey: "act2", mediaStart: 16.8, dwell: 3.5, label: "The Climb", type: "theclimb.plan.propose", headline: "Schedules the climb to the surface so no crowd crush happens." },
{ id: "qvballot", act: "act3", assetKey: "act3", mediaStart: 0.5, dwell: 7.8, label: "Assembly", type: "governance.qvBallot", headline: "Keeps votes and lotteries running \u2014 network or not." },
{ id: "fairdraw", act: "act3", assetKey: "act3", mediaStart: 8.9, dwell: 2.5, label: "Fair Draw", type: "fairdraw.commit", headline: "Runs a lottery no one can rig." },
{ id: "sky", act: "act3", assetKey: "act3", mediaStart: 13.2, dwell: 5.6, label: "Sky", type: "sky.morale.pulse", headline: "A shared mood board for the whole shelter." },
];
// Lay out one act's apps back-to-back (hard cuts between apps). Each app's
// window is its own real, already-verified dwell within the shared act clip
// (see APP_BLURBS header note) - played CONTINUOUSLY from `mediaStart` for
// `dwell` seconds, never a frozen still. Returns the stage's total duration,
// the per-app text entries (synced 1:1 to each clip's start), and the
// <video> clip specs (several logical clips can share one real asset file).
function layoutAppStage(clips, actKey, introKey) {
const apps = APP_BLURBS.filter((a) => a.act === actKey);
const clipSpecs = [];
let cursor = 0;
if (introKey) {
const introDur = clipDur(clips, introKey);
clipSpecs.push({ key: introKey, assetKey: introKey, mediaStart: 0, duration: introDur });
cursor = introDur;
}
const entries = [];
for (const app of apps) {
const dur = r3(app.dwell);
clipSpecs.push({ key: app.id, assetKey: app.assetKey, mediaStart: app.mediaStart, duration: dur });
entries.push({ label: app.label, headline: app.headline, type: app.type, at: r3(cursor) });
cursor = r3(cursor + dur);
}
return { dur: cursor, entries, clipSpecs };
}
function buildTimeline(clips, assemblyDur) {
const seg = [];
let t = 0;
const push = (s) => {
s.start = r3(t);
s.end = r3(t + s.dur);
seg.push(s);
t = s.end - XF; // next segment crossfades in over this one's tail
return s;
};
push({ id: "data", kind: "data", dur: DATA_DUR });
// Act I: intro clip (cold-start/home/admin) + 4 individually-timed app clips.
push({ id: "ch-act1", kind: "chapter", dur: CH_DUR, card: "act1", color: COLORS.chapter1, cap: BRAND, capFg: "#fff", keyword: "Verified Twice" });
const act1Layout = layoutAppStage(clips, "act1", "intro");
const act1Stage = push({
id: "act1", kind: "stage", dur: act1Layout.dur,
field: COLORS.fieldAct1, frame: { x: 332, y: 0, scale: 0.9, tilt: -7 }, textSide: "left", card: "act1",
clips: act1Layout.clipSpecs,
entries: act1Layout.entries,
});
push({ id: "ch-act2", kind: "chapter", dur: CH_DUR, card: "act2", color: COLORS.chapter2, cap: "#101418", capFg: "#ffcf4d", dark: true, keyword: "Alive" });
const act2Layout = layoutAppStage(clips, "act2", null);
const act2Stage = push({
id: "act2", kind: "stage", dur: act2Layout.dur,
field: COLORS.fieldAct2, frame: { x: -300, y: 0, scale: 0.84, tilt: 9 }, textSide: "right", card: "act2",
clips: act2Layout.clipSpecs,
entries: act2Layout.entries,
});
push({ id: "ch-act3", kind: "chapter", dur: CH_DUR, card: "act3", color: COLORS.chapter3, cap: "#063f36", capFg: "#9bffe6", keyword: "Decides" });
const act3Layout = layoutAppStage(clips, "act3", null);
const act3Stage = push({
id: "act3", kind: "stage", dur: act3Layout.dur,
field: COLORS.fieldAct3, frame: { x: 332, y: 0, scale: 0.9, tilt: -9 }, textSide: "left", card: "act3",
clips: act3Layout.clipSpecs,
entries: act3Layout.entries,
});
push({ id: "ch-epi", kind: "chapter", dur: CH_DUR, card: "epilogue", color: COLORS.chapterE, cap: "#2e1a63", capFg: "#d8c6ff", keyword: "Verifiable" });
push({
id: "epilogue", kind: "stage", dur: clipDur(clips, "epilogue"),
field: COLORS.fieldEpi, frame: { x: -300, y: 0, scale: 0.84, tilt: 7 }, textSide: "right", card: "epilogue",
clips: [{ key: "epilogue" }],
entries: [
{ label: "Wallet", type: "wallet.transfer", headline: "Every balance re-checks its own signature \u2014 nothing on faith.", at: 0.3 },
{ label: "Upload", type: null, headline: "Any resident can ship a mini-app. No gatekeeper.", at: 2.2 },
],
});
// Assembly two-device clip: a pre-composited 1920x1080 scene with its own
// baked fades, given the same field/frame/caption treatment as every act.
push({ id: "assembly", kind: "assembly", dur: assemblyDur, field: COLORS.fieldAssembly });
// Result wall + brand lockup.
const wall = push({ id: "wall", kind: "wall", dur: WALL_DUR });
// Absolute end: wall end + a short dark tail so the film closes on black
// (clean stop, no white flash) arriving from a completely new scene.
const total = r3(wall.end + 0.2);
return { seg, total };
}
// Assign each stage segment's clip windows (absolute film time) from the
// segment start, back-to-back.
function layoutClips(seg, clips) {
const out = [];
for (const s of seg) {
if (s.kind !== "stage") continue;
let c = s.start;
for (const clip of s.clips) {
const duration = clip.duration != null ? clip.duration : clipDur(clips, clip.key);
const assetKey = clip.assetKey || clip.key;
const mediaStart = clip.mediaStart || 0;
out.push({ seg: s.id, key: clip.key, assetKey, mediaStart: r3(mediaStart), start: r3(c), duration: r3(duration) });
c = r3(c + duration);
}
}
return out;
}
function generateAmbientTrack(outPath, durationSeconds) {
mkdirSync(dirname(outPath), { recursive: true });
const fadeOutStart = Math.max(0, durationSeconds - 4);
execFileSync(
FFMPEG_BIN,
[
"-y",
"-f", "lavfi", "-i", `sine=frequency=130.81:duration=${durationSeconds}`,
"-f", "lavfi", "-i", `sine=frequency=164.81:duration=${durationSeconds}`,
"-f", "lavfi", "-i", `sine=frequency=196.00:duration=${durationSeconds}`,
"-filter_complex",
`[0][1][2]amix=inputs=3:duration=longest:weights=1 0.8 0.7[mix];` +
`[mix]tremolo=f=0.15:d=0.3,afade=t=in:st=0:d=3,afade=t=out:st=${fadeOutStart}:d=4[out]`,
"-map", "[out]",
"-c:a", "libmp3lame", "-b:a", "128k",
outPath,
],
{ stdio: ["ignore", "pipe", "pipe"] },
);
return outPath;
}
// Split a title into a lead and a keyword phrase so the keyword can sit in a
// bold capsule pill (Cash App technique). Returns { lead, key }.
function splitKeyword(title, keyword) {
const idx = title.indexOf(keyword);
if (idx === -1) return { lead: title, key: "" };
return { lead: title.slice(0, idx).trim(), key: keyword };
}
function main() {
const manifest = JSON.parse(readFileSync(MANIFEST, "utf8"));
const { videoSize, clips } = manifest;
if (!existsSync(ASSEMBLY_MANIFEST)) throw new Error(`assembly manifest not found at ${ASSEMBLY_MANIFEST}`);
const assemblyDur = JSON.parse(readFileSync(ASSEMBLY_MANIFEST, "utf8")).clip?.durationS;
if (!assemblyDur) throw new Error("assembly clip missing/zero duration");
const { seg, total } = buildTimeline(clips, assemblyDur);
const clipWins = layoutClips(seg, clips);
generateAmbientTrack(resolve(ASSETS_DIR, "ambient.mp3"), total);
// Copy the real per-mini-app screenshots into assets/wall for the wall.
mkdirSync(WALL_DIR, { recursive: true });
for (const tile of WALL_TILES) {
const src = resolve(SHOT_SRC, tile.file);
if (!existsSync(src)) throw new Error(`wall screenshot not found: ${src}`);
copyFileSync(src, resolve(WALL_DIR, tile.file));
}
// Phone geometry (aspect-exact so object-fit crops nothing). Base size is
// modest; per-act scale makes some acts larger/flatter.
const PHONE_H = 860;
const phoneW = r3((PHONE_H * videoSize.width) / videoSize.height);
const deviceW = r3(phoneW + BEZEL * 2);
const deviceH = PHONE_H + BEZEL * 2;
const deviceLeft = r3((CANVAS_W - deviceW) / 2);
const deviceTop = r3((CANVAS_H - deviceH) / 2 - 8);
const stages = seg.filter((s) => s.kind === "stage");
const chapters = seg.filter((s) => s.kind === "chapter");
const dataSeg = seg.find((s) => s.kind === "data");
const asmSeg = seg.find((s) => s.kind === "assembly");
const wallSeg = seg.find((s) => s.kind === "wall");
// ---- markup ----
// Field panels: one per stage (+ data/wall carry their own bg in their
// section). Crossfaded to create the color journey behind the phone.
const fieldEls = [...stages, asmSeg]
.map((s) => ` <div class="field" id="field-${s.id}" style="background:${s.field};opacity:0;"></div>`)
.join("\n");
// Phone rig: one bezel, all stage clips stacked (each visible only in its
// own data-start window - the FULL real clip, continuously, never a held
// still), a contact shadow that transforms with the rig.
const screenVideoEls = clipWins
.map(
(w) =>
` <video class="screen-vid" id="vid-${w.key}" src="assets/${w.assetKey}.mp4" data-start="${w.start.toFixed(3)}" data-media-start="${w.mediaStart.toFixed(3)}" data-duration="${w.duration.toFixed(3)}" style="opacity:0;" muted playsinline></video>`,
)
.join("\n");
// Per-act side text: one large, bold, SHORT plain-language callout per
// app (app-store-feature-callout style), swapped in exact sync with that
// app's own real clip window - no ledger, no hash, no JSON, no monospace.
const stageTextEls = stages
.map((s) => {
const entries = s.entries
.map((e, i) => {
const typeTag = e.type ? `<div class="app-type">${esc(e.type)}</div>` : "";
return ` <div class="app-entry" id="entry-${s.id}-${i}" style="opacity:0;">
<div class="app-label">${esc(e.label)}</div>
<div class="app-headline">${esc(e.headline)}</div>
${typeTag}
</div>`;
})
.join("\n");
const card = TITLE_CARDS[s.card];
return ` <div class="stagetext ${s.textSide}" id="text-${s.id}" style="opacity:0;">
<div class="st-eyebrow">${esc(card.eyebrow)}</div>
<div class="app-stack">
${entries}
</div>
</div>`;
})
.join("\n");
// Chapter cards: full-screen solid bold color + kinetic capsule headline.
const chapterEls = chapters
.map((s) => {
const card = TITLE_CARDS[s.card];
const { lead, key } = splitKeyword(card.title, s.keyword);
const leadWords = lead
.split(" ")
.filter(Boolean)
.map((w) => `<span class="cw">${esc(w)}</span>`)
.join(" ");
return ` <div class="chapter${s.dark ? " dark" : ""}" id="${s.id}" style="background:${s.color};opacity:0;">
<div class="ch-eyebrow">${esc(card.eyebrow)}</div>
<div class="ch-head">
<span class="ch-lead">${leadWords}</span>
${key ? `<span class="ch-cap" style="background:${s.cap};color:${s.capFg};">${esc(key)}</span>` : ""}
</div>
<div class="ch-sub">${esc(card.tagline)}</div>
</div>`;
})
.join("\n");
// Data-open section: no phone. Count-up + real resource bars + hook line.
const f = HOLLOW_DEMO_FIXTURE;
const resMax = Math.max(...Object.values(f.resources));
const bars = Object.entries(f.resources)
.map(
([k, v]) =>
` <div class="bar"><div class="bar-top"><span class="bar-k">${esc(k[0].toUpperCase() + k.slice(1))}</span><span class="bar-v" data-to="${v}">0</span></div><div class="bar-track"><div class="bar-fill" style="transform:scaleX(0);width:${((v / resMax) * 100).toFixed(2)}%;"></div></div></div>`,
)
.join("\n");
const dataEl = ` <div class="section" id="data" style="background:${COLORS.data};opacity:0;">
<div class="data-kicker">The Hollow &middot; live seed data</div>
<div class="data-num"><span id="data-count" data-to="${f.population}">0</span></div>
<div class="data-sub">residents in one shelter &mdash; two billion live beneath a dead surface</div>
<div class="bars">
${bars}
</div>
<div class="data-hook">Their systems are failing. The Commons is how they <span class="hook-cap">fight back</span>.</div>
</div>`;
// Assembly clip: inset in a padded, bordered/shadowed frame on its own
// field (same visual family as the act stages), with a GSAP-driven caption
// naming the beat - never a bare full-bleed video.
const asmEl = ` <div class="assembly-frame" id="assembly-frame" style="opacity:0;">
<video class="assembly" id="vid-assembly" src="assets/assembly.mp4" data-start="${asmSeg.start.toFixed(3)}" data-media-start="0" data-duration="${assemblyDur.toFixed(3)}" muted playsinline></video>
</div>
<div class="stagetext top" id="text-assembly" style="opacity:0;">
<div class="st-eyebrow">Live Capture &middot; Two Devices</div>
<div class="st-title">Two devices. One signed log. A real network partition, and a real heal.</div>
</div>`;
// Result wall: real screenshots fan in, then a brand lockup.
const tileEls = WALL_TILES.map(
(t, i) =>
` <div class="tile" id="tile-${i}" style="opacity:0;"><img src="assets/wall/${t.file}" alt=""><span class="tile-label">${esc(t.label)}</span></div>`,
).join("\n");
const outro = TITLE_CARDS.outro;
const wallEl = ` <div class="section wall" id="wall" style="background:${COLORS.wall};opacity:0;">
<div class="wall-kicker" id="wall-kicker">One answer. More than one problem.</div>
<div class="wall-grid">
${tileEls}
</div>
<div class="lockup" id="lockup" style="opacity:0;">
<div class="lock-eyebrow">${esc(outro.eyebrow)}</div>
<div class="lock-title">${esc(outro.title)}</div>
<div class="lock-sub">${esc(outro.tagline)}</div>
</div>
</div>`;
const audioEl = ` <audio id="ambient" src="${AMBIENT_SRC}" data-start="0" data-media-start="0" data-duration="${total}" data-volume="${AMBIENT_VOLUME}"></audio>`;
// ---- serialized configs for the GSAP builder ----
const stageCfg = JSON.stringify(
stages.map((s) => ({
id: s.id, start: s.start, end: s.end, frame: s.frame, textSide: s.textSide,
entryAts: s.entries.map((e) => e.at),
})),
);
const chapterCfg = JSON.stringify(chapters.map((s) => ({ id: s.id, start: s.start, end: s.end })));
const clipCfg = JSON.stringify(clipWins.map((w) => ({ key: w.key, start: w.start, duration: w.duration })));
const promoHtml = `<template>
<style>
* { margin:0; padding:0; box-sizing:border-box; }
#root { position:absolute; inset:0; overflow:hidden; background:#05070d;
font-family:-apple-system,'Helvetica Neue','Segoe UI',Arial,sans-serif; color:#fff; }
/* ---- Field panels: the color journey behind the phone (crossfaded). ---- */
.field { position:absolute; inset:0; z-index:5; }
#fieldwrap { position:absolute; inset:0; z-index:5; }
/* ---- Phone stage ---- */
#stage { position:absolute; inset:0; z-index:10; perspective:1800px; }
#phoneRig { position:absolute; left:${deviceLeft}px; top:${deviceTop}px; width:${deviceW}px; height:${deviceH}px;
transform-origin:50% 50%; transform-style:preserve-3d; will-change:transform; }
#phoneShadow { position:absolute; left:50%; top:${deviceH - 20}px; width:${r3(deviceW * 1.15)}px; height:70px;
transform:translateX(-50%); background:radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.22) 46%, transparent 72%); filter:blur(8px); }
#device { position:absolute; inset:0; border-radius:40px;
background:linear-gradient(155deg,#2a3346 0%,#141b29 48%,#0a0f18 100%);
box-shadow:0 2px 2px rgba(255,255,255,0.10) inset, 0 -2px 6px rgba(0,0,0,0.5) inset,
0 50px 100px rgba(0,0,0,0.6), 0 14px 36px rgba(0,0,0,0.5), 0 0 0 1px rgba(130,160,210,0.14); }
.screen { position:absolute; inset:${BEZEL}px; border-radius:30px; overflow:hidden; background:#000; }
.screen-vid { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
/* ---- Per-act side text: large/short app-store-feature-callout, no
terminal/code motif anywhere. ---- */
.stagetext { position:absolute; top:0; bottom:0; z-index:12; display:flex; flex-direction:column; justify-content:center;
width:760px; padding:0 70px; will-change:opacity,transform; }
.stagetext.left { left:0; align-items:flex-start; text-align:left; }
.stagetext.right { right:0; align-items:flex-start; text-align:left; }
.stagetext.top { left:50%; top:54px; bottom:auto; transform:translateX(-50%); width:1100px; align-items:center; text-align:center; padding:0; }
.st-eyebrow { color:#8fb6ff; letter-spacing:0.42em; font-size:19px; font-weight:700; text-transform:uppercase; }
.st-title { color:#f5f8ff; font-size:46px; font-weight:800; letter-spacing:-0.02em; line-height:1.06; margin-top:14px; text-shadow:0 2px 24px rgba(5,15,40,0.6); }
.stagetext.top .st-title { font-size:38px; }
/* .app-stack is a fixed-height slot: every app's callout sits absolutely
at the same spot so only ONE mini-app's text is ever on screen at
once, in exact sync with that app's own real clip window. */
.app-stack { position:relative; min-height:230px; width:100%; margin-top:18px; }
.app-entry { position:absolute; left:0; right:0; top:0; }
.app-label { color:#8fb6ff; font-size:20px; font-weight:800; letter-spacing:0.14em; text-transform:uppercase; }
.app-headline { color:#f8faff; font-size:50px; font-weight:800; letter-spacing:-0.015em; line-height:1.14;
margin-top:12px; text-shadow:0 4px 28px rgba(5,15,40,0.55); }
.app-type { margin-top:20px; display:inline-block; color:#bcd6ff; font-size:15px; font-weight:700;
letter-spacing:0.04em; background:rgba(22,119,255,0.16); border:1px solid rgba(143,182,255,0.3);
border-radius:999px; padding:7px 16px; }
/* ---- Chapter cards: full-screen solid bold color + capsule headline. ---- */
.chapter { position:absolute; inset:0; z-index:30; display:flex; flex-direction:column; align-items:center; justify-content:center;
text-align:center; padding:0 80px; pointer-events:none; will-change:opacity; }
.chapter .ch-eyebrow { color:rgba(255,255,255,0.82); letter-spacing:0.5em; font-size:22px; font-weight:700; text-transform:uppercase; }
.chapter.dark .ch-eyebrow { color:rgba(20,20,24,0.72); }
.ch-head { margin-top:26px; max-width:1400px; display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:16px 20px; }
.ch-lead { display:inline-flex; flex-wrap:wrap; gap:0 22px; }
.ch-lead .cw { color:#fff; font-size:96px; font-weight:800; letter-spacing:-0.03em; line-height:1.0; }
.chapter.dark .ch-lead .cw { color:#17181c; }
.ch-cap { display:inline-block; font-size:96px; font-weight:800; letter-spacing:-0.03em; line-height:1.0;
padding:4px 36px 12px; border-radius:999px; box-shadow:0 22px 54px rgba(0,0,0,0.35); }
.ch-sub { margin-top:40px; max-width:1040px; color:rgba(255,255,255,0.92); font-size:27px; font-weight:500; line-height:1.45; }
.chapter.dark .ch-sub { color:rgba(20,20,24,0.8); }
/* ---- Full-screen sections (data open, wall). ---- */
.section { position:absolute; inset:0; z-index:34; display:flex; flex-direction:column; align-items:center; justify-content:center;
text-align:center; padding:0 80px; will-change:opacity; }
.data-kicker { color:rgba(255,255,255,0.86); letter-spacing:0.46em; font-size:22px; font-weight:700; text-transform:uppercase; }
.data-num { margin-top:6px; }
#data-count { font-size:260px; font-weight:800; letter-spacing:-0.04em; line-height:0.98; color:#fff; text-shadow:0 10px 60px rgba(0,30,90,0.45); }
.data-sub { margin-top:4px; color:rgba(255,255,255,0.92); font-size:30px; font-weight:500; }
.bars { margin-top:44px; width:640px; display:flex; flex-direction:column; gap:16px; }
.bar-top { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:7px; }
.bar-k { color:rgba(255,255,255,0.92); font-size:20px; font-weight:700; letter-spacing:0.04em; }
.bar-v { color:#fff; font-size:22px; font-weight:800; }
.bar-track { height:14px; border-radius:999px; background:rgba(255,255,255,0.18); overflow:hidden; }
.bar-fill { height:100%; border-radius:999px; background:#fff; transform-origin:left center; }
.data-hook { margin-top:46px; color:#fff; font-size:40px; font-weight:700; }
.hook-cap { display:inline-block; background:#05070d; color:#6fb0ff; padding:2px 22px 8px; border-radius:999px; }
/* ---- Result wall ---- */
.wall { justify-content:center; }
.wall-kicker { color:#fff; letter-spacing:0.08em; font-size:40px; font-weight:800; margin-bottom:26px; text-shadow:0 6px 30px rgba(0,20,70,0.4); }
.wall-grid { display:flex; flex-wrap:wrap; justify-content:center; align-items:flex-start; gap:18px; max-width:1180px; }
.tile { position:relative; width:206px; height:296px; border-radius:16px; overflow:hidden; background:#0b1322;
box-shadow:0 20px 44px rgba(0,0,0,0.4); border:1px solid rgba(255,255,255,0.14); will-change:opacity,transform; }
.tile img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:top center; display:block; }
.tile-label { position:absolute; left:0; right:0; bottom:0; padding:22px 10px 9px; font-size:15px; font-weight:800; color:#fff;
background:linear-gradient(to top, rgba(3,8,20,0.98) 0%, rgba(3,8,20,0.9) 42%, rgba(3,8,20,0) 100%); text-shadow:0 1px 4px rgba(0,0,0,0.8); text-align:center; }
.lockup { position:absolute; inset:0; z-index:2; display:flex; flex-direction:column; align-items:center; justify-content:center;
background:radial-gradient(900px 620px at 50% 46%, rgba(8,40,110,0.62) 0%, rgba(8,40,110,0) 70%); }
.lock-eyebrow { color:#bcd6ff; letter-spacing:0.5em; font-size:22px; font-weight:700; text-transform:uppercase; }
.lock-title { color:#fff; font-size:150px; font-weight:800; letter-spacing:-0.03em; line-height:1.0; margin-top:14px; text-shadow:0 12px 60px rgba(0,20,80,0.5); }
.lock-sub { color:rgba(255,255,255,0.94); font-size:28px; font-weight:500; margin-top:22px; max-width:1040px; line-height:1.45; }
.assembly-frame { position:absolute; z-index:20; left:370px; right:370px; top:250px; bottom:170px;
border-radius:28px; overflow:hidden; background:#000; border:1px solid rgba(196,168,255,0.26);
box-shadow:0 60px 120px rgba(0,0,0,0.55), 0 20px 48px rgba(0,0,0,0.45), 0 0 0 1px rgba(140,110,255,0.08) inset;
will-change:opacity; }
.assembly { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
</style>
<div id="root" data-composition-id="promo" data-width="${CANVAS_W}" data-height="${CANVAS_H}" data-duration="${total}">
<div id="fieldwrap">
${fieldEls}
</div>
<div id="stage">
<div id="phoneRig">
<div id="phoneShadow"></div>
<div id="device">
<div class="screen">
${screenVideoEls}
</div>
</div>
</div>
</div>
${stageTextEls}
${asmEl}
${dataEl}
${chapterEls}
${wallEl}
${audioEl}
</div>
<script>
const tl = gsap.timeline({ paused: true });
const F = 0.5; // crossfade length
// Count-up helper driven by the paused timeline (fires on seek-scrub).
function countUp(sel, to, at, dur) {
const node = document.querySelector(sel);
const proxy = { v: 0 };
tl.to(proxy, { v: to, duration: dur, ease: 'power2.out',
onUpdate: () => { node.textContent = Math.round(proxy.v).toLocaleString('en-US'); } }, at);
}
// ---------- DATA OPEN ----------
const D = { start: ${dataSeg.start}, end: ${dataSeg.end} };
// Data section is opaque from the very first frame (clean blue opener, no
// black/phone peek), then crossfades out into chapter 1.
tl.set('#data', { opacity: 1 }, 0);
tl.to('#data', { opacity: 0, duration: F, ease: 'power2.in' }, D.end - F);
// Slow continuous breath so no hold is a frame-identical run.
tl.fromTo('#data', { scale: 1 }, { scale: 1.02, duration: D.end, ease: 'sine.inOut' }, 0);
tl.fromTo('#data .data-kicker', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.5, ease: 'power2.out' }, D.start + 0.2);
tl.fromTo('#data-count', { opacity: 0, scale: 0.9 }, { opacity: 1, scale: 1, duration: 0.5, ease: 'back.out(1.6)' }, D.start + 0.45);
countUp('#data-count', ${f.population}, D.start + 0.5, 1.7);
tl.fromTo('#data .data-sub', { opacity: 0, y: 12 }, { opacity: 1, y: 0, duration: 0.5, ease: 'power2.out' }, D.start + 1.7);
tl.fromTo('#data .bar', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.45, stagger: 0.12, ease: 'power2.out' }, D.start + 2.3);
tl.fromTo('#data .bar-fill', { scaleX: 0 }, { scaleX: 1, duration: 0.8, stagger: 0.12, ease: 'power3.out' }, D.start + 2.4);
document.querySelectorAll('#data .bar-v').forEach((el) => {
countUp('#data .bar-v[data-to="' + el.getAttribute('data-to') + '"]', Number(el.getAttribute('data-to')), D.start + 2.4, 0.9);
});
tl.fromTo('#data .data-hook', { opacity: 0, y: 16 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, D.start + 4.3);
tl.fromTo('#data .hook-cap', { scale: 0.5, opacity: 0 }, { scale: 1, opacity: 1, duration: 0.5, ease: 'back.out(2)' }, D.start + 4.8);
// ---------- FIELD PANELS (color journey) ----------
const STAGES = ${stageCfg};
for (const s of STAGES) {
tl.fromTo('#field-' + s.id, { opacity: 0 }, { opacity: 1, duration: F, ease: 'power1.out' }, s.start - F);
tl.to('#field-' + s.id, { opacity: 0, duration: F, ease: 'power1.in' }, s.end - F);
}
// ---------- PHONE STAGE (per-act framing) ----------
const CLIPS = ${clipCfg};
// Explicit opacity control for every screen-vid layer: belt-and-
// suspenders over hyperframes' own automatic data-start/data-duration
// windowing, which was observed to let a stale/adjacent element's frame
// bleed through once this composition grew past a dozen stacked video
// elements sharing a handful of source files. Each clip is visible ONLY
// for its own authored window and plays its FULL real length,
// continuously - no hold/freeze of any kind.
for (const c of CLIPS) {
tl.set('#vid-' + c.key, { opacity: 1 }, c.start);
tl.set('#vid-' + c.key, { opacity: 0 }, c.start + c.duration);
}
// The phone stage stays mounted the whole time; opaque overlays (chapters
// z30, sections z34, assembly z20) cover it except during the acts, so no
// per-act show/hide juggling is needed - just reposition the rig while the
// covering chapter card is still opaque.
for (const s of STAGES) {
const tilt = s.frame.tilt || 0;
tl.set('#phoneRig', { x: s.frame.x, y: s.frame.y, scale: s.frame.scale, rotationY: tilt }, Math.max(0, s.start - 0.25));
// Gentle camera push + tilt settle across the act so no footage frame is static.
tl.fromTo('#phoneRig', { scale: s.frame.scale, rotationY: tilt }, { scale: s.frame.scale * 1.03, rotationY: tilt * 0.35, duration: s.end - s.start, ease: 'none' }, s.start);
// Side text.
const dx = s.textSide === 'right' ? 40 : (s.textSide === 'left' ? -40 : 0);
const dy = s.textSide === 'top' ? -18 : 0;
tl.fromTo('#text-' + s.id, { opacity: 0, x: dx, y: dy }, { opacity: 1, x: 0, y: 0, duration: 0.6, ease: 'power2.out' }, s.start + 0.1);
tl.to('#text-' + s.id, { opacity: 0, duration: 0.45, ease: 'power2.in' }, s.end - F);
// Each app's callout owns its own on-screen window, synced exactly to
// when that app's real clip plays: a left-to-right scan-wipe reveal
// in, then a plain fade-out right before the NEXT app's reveal begins
// - so at most one app's text is ever on screen, never a stack.
for (let i = 0; i < s.entryAts.length; i++) {
const entrySel = '#entry-' + s.id + '-' + i;
const entryStart = s.start + s.entryAts[i];
tl.fromTo(entrySel, { clipPath: 'inset(0 100% 0 0)', opacity: 0.001 },
{ clipPath: 'inset(0 0% 0 0)', opacity: 1, duration: 0.4, ease: 'power2.out' }, entryStart);
if (i < s.entryAts.length - 1) {
const nextStart = s.start + s.entryAts[i + 1];
tl.to(entrySel, { opacity: 0, duration: 0.3, ease: 'power2.in' }, nextStart - 0.3);
}
}
}
// ---------- CHAPTER CARDS ----------
const CHAPTERS = ${chapterCfg};
for (const c of CHAPTERS) {
tl.fromTo('#' + c.id, { opacity: 0 }, { opacity: 1, duration: F, ease: 'power2.out' }, c.start);
tl.to('#' + c.id, { opacity: 0, duration: F, ease: 'power2.in' }, c.end - F);
tl.fromTo('#' + c.id + ' .ch-eyebrow', { opacity: 0, y: 16 }, { opacity: 1, y: 0, duration: 0.5, ease: 'power2.out' }, c.start + 0.15);
tl.fromTo('#' + c.id + ' .ch-lead .cw', { opacity: 0, y: 30 }, { opacity: 1, y: 0, duration: 0.5, stagger: 0.09, ease: 'power3.out' }, c.start + 0.3);
tl.fromTo('#' + c.id + ' .ch-cap', { opacity: 0, scale: 0.4 }, { opacity: 1, scale: 1, duration: 0.55, ease: 'back.out(2.2)' }, c.start + 0.62);
tl.fromTo('#' + c.id + ' .ch-sub', { opacity: 0, y: 16 }, { opacity: 1, y: 0, duration: 0.55, ease: 'power2.out' }, c.start + 0.9);
tl.fromTo('#' + c.id, { scale: 1 }, { scale: 1.02, duration: c.end - c.start, ease: 'sine.inOut' }, c.start);
}
// ---------- ASSEMBLY (framed field + caption) ----------
const A = { start: ${asmSeg.start}, end: ${asmSeg.end} };
// The phone rig is not full-bleed-covered by the assembly frame (unlike
// the chapter/section overlays), so hide it explicitly - otherwise the
// Epilogue's last phone position peeks through the field margins.
tl.to('#phoneRig', { opacity: 0, duration: F, ease: 'power1.in' }, A.start - F);
tl.fromTo('#field-assembly', { opacity: 0 }, { opacity: 1, duration: F, ease: 'power1.out' }, A.start - F);
tl.to('#field-assembly', { opacity: 0, duration: F, ease: 'power1.in' }, A.end - F);
tl.fromTo('#assembly-frame', { opacity: 0 }, { opacity: 1, duration: F, ease: 'power1.out' }, A.start - F);
tl.to('#assembly-frame', { opacity: 0, duration: F, ease: 'power1.in' }, A.end - F);
tl.fromTo('#text-assembly', { opacity: 0, y: -18 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, A.start + 0.3);
tl.to('#text-assembly', { opacity: 0, duration: 0.45, ease: 'power2.in' }, A.end - F);
// ---------- RESULT WALL + LOCKUP ----------
const W = { start: ${wallSeg.start}, end: ${wallSeg.end} };
tl.fromTo('#wall', { opacity: 0 }, { opacity: 1, duration: F, ease: 'power2.out' }, W.start - F);
tl.to('#wall', { opacity: 0, duration: F, ease: 'power2.in' }, W.end - F + 0.2);
// Slow continuous push on the whole wall/lockup so the closing hold is
// never a frame-identical run.
tl.fromTo('#wall', { scale: 1 }, { scale: 1.03, duration: W.end - (W.start - F), ease: 'sine.inOut' }, W.start - F);
tl.fromTo('#wall-kicker', { opacity: 0, y: -16 }, { opacity: 1, y: 0, duration: 0.5, ease: 'power2.out' }, W.start);
tl.fromTo('#wall .tile', { opacity: 0, y: 40, scale: 0.8 }, { opacity: 1, y: 0, scale: 1, duration: 0.5, stagger: 0.06, ease: 'back.out(1.5)' }, W.start + 0.3);
// Tiles settle back and dim as the brand lockup takes over.
tl.to('#wall .wall-grid', { opacity: 0.22, scale: 0.96, duration: 0.6, ease: 'power2.inOut' }, W.start + 3.3);
tl.to('#wall-kicker', { opacity: 0, duration: 0.4, ease: 'power2.in' }, W.start + 3.3);
tl.fromTo('#lockup', { opacity: 0 }, { opacity: 1, duration: 0.5, ease: 'power2.out' }, W.start + 3.5);
tl.fromTo('#lockup .lock-eyebrow', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.5, ease: 'power2.out' }, W.start + 3.6);
tl.fromTo('#lockup .lock-title', { opacity: 0, scale: 0.86 }, { opacity: 1, scale: 1, duration: 0.6, ease: 'back.out(1.6)' }, W.start + 3.8);
tl.fromTo('#lockup .lock-sub', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.55, ease: 'power2.out' }, W.start + 4.3);
window.__timelines = window.__timelines || {};
window.__timelines.promo = tl;
</script>
</template>
`;
const indexHtml = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The Commons &middot; OpenMotion promo (redesign 5)</title>
<script src="assets/gsap.min.js"></script>
<style>body{margin:0;background:#000}#main{position:relative;width:${CANVAS_W}px;height:${CANVAS_H}px;overflow:hidden}</style>
</head>
<body>
<div id="main" data-composition-id="main" data-start="0" data-duration="${total}" data-width="${CANVAS_W}" data-height="${CANVAS_H}" data-fps="${FPS}">
<div id="promo" class="clip"
data-composition-id="promo"
data-composition-src="compositions/promo.html"
data-start="0" data-duration="${total}" data-track-index="0"
data-width="${CANVAS_W}" data-height="${CANVAS_H}"></div>
</div>
<script>
window.__timelines = window.__timelines || {};
window.__timelines.main = gsap.timeline({ paused: true });
</script>
</body>
</html>
`;
mkdirSync(COMPOSITIONS_DIR, { recursive: true });
mkdirSync(ASSETS_DIR, { recursive: true });
writeFileSync(resolve(COMPOSITIONS_DIR, "promo.html"), promoHtml);
writeFileSync(resolve(OM_DIR, "index.html"), indexHtml);
const gsapSrc = resolve(OM_DIR, "..", "openmotion-poc", "assets", "gsap.min.js");
const gsapDst = resolve(ASSETS_DIR, "gsap.min.js");
if (!existsSync(gsapDst)) copyFileSync(gsapSrc, gsapDst);
console.log("Composition built (redesign 5).");
console.log(` total duration : ${total}s (${Math.round(total * FPS)} frames @ ${FPS}fps)`);
console.log(` phone box : ${phoneW}x${PHONE_H} (video ${videoSize.width}x${videoSize.height}, aspect-exact)`);
console.log(" segments :", seg.map((s) => `${s.id}[${s.start.toFixed(1)}-${s.end.toFixed(1)}]`).join(" "));
console.log(` wall tiles : ${WALL_TILES.length}`);
console.log(` ambient : ${AMBIENT_SRC} @ ${AMBIENT_VOLUME} over ${total}s`);
}
main();