The recorder takes one poster per clip
Once written, the poster's countdown fell back to idle while the same move still showed, re-armed, and overwrote the poster with the next move — for two scenes, the change-of-eyes wipe. A done flag holds it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
53fba77a55
commit
2d98393010
@@ -22,7 +22,7 @@ if (!outDir) { console.error("usage: film-clips.mjs <out-dir> [scene ...]"); pro
|
|||||||
const PORT = 8809;
|
const PORT = 8809;
|
||||||
const FPS = 25;
|
const FPS = 25;
|
||||||
const TAIL_MS = 2500; // hold on the last move
|
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 EPOCH = new Date("2026-01-01T00:00:00Z").getTime();
|
||||||
|
|
||||||
const server = startServer(PORT, "wizwar-film");
|
const server = startServer(PORT, "wizwar-film");
|
||||||
@@ -58,13 +58,13 @@ try {
|
|||||||
// run longer than the beat), then hold the tail.
|
// run longer than the beat), then hold the tail.
|
||||||
const posterBeat = sp.beats?.[0] ?? 1;
|
const posterBeat = sp.beats?.[0] ?? 1;
|
||||||
const MAX_FRAMES = FPS * 240; // four minutes: a reel that never reaches its last move
|
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) {
|
while (tail !== 0 && f < MAX_FRAMES) {
|
||||||
const png = await page.screenshot({ clip });
|
const png = await page.screenshot({ clip });
|
||||||
writeFileSync(join(frames, `${String(f).padStart(5, "0")}.png`), png);
|
writeFileSync(join(frames, `${String(f).padStart(5, "0")}.png`), png);
|
||||||
const at = Number((await page.locator(".replay-count").textContent()).match(/move (\d+)/)[1]);
|
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 (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);
|
if (posterIn === 0) { writeFileSync(join(frames, "poster.png"), png); posterDone = true; }
|
||||||
if (posterIn >= 0) posterIn--;
|
if (posterIn >= 0) posterIn--;
|
||||||
if (tail < 0 && at === count) tail = Math.round(TAIL_MS / (1000 / FPS));
|
if (tail < 0 && at === count) tail = Math.round(TAIL_MS / (1000 / FPS));
|
||||||
if (tail > 0) tail--;
|
if (tail > 0) tail--;
|
||||||
|
|||||||
Reference in New Issue
Block a user