Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 35dd94cce0854e4c93ca7d61b893905e3d0b097e
parent fc5f479e6e275718b5654b581fbbe485634171b5
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 13:12:21 -0500

report-to-video: what a cut is at its first instant is in each page's init -- the instruments no longer show on frame 0 over the intro

A cue page sets its init, then seeks a paused timeline of fromTo tweens; the
renderer's first frame is a seek to 0, which draws init (a tween placed at 0
shows its FROM there). The instruments' column (dial, odometer, trail) put
their root up in init and hid it over the intro with an instant cue at 0
(chrome-instruments.mjs withDeck), so frame 0 of rev9-a6/a7 showed the gauge,
the counter and the chart strip before the wordmark; frame 1 was clean.

settleFirstFrame (cue-start.mjs) folds every cue that starts at the cut's
first instant and is over before frame 1 into init, in every cue compiler
(cueList, compileCues, the deck's, posts', stamps', stats', teaser's, fx's,
threads' and finale's). The same fault drew a stat card shown from 0 one frame
late. A stacked deck standing down from 0 does so at once, not as a fade over
the opening.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/report-to-video/chrome-cues.mjs | 3++-
Mumtool/report-to-video/chrome-deck.mjs | 3++-
Mumtool/report-to-video/chrome-finale.mjs | 3++-
Mumtool/report-to-video/chrome-instruments.mjs | 3++-
Mumtool/report-to-video/chrome-posts.mjs | 3++-
Mumtool/report-to-video/chrome-stamp.mjs | 3++-
Mumtool/report-to-video/chrome-stats.mjs | 3++-
Mumtool/report-to-video/chrome-teaser.mjs | 3++-
Aumtool/report-to-video/cue-start.mjs | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/report-to-video/frame-zero.test.mjs | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/fx.mjs | 3++-
Mumtool/report-to-video/measure-draw.mjs | 3++-
Mumtool/report-to-video/threads.mjs | 3++-
13 files changed, 175 insertions(+), 11 deletions(-)

