diff --git a/deploy/film-clips.mjs b/deploy/film-clips.mjs index 4046d88..b82421c 100644 --- a/deploy/film-clips.mjs +++ b/deploy/film-clips.mjs @@ -22,7 +22,7 @@ if (!outDir) { console.error("usage: film-clips.mjs [scene ...]"); pro const PORT = 8809; const FPS = 25; const TAIL_MS = 2500; // hold on the last move -const POSTER_SETTLE_MS = 2000; // the poster beat's tween, fx, and any change-of-eyes wipe, done +const POSTER_SETTLE_MS = 1100; // the poster beat's tween and fx done, still inside its 1.5s beat const EPOCH = new Date("2026-01-01T00:00:00Z").getTime(); const server = startServer(PORT, "wizwar-film"); @@ -58,13 +58,13 @@ try { // run longer than the beat), then hold the tail. const posterBeat = sp.beats?.[0] ?? 1; const MAX_FRAMES = FPS * 240; // four minutes: a reel that never reaches its last move - let f = 0, tail = -1, posterIn = -1; + let f = 0, tail = -1, posterIn = -1, posterDone = false; while (tail !== 0 && f < MAX_FRAMES) { const png = await page.screenshot({ clip }); writeFileSync(join(frames, `${String(f).padStart(5, "0")}.png`), png); const at = Number((await page.locator(".replay-count").textContent()).match(/move (\d+)/)[1]); - if (view === "fpv" && posterIn < 0 && at === posterBeat + 1) posterIn = Math.round(POSTER_SETTLE_MS / (1000 / FPS)); - if (posterIn === 0) writeFileSync(join(frames, "poster.png"), png); + if (view === "fpv" && !posterDone && posterIn < 0 && at === posterBeat + 1) posterIn = Math.round(POSTER_SETTLE_MS / (1000 / FPS)); + if (posterIn === 0) { writeFileSync(join(frames, "poster.png"), png); posterDone = true; } if (posterIn >= 0) posterIn--; if (tail < 0 && at === count) tail = Math.round(TAIL_MS / (1000 / FPS)); if (tail > 0) tail--;