diff --git a/umtool/report-to-video/chrome-cues.mjs b/umtool/report-to-video/chrome-cues.mjs @@ -14,6 +14,7 @@ // // PURE: data in, an HTML string out. import { pageDuration } from "./deck.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; /** Instant cues still take a millisecond: a zero-duration tween has its own seek rules. */ export const INSTANT = 0.001; @@ -55,7 +56,7 @@ export function compileCues(init, events) { freeAt.set(e.k, r4(at + dur)); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease }); } - return { init, cues }; + return { init, cues: settleFirstFrame(init, cues) }; } /** diff --git a/umtool/report-to-video/chrome-deck.mjs b/umtool/report-to-video/chrome-deck.mjs @@ -46,6 +46,7 @@ import { claimsCues, claimsMarkup } from "./chrome-claims.mjs"; import { fitTallyLabel, resolveFactcheck, TALLY_WRITTEN, tallyCues, tallyFinals, tallyKey, tallyOf, tallyPopIns } from "./factcheck.mjs"; import { resolveCounter } from "./counter.mjs"; import { SUBSECTION_SEPARATOR } from "./marker-limits.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; /** * GSAP, vendored, for every chrome region. @@ -450,7 +451,7 @@ export function deckCues(schedule, render) { cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease, why: e.why }); } return { - init, cues, pips, slideY, choreography: ch, ...(markers.length ? { markers } : {}), ...(claims ? { claims } : {}), + init, cues: settleFirstFrame(init, cues, fps), pips, slideY, choreography: ch, ...(markers.length ? { markers } : {}), ...(claims ? { claims } : {}), ...(sections ? { sections: { ...sections, fuses: fuseParts ?? [], rings } } : {}), ...(sectionTitle ? { sectionTitle } : {}), }; diff --git a/umtool/report-to-video/chrome-finale.mjs b/umtool/report-to-video/chrome-finale.mjs @@ -26,6 +26,7 @@ import { cueTime, cueTimeAfter, finaleRail, pageDuration, resolveDeck } from "./ import { finaleClaimsMarkup } from "./chrome-claims.mjs"; import { mix, rgba, shapeCss, subtitleMarkup, subtitlePartsCss, subtitleTokens } from "./chrome-deck.mjs"; import { resolveFactcheck, tallyCells, tallyFinals, tallyOf } from "./factcheck.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; import { resolveCounter } from "./counter.mjs"; import { aboveTop, FINALE_CLAIMS, FINALE_MOTION, finaleGeometry, resolveFinale } from "./finale.mjs"; @@ -299,7 +300,7 @@ export function finaleCues(schedule, render, L = finaleLayout(schedule, render)) freeAt.set(e.k, at + dur); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease, why: e.why }); } - return { init, cues }; + return { init, cues: settleFirstFrame(init, cues, fps) }; } /** diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs @@ -99,7 +99,8 @@ function withDeck(L, schedule, render, k) { const D = Number(schedule.transition) || 0; const m = Math.max(D, 0.3); for (const sd of mergedSpans(stackedStandDowns(schedule))) { - shown.push({ at: Math.max(0, sd.from), dur: m, hide: true }); + // Standing down from the cut's first instant is init, not a fade over the opening (cue-start.mjs). + shown.push({ at: Math.max(0, sd.from), dur: sd.from <= 0 ? INSTANT : m, hide: true }); if (sd.to < (schedule.total ?? Infinity) - 0.05) shown.push({ at: sd.to, dur: m, hide: false }); } // Each change once, in time: a stand-down inside a span the deck is already away for adds nothing. diff --git a/umtool/report-to-video/chrome-posts.mjs b/umtool/report-to-video/chrome-posts.mjs @@ -34,6 +34,7 @@ import { formatDeckDate } from "./attribution.mjs"; import { pageDuration, postsGeometry, resolveDeck, snapWindow } from "./deck.mjs"; import { mix, rgba } from "./chrome-deck.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; // The window arithmetic is deck.mjs's (pure, and loaded by the build without // this page module); re-exported for the page's own callers. @@ -195,7 +196,7 @@ export function postsCues({ // keeps every element's own order (and so every from). cues.sort((x, y) => x.at - y.at || x.n - y.n); for (const c of cues) delete c.n; - return { tops, init, cues }; + return { tops, init, cues: settleFirstFrame(init, cues) }; } /** A card's head: `@handle · Bluesky`, the separator in the deck's accent. */ diff --git a/umtool/report-to-video/chrome-stamp.mjs b/umtool/report-to-video/chrome-stamp.mjs @@ -14,6 +14,7 @@ import { cueTime, cueTimeAfter, pageDuration, stampGeometry, stampsOnFrames } from "./deck.mjs"; import { mix, rgba } from "./chrome-deck.mjs"; import { drawnStamps, resolveFactcheck, STAMP_MOTION } from "./factcheck.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; /** Instant cues still take a millisecond: a zero-duration tween has its own seek rules. */ const INSTANT = 0.001; @@ -102,7 +103,7 @@ export function stampCues(schedule, render = null) { freeAt.set(e.k, at + dur); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease, why: e.why }); } - return { init, cues }; + return { init, cues: settleFirstFrame(init, cues, fps) }; } /** diff --git a/umtool/report-to-video/chrome-stats.mjs b/umtool/report-to-video/chrome-stats.mjs @@ -18,6 +18,7 @@ import { pageDuration, statsGeometry } from "./deck.mjs"; import { rgba } from "./chrome-deck.mjs"; import { STATS_LABELS, STATS_MOTION } from "./stats.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; /** Instant cues still take a millisecond: a zero-duration tween has its own seek rules. */ const INSTANT = 0.001; @@ -112,7 +113,7 @@ export function statsCues(schedule) { freeAt.set(e.k, r4(at + dur)); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease }); } - return { init, cues }; + return { init, cues: settleFirstFrame(init, cues, schedule.fps) }; } /** diff --git a/umtool/report-to-video/chrome-teaser.mjs b/umtool/report-to-video/chrome-teaser.mjs @@ -31,6 +31,7 @@ import { export { TEASER_MOTION }; import { mix, rgba } from "./chrome-deck.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; /** * The display face: Archivo, a variable font (wght 100–900, wdth 62–125), @@ -222,7 +223,7 @@ export function teaserCues({ lines, tail = "", seconds, motion = TEASER_MOTION, } // `need` is the validator's; the page's data is what it always was. const { T: _T, need: _need, ...times } = beats; - return { init, cues, beats: times, scale: beats.scale }; + return { init, cues: settleFirstFrame(init, cues), beats: times, scale: beats.scale }; } /** Each role's type: size (px, the most it may be), weight, width (%), tracking (em), and the fit floor. */ diff --git a/umtool/report-to-video/cue-start.mjs b/umtool/report-to-video/cue-start.mjs @@ -0,0 +1,65 @@ +// THE CUT'S FIRST FRAME (the frame-zero fix, 11 Nov): a cue that takes effect +// at the cut's first instant belongs in a page's init, not in its cue list. +// +// Every cue page sets its init, then builds a paused timeline of fromTo tweens +// (`immediateRender: false`) and is seeked frame by frame. The renderer's first +// frame is a seek to 0 -- no change to GSAP, and a tween placed at 0 shows its +// FROM there anyway -- so a cue at 0 shorter than a frame is drawn on frame 1, +// never on frame 0. That is how the instruments' column (dial, odometer, trail: +// chrome-instruments.mjs withDeck) showed for one frame over a cut that opens on +// the intro: their root is up in init and hidden by an instant cue at 0. +// +// LEAF: no imports, so every cue compiler can call it. + +/** At or before this, a time is the cut's first instant. */ +const START_EPS = 1e-4; + +/** + * Fold every cue that has finished before frame 1 and starts at the cut's + * first instant (at or before 0, or where an earlier folded cue on the same + * element ended) into init. A cue a frame or longer, or one after a cue on + * its element that stays, is left alone: frame 0 then shows its FROM, which is + * init, as it should. + * + * `init` is changed IN PLACE (an entry replaced, never mutated -- entries may + * be shared) because several callers read their own init after compiling; the + * cue list is returned without the folded cues. + * + * @template {{ k: string, at: number, dur: number, to: object }} C + * @param {Record<string, object>} init + * @param {C[]} cues in time order per element (every compiler's output) + * @param {number} [fps] + * @returns {C[]} + */ +export function settleFirstFrame(init, cues, fps = 30) { + const frame = 1 / (Number(fps) > 0 ? Number(fps) : 30); + /** element -> where its folded cues end; absent once a cue on it stays. */ + const foldEnd = new Map(); + const kept = new Set(); + const out = []; + for (const c of cues) { + const start = foldEnd.has(c.k) ? foldEnd.get(c.k) : 0; + const foldable = !kept.has(c.k) && Number(c.at) <= start + START_EPS && Number(c.at) + Number(c.dur) < frame - START_EPS; + if (!foldable) { + kept.add(c.k); + out.push(c); + continue; + } + init[c.k] = { ...(init[c.k] ?? {}), ...c.to }; + foldEnd.set(c.k, Number(c.at) + Number(c.dur)); + } + return out; +} + +/** + * The cues a renderer's frame 0 cannot show: a change at the cut's first + * instant, over before frame 1. Empty for a page settleFirstFrame has seen. + * + * @param {{ init?: object, cues?: Array<{ k: string, at: number, dur: number, from?: object, to: object }> }} data + */ +export function unseenFirstFrameCues(data, fps = 30) { + const init = structuredClone(data.init ?? {}); + const cues = (data.cues ?? []).filter((c) => JSON.stringify(c.from ?? null) !== JSON.stringify(c.to)); + const settled = settleFirstFrame(init, cues, fps); + return cues.filter((c) => !settled.includes(c)); +} diff --git a/umtool/report-to-video/frame-zero.test.mjs b/umtool/report-to-video/frame-zero.test.mjs @@ -0,0 +1,88 @@ +// THE CUT'S FIRST FRAME (cue-start.mjs): a page a renderer seeks to 0 draws its +// init there, so whatever the cut is at its first instant must be IN init. The +// instruments' column (dial, odometer, trail) was up in init and hidden by an +// instant cue at 0: over a cut that opens on the intro, frame 0 showed the +// gauge, the counter and the chart strip before the wordmark (rev9-a6/a7, 11 Nov). +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import path from "node:path"; +import test from "node:test"; +import { fileURLToPath } from "node:url"; + +import { estimateSchedule } from "./deck.mjs"; +import { dialHtml, odometerHtml, trailHtml } from "./chrome-instruments.mjs"; +import { settleFirstFrame, unseenFirstFrameCues } from "./cue-start.mjs"; +import { cueList } from "./measure-draw.mjs"; +import { compileCues } from "./chrome-cues.mjs"; +import { statsCues } from "./chrome-stats.mjs"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const MEASURE = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-dial", "measure.json"), "utf8")); +const FPS = 30; +const RENDER = { + width: 1920, height: 1080, fps: FPS, transition: 0.4, + palette: { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" }, + chrome: { engine: "hyperframes", layout: "deck", deck: { dial: true, odometer: true, trail: true, qr: { show: false }, finale: { video: "side", totals: false } } }, +}; +const fonts = { DeckSans: "assets/DeckSans.ttf", DeckSansBold: "assets/DeckSansBold.ttf" }; + +/** The instruments' fixture cut, opening on the intro (selectVariant's entry: the deck hides over it). */ +function introCut() { + const timeline = Array.from({ length: 9 }, (_, i) => ({ + type: "clip", id: `c${i + 1}`, video: "vidx", start: 10 * i, end: 10 * i + (i === 8 ? 14 : 8), cite: 1, section: 0, + quote: "q", onscreen: { title: `Clip ${i + 1}` }, ...(i === 8 ? { layout: "finale" } : {}), + })); + timeline.unshift({ type: "intro", id: "brand-intro", style: "boot-dark", seconds: 4.75, heading: "Intro" }); + const manifest = { slug: "m", title: "M", provenance: {}, render: RENDER, timeline }; + const schedule = { ...estimateSchedule(manifest), measure: MEASURE }; + assert.equal(schedule.segments[0].hideDeck, true, "the intro hides the deck"); + return schedule; +} + +const dataOf = (html, id) => JSON.parse(new RegExp(`<script id="${id}-data" type="application/json">(.*?)</script>`, "s").exec(html)[1]); + +test("over an intro the instruments are hidden from frame 0: their root is down in init, with no instant cue at 0", () => { + const schedule = introCut(); + for (const [id, html] of [["dial", dialHtml(schedule, RENDER, { fonts })], ["odometer", odometerHtml(schedule, RENDER, { fonts })], ["trail", trailHtml(schedule, RENDER, { fonts })]]) { + const data = dataOf(html, id); + assert.deepEqual(data.init.rt, { autoAlpha: 0 }, `${id}: hidden at the cut's first instant`); + assert.deepEqual(unseenFirstFrameCues(data, FPS), [], `${id}: no change at 0 that frame 0 cannot show`); + // And up again with the deck, after the intro: the first cue on the root shows it. + const first = data.cues.find((c) => c.k === "rt"); + assert.ok(first.at > 4, `${id}: the column comes up after the intro (${first.at})`); + assert.deepEqual(first.to, { autoAlpha: 1 }); + } +}); + +test("settleFirstFrame folds what happens at the first instant into init, and leaves every real move alone", () => { + const init = { a: { autoAlpha: 1 }, b: { opacity: 0 }, c: { x: 0 } }; + const shared = init.a; + const cues = [ + { k: "a", at: 0, dur: 0.001, from: { autoAlpha: 1 }, to: { autoAlpha: 0 } }, + { k: "a", at: 0.001, dur: 0.001, from: { autoAlpha: 0 }, to: { autoAlpha: 0.5 } }, // chained after the first, still before frame 1 + { k: "b", at: 0, dur: 0.4, from: { opacity: 0 }, to: { opacity: 1 } }, // a fade from 0: frame 0 is its from + { k: "b", at: 0.4, dur: 0.001, from: { opacity: 1 }, to: { opacity: 0 } }, + { k: "c", at: 0.5, dur: 0.001, from: { x: 0 }, to: { x: 5 } }, + ]; + const out = settleFirstFrame(init, cues, 30); + assert.deepEqual(init.a, { autoAlpha: 0.5 }); + assert.deepEqual(shared, { autoAlpha: 1 }, "an init entry is replaced, never mutated (entries may be shared)"); + assert.deepEqual(out.map((c) => `${c.k}@${c.at}`), ["b@0", "b@0.4", "c@0.5"]); +}); + +test("every cue compiler settles the first frame: cueList, compileCues, the stats panel", () => { + const L = cueList(FPS); + L.set("rt", { autoAlpha: 1 }); + L.add("rt", 0, 0, { autoAlpha: 0 }); + L.add("rt", 5, 0.45, { autoAlpha: 1 }); + const built = L.build(); + assert.deepEqual(built.init.rt, { autoAlpha: 0 }); + assert.deepEqual(built.cues.map((c) => c.at), [5]); + const cc = compileCues({ x: { autoAlpha: 0 } }, [{ k: "x", at: 0, dur: 0, to: { autoAlpha: 1 }, ease: "none" }]); + assert.deepEqual(cc.init.x, { autoAlpha: 1 }); + assert.equal(cc.cues.length, 0); + // A stat card shown from the cut's first instant (v7gkv5w-poker-2's s0_0): up on frame 0, not frame 1. + const st = statsCues({ fps: FPS, stats: { clips: [{ in: 0, out: 6, states: [{ at: 0 }, { at: 3 }] }] } }); + assert.deepEqual(unseenFirstFrameCues(st, FPS), []); + assert.equal(st.init.s0_0.autoAlpha, 1); +}); diff --git a/umtool/report-to-video/fx.mjs b/umtool/report-to-video/fx.mjs @@ -38,6 +38,7 @@ import { COMPOSITION_PARAMS } from "yt-dlp-transcript-common/lib/report/fxParams.mjs"; import { offsetIn, sourceAtOffset } from "./gaps.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; /** Each effect's key under `render.chrome.fx`, in the order the page stacks them (later on top). */ export const FX_KEYS = Object.freeze(["scrubber", "receipts", "zoom", "kineticQuote", "redact", "odometer", "punchIn", "thenNow", "whip", "glitch"]); @@ -1053,7 +1054,7 @@ export function compileCues(init, events) { freeAt.set(e.k, r4(at + dur)); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease }); } - return cues; + return settleFirstFrame(init, cues); } /** An object's numbers with -0 as 0: the cue list is data, and JSON has no -0. */ diff --git a/umtool/report-to-video/measure-draw.mjs b/umtool/report-to-video/measure-draw.mjs @@ -16,6 +16,7 @@ // // Pure: strings in, strings out. No fs. import { cueTime, pageDuration } from "./deck.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; /** Instant cues still take a millisecond: a zero-duration tween has its own seek rules. */ export const INSTANT = 0.001; @@ -71,7 +72,7 @@ export function cueList(fps) { freeAt.set(e.k, r4(at + dur)); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease }); } - return { init, cues }; + return { init, cues: settleFirstFrame(init, cues, fps) }; }, }; } diff --git a/umtool/report-to-video/threads.mjs b/umtool/report-to-video/threads.mjs @@ -23,6 +23,7 @@ import { resolveFactcheck } from "./factcheck.mjs"; // The limits and the validators are common's (lib/report/panels.mjs, release // 28): the threads draft task checks exactly what the build refuses. import { THREADS_LIMITS, threadOf, threadsOn, validateThreadEntries, validateThreads } from "yt-dlp-transcript-common/lib/report/panels.mjs"; +import { settleFirstFrame } from "./cue-start.mjs"; export { THREADS_LIMITS, threadOf, threadsOn, validateThreadEntries, validateThreads }; @@ -172,7 +173,7 @@ export function planCues(init, events, instant = 0.001) { freeAt.set(e.k, r4(at + dur)); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease, why: e.why }); } - return cues; + return settleFirstFrame(init, cues); } /** A card's resting opacity before its thread plays, and after. */