Archilyzer · Source

archilyzer

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

commit b489099518ba81543b748836d505684545a116d3
parent e19d52d2df9a19661605fcf04dceb8140f2f83c8
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 30 Oct 2026 02:55:04 -0400

Merge lane/glitch-clips: the fx glitch tears only at the cut into each named clip (on: "clips"), and year: false draws a bare tear with no text

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mcommon/lib/report/fxParams.mjs | 6+++++-
Mcommon/lib/report/videoAssistOps.test.ts | 2+-
Mumtool/docs/knobs.md | 1+
Mumtool/report-to-video/README.md | 4++--
Mumtool/report-to-video/chrome-fx.mjs | 3++-
Mumtool/report-to-video/chrome-fx.test.mjs | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/fx-params.test.mjs | 5+++++
Mumtool/report-to-video/fx.mjs | 39+++++++++++++++++++++++++++++++++------
Mumtool/report-to-video/fx.test.mjs | 78+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mumtool/report-to-video/modules/fx.mjs | 1+
10 files changed, 190 insertions(+), 12 deletions(-)

diff --git a/common/lib/report/fxParams.mjs b/common/lib/report/fxParams.mjs @@ -76,9 +76,13 @@ export const COMPOSITION_PARAMS = Object.freeze({ bool("thumbs", "the date rail's thumbnails", true), ]), "fx.glitch": Object.freeze([ - oneOf("on", "where the glitch tears", ["year", "every"], "year"), + // "clips" tears into the clips its `clips` list names -- a list this table + // has no kind for, so it is set in the manifest only; on "clips" with + // no list, or a list under another `on`, is refused at Apply. + oneOf("on", "where the glitch tears", ["year", "every", "clips"], "year"), sec("seconds", "the glitch's length", 0.2, 1.5, 0.5), bool("stamp", "the glitch's date stamp", true), + bool("year", "the glitch's big year", true), ]), "fx.thenNow": Object.freeze([ sec("seconds", "the THEN/NOW wipe's length", 0.3, 2, 0.6), diff --git a/common/lib/report/videoAssistOps.test.ts b/common/lib/report/videoAssistOps.test.ts @@ -143,7 +143,7 @@ test("scope: an op outside what was asked is refused; the view shows only the sc assert.doesNotMatch(look, /CLIPS|COMPOSITIONS/); const fx = assistView(m, { scope: "fx" }).text; assert.match(fx, /- deck: motion\.in = 0\.45 \[0–2\]/); - assert.match(fx, /- fx\.glitch: on = "year" \[year\|every\]; seconds = 0\.5 \[0\.2–1\.5\]/); + assert.match(fx, /- fx\.glitch: on = "year" \[year\|every\|clips\]; seconds = 0\.5 \[0\.2–1\.5\]/); assert.doesNotMatch(fx, /THE LOOK NOW/); }); diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -579,6 +579,7 @@ Overlays on the picture -- receipts, a zoom, the scrubber, a kinetic quote, punc | Knob | Range · default | From a terminal | |---|---|---| | `render.chrome.fx.<effect>` | scrubber · receipts · zoom · kineticQuote · redact · odometer · punchIn · thenNow · whip · glitch | a take: `umtool take <p> --effect <name>` | +| `render.chrome.fx.glitch.on`, `.clips` | `year` (a tear at each cut between years) · `every` (each cut between clips) · `clips` (only the cut INTO each clip `clips` names: 1–60 ids, each with a clip right before it) · default `year`; `clips` only with `on: "clips"`. `.seconds` 0.2–1.5 · 0.5, `.stamp` (the `PLAY ▶` date) · `true`, `.year` (the new year big over the tear; `false` with `stamp: false` is a bare tear, no text) · `true` | manifest | ### Thread rail diff --git a/umtool/report-to-video/README.md b/umtool/report-to-video/README.md @@ -949,7 +949,7 @@ defaults. "redact": { "position": "bottom", "size": 44, "maxWords": 14, "clips": ["c02"] }, "odometer": { "position": "top-right", "label": "times", "at": "phrase" }, "scrubber": { "position": "top", "thumbs": true }, - "glitch": { "on": "year", "seconds": 0.5, "stamp": true }, + "glitch": { "on": "year", "seconds": 0.5, "stamp": true, "year": true }, // or { "on": "clips", "clips": ["c03", "c07"] } "thenNow": { "pairs": [{ "then": "c03", "now": "c04" }], "seconds": 0.6, "dates": "date" }, "receipts": { "position": "right", "width": 0.36 }, "zoom": { "width": 0.56 }, @@ -972,7 +972,7 @@ defaults. | `redact` | The same line as a page of transcript, every word under a black bar; each bar lifts off as its word is said, the punch phrase highlighted in amber when it is revealed. `kineticQuote` and `redact` are one treatment a clip: when both are on, give one of them `clips` (a clip named by neither falls to the one without a list). | | `odometer` | A counter in a corner: rolling digits, the count going up on each clip — `montage.n` when the clip has it, else its place — at the punch phrase (`at: "phrase"`, else a quarter second in), a 9 rolling on to the next 0. `label` under it ("times"; "" for none). | | `scrubber` | A date rail across the box: a year mark per new year, a tick per dated clip, a playhead that slides to each clip's day as it comes in, with a thumbnail of the clip (its segment's middle frame, `thumbs`) and its date riding under it. The rail keeps clear of an odometer in a corner on its edge. | -| `glitch` | A VHS tear at each cut between two years (`on: "every"`: every cut between clips): scanlines, torn bars in two channels and noise for `seconds` centred on the cut, the new year big with its colours split, and a `PLAY ▶` date stamp in the corner (`stamp`). Seeded, so every frame is the same tear on every render. | +| `glitch` | A VHS tear at each cut between two years (`on: "every"`: every cut between clips; `on: "clips"`: only the cut INTO each clip its `clips` list names, 1–60 ids, each with a clip right before it — `clips` is refused under any other `on`): scanlines, torn bars in two channels and noise for `seconds` centred on the cut, the new year big with its colours split (`year`), and a `PLAY ▶` date stamp in the corner (`stamp`); `year: false, stamp: false` is a bare tear with no text on screen. Seeded, so every frame is the same tear on every render. | | `thenNow` | For each pair — a clip and the very next one — a divider sweeps across the box with the THEN clip's date riding its left and the NOW clip's its right, a scrim on the THEN side. With a crossfade (`transition` > 0) the cut itself becomes a wipe (`xfade=transition=wipeleft`, on that join only) and the divider rides its edge, x = W·(1 − p), over the transition; on a hard cut the divider sweeps alone over `seconds`, centred on the cut. `dates: "year"` shows years only. | | `receipts` | A clip's screenshots (`fx.receipts`, beside the manifest: png/jpg/webp) fly in one after another and fan on one side of the box (`width` of it), then a marker swipes amber over each card's `mark` (fractions of the shot: left, top, right, bottom). They fly out before the clip leaves. | | `punchIn` | The picture snaps in to `scale` (1.2) on each of a clip's `fx.punchIn` seconds — and, with `auto`, on each laugh its captions write ("haha", "lol", "lmao") — for `hold` seconds, about the upper third (`anchor: "upper"`) or the middle, with a white flash and a viewfinder's corners closing on it. Made where the cut is joined (`punchInParts`: the box cropped and scaled back over itself, between those seconds of the segment's clock), so no segment file changes; the hard-cut record names it. | diff --git a/umtool/report-to-video/chrome-fx.mjs b/umtool/report-to-video/chrome-fx.mjs @@ -468,7 +468,8 @@ export function fxPlan(schedule, render, assets = {}) { for (let v = 0; v < 3; v += 1) set(`gn${n}_${v}`, end, { autoAlpha: 0 }); for (let j = 0; j < SL; j += 1) set(`gl${n}_${j}`, end, { autoAlpha: 0, y: 0, x: 0, height: px(10) }); let year = ""; - if (b.year != null) { + // The new year big over the tear, unless the glitch is bare (`year: false`). + if (b.year != null && fx.glitch.year !== false) { const yk = `gy${n}`; init[yk] = { autoAlpha: 0, x: 0, scale: 1.25 }; set(yk, b.at - stepDur, { autoAlpha: 1, x: px(-22), scale: 1.25 }); diff --git a/umtool/report-to-video/chrome-fx.test.mjs b/umtool/report-to-video/chrome-fx.test.mjs @@ -16,6 +16,7 @@ import { fileURLToPath } from "node:url"; import { cardSize, fxHtml, fxPlan, odoCells, railX, zoomPush } from "./chrome-fx.mjs"; import { deckSchedule, fxGeometry } from "./deck.mjs"; +import { frameKeys } from "./frame-keys.mjs"; const HERE = path.dirname(fileURLToPath(import.meta.url)); const PALETTE = { bg: "#12100c", fg: "#f6f1e6", muted: "#a2957f", accent: "#c8752a", amber: "#ffc860" }; @@ -154,6 +155,44 @@ test("a window plays the cut's own clock from `from`", () => { assert.match(html, /data-duration="4"/); }); +test("the page: a bare glitch (year: false, stamp: false) tears with no text; the default draws the year", () => { + const page = (glitch) => fxHtml(schedule({ glitch }), render({ glitch }), { fonts: FONTS }); + const dflt = page({ on: "every" }); + assert.equal((dflt.match(/class="gl-year"/g) ?? []).length, 3, "a year per tear by default"); + assert.equal(page({ on: "every", year: true }), dflt, "year: true is the default, byte for byte"); + const bare = page({ on: "every", year: false, stamp: false }); + assert.equal((bare.match(/class="fx-glitch"/g) ?? []).length, 3, "the same three tears"); + assert.equal((bare.match(/class="gl-slice"/g) ?? []).length, (dflt.match(/class="gl-slice"/g) ?? []).length); + assert.doesNotMatch(bare, /class="gl-year"|class="gl-vhs"/); + assert.ok(!dataOf(bare).cues.some((c) => /^gy\d/.test(c.k)), "no cue moves a year"); + // The tear itself plays the same cues, the year's aside. + const tear = (html) => dataOf(html).cues.filter((c) => !/^g[yv]\d/.test(c.k)); + assert.deepEqual(tear(bare), tear(page({ on: "every", stamp: false }))); +}); + +test("frame keys: a glitch's changed clips list changes the keys of the frames at the cuts it tears", () => { + const keysOf = (glitch) => { + const s = schedule({ glitch }); + return frameKeys({ html: fxHtml(s, render({ glitch }), { fonts: FONTS }), region: "fx", fps: FPS, frames: Math.round(s.total * FPS), version: "v" }); + }; + const s = schedule({ glitch: { on: "every" } }); + const cutFrame = (id) => Math.round(s.fx.glitch.bursts.find((b) => b.segment === id).at * FPS); + const A = keysOf({ on: "clips", clips: ["c3"], stamp: false }); + const B = keysOf({ on: "clips", clips: ["c3", "c4"], stamp: false }); + assert.ok(A && B, "the fx page is one frame keys models"); + assert.notEqual(A[cutFrame("c4")], B[cutFrame("c4")], "the tear added into c4 is a new key there"); + // The bursts are the page's markup, which every frame's key holds: the + // same list keys the same, and a changed one recaptures (never reuses) the + // frames at the cut it moved. + assert.deepEqual(keysOf({ on: "clips", clips: ["c3"], stamp: false }), A); + const C = keysOf({ on: "clips", clips: ["c2"], stamp: false }); + for (const id of ["c2", "c3"]) assert.notEqual(A[cutFrame(id)], C[cutFrame(id)], `the cut into ${id}`); + // A bare tear is another picture at its cut: never a reused frame with the year. + const bare = keysOf({ on: "clips", clips: ["c3"], stamp: false, year: false }); + assert.notEqual(bare[cutFrame("c3")], A[cutFrame("c3")], "year: false keys its frames anew"); + assert.deepEqual(keysOf({ on: "clips", clips: ["c3"], stamp: false, year: true }), A, "year: true keys as the default"); +}); + // --------------------------------------------------------------------------- // The pixels: a headless Chromium still is the seek the renderer makes. // --------------------------------------------------------------------------- @@ -319,6 +358,30 @@ test("pixels: the glitch tears only around its cut", { skip: !haveChromium }, as } }); +test("pixels: a bare glitch (year: false) tears at its cut and leaves nothing after it; with its year, the year stays", { skip: !haveChromium }, async () => { + const shots = async (glitch) => { + const { dir, sched, still } = await project({ glitch }); + try { + const b = sched.fx.glitch.bursts[0]; + return { torn: await still(b.at), after: await still(Math.round((b.at + b.seconds / 2 + 0.3) * 1000) / 1000), dir }; + } catch (e) { + rmSync(dir, { recursive: true, force: true }); + throw e; + } + }; + const g = fxGeometry(render({ glitch: {} })); + const whole = [0, 0, g.width, g.height]; + const bare = await shots({ year: false, stamp: false }); + const withYear = await shots({ stamp: false }); + try { + assert.ok(inked(bare.torn, ...whole) > 0.2, "the bare tear is torn at the cut"); + assert.ok(inked(bare.after, ...whole) < 0.001, "and nothing is on screen once it has passed"); + assert.ok(inked(withYear.after, ...whole) > 0.001, "the default's year is still up then"); + } finally { + for (const s of [bare, withYear]) rmSync(s.dir, { recursive: true, force: true }); + } +}); + test("pixels: the scrubber's playhead sits on its clip's day", { skip: !haveChromium }, async () => { const { dir, sched, still } = await project({ scrubber: {} }); try { diff --git a/umtool/report-to-video/fx-params.test.mjs b/umtool/report-to-video/fx-params.test.mjs @@ -27,11 +27,16 @@ const ON = { "fx.punchIn": { fx: { punchIn: {} } }, "fx.whip": { fx: { whip: {} } }, }; +// A declared value that needs a setting no param can carry (a list), and that +// setting: the glitch on "clips" tears into the clips its list names. +const NEEDS = { "fx.glitch": { on: { clips: (fx) => ({ ...fx, glitch: { ...fx.glitch, clips: ["c1"] } }) } } }; const renderOf = (id) => ({ width: 1920, height: 1080, fps: 30, transition: 0.5, chrome: { engine: "hyperframes", layout: "deck", deck: {}, ...ON[id] } }); const errorsWith = (id, key, value) => { const render = renderOf(id); const chrome = chromeWithParam(render, id, key, value); assert.ok(chrome, `${id}.${key}: chromeWithParam gave nothing`); + const need = NEEDS[id]?.[key]?.[value]; + if (need) chrome.fx = need(chrome.fx); const { chrome: _c, ...rest } = render; return validateChrome(chrome, rest); }; diff --git a/umtool/report-to-video/fx.mjs b/umtool/report-to-video/fx.mjs @@ -7,7 +7,9 @@ // redact: { position, size, maxWords, clips? } the cited line under black bars that lift as it is said // odometer: { position, label, at } rolling digits: the count goes up on each clip // scrubber: { position, thumbs } a date rail, the playhead sliding to each clip's day -// glitch: { on, seconds, stamp } a VHS tear at each cut between years +// glitch: { on, seconds, stamp, year, clips? } a VHS tear at each cut between years +// (on "every": each cut; on "clips": the cut into each named clip; +// year false: the tear bare, no big year) // thenNow: { pairs: [{ then, now }], seconds, dates } a moving divider between a THEN clip and its NOW // receipts: { position, width } a clip's screenshots fan in, a marker swipes the cited line // zoom: { width } a screenshot pushed in on its focus box @@ -38,7 +40,9 @@ export const FX_CORNERS = Object.freeze(["top-left", "top-right", "bottom-left", export const FX_QUOTE_POSITIONS = Object.freeze(["bottom", "top"]); export const FX_RAIL_POSITIONS = Object.freeze(["top", "bottom"]); export const FX_SIDES = Object.freeze(["right", "left"]); -export const FX_GLITCH_ON = Object.freeze(["year", "every"]); +export const FX_GLITCH_ON = Object.freeze(["year", "every", "clips"]); +/** The most clips a glitch on "clips" may name. */ +export const FX_GLITCH_CLIPS_MAX = 60; export const FX_DATES = Object.freeze(["date", "year"]); export const FX_ODOMETER_AT = Object.freeze(["phrase", "start"]); export const FX_SHOT_EXTS = Object.freeze([".png", ".jpg", ".jpeg", ".webp"]); @@ -56,7 +60,7 @@ export const FX_DEFAULTS = Object.freeze({ redact: Object.freeze({ position: "bottom", size: 44, maxWords: 14, clips: null }), odometer: Object.freeze({ position: "top-right", label: "times", at: "phrase" }), scrubber: Object.freeze({ position: "top", thumbs: true }), - glitch: Object.freeze({ on: "year", seconds: 0.5, stamp: true }), + glitch: Object.freeze({ on: "year", seconds: 0.5, stamp: true, year: true, clips: null }), thenNow: Object.freeze({ pairs: Object.freeze([]), seconds: 0.6, dates: "date" }), receipts: Object.freeze({ position: "right", width: 0.36 }), zoom: Object.freeze({ width: 0.56 }), @@ -127,7 +131,7 @@ const ALLOWED = { redact: ["position", "size", "maxWords", "clips"], odometer: ["position", "label", "at"], scrubber: ["position", "thumbs"], - glitch: ["on", "seconds", "stamp"], + glitch: ["on", "seconds", "stamp", "year", "clips"], thenNow: ["pairs", "seconds", "dates"], receipts: ["position", "width"], zoom: ["width"], @@ -211,6 +215,15 @@ export function validateFx(fx, where = "render.chrome.fx") { if (v.on !== undefined && !FX_GLITCH_ON.includes(v.on)) errors.push(`${w}.on must be ${oneOf(FX_GLITCH_ON)}`); if (v.seconds !== undefined && !numIn(v.seconds, 0.2, 1.5)) errors.push(`${w}.seconds must be from 0.2 to 1.5`); if (v.stamp !== undefined && typeof v.stamp !== "boolean") errors.push(`${w}.stamp must be true or false`); + if (v.year !== undefined && typeof v.year !== "boolean") errors.push(`${w}.year must be true or false`); + // `clips` is the list `on: "clips"` tears into, and nothing else's. + const listed = v.clips !== undefined && v.clips !== null; + if (listed && (!Array.isArray(v.clips) || !v.clips.length || v.clips.length > FX_GLITCH_CLIPS_MAX || + !v.clips.every((c) => typeof c === "string" && c))) { + errors.push(`${w}.clips must be a list of 1 to ${FX_GLITCH_CLIPS_MAX} clip ids`); + } + if (v.on === "clips" && !listed) errors.push(`${w}.clips is needed with on "clips": the clips whose cut in tears`); + if (listed && v.on !== "clips") errors.push(`${w}.clips is only for on "clips" (on is "${v.on ?? FX_DEFAULTS.glitch.on}")`); } if (k === "thenNow") { if (v.seconds !== undefined && !numIn(v.seconds, 0.3, 2)) errors.push(`${w}.seconds must be from 0.3 to 2`); @@ -328,6 +341,16 @@ export function validateFxEntries(manifest) { if (!clipIds.has(id)) errors.push(`render.chrome.fx.${k}.clips names ${id}, which is not a clip of the cut`); } } + // A glitch on "clips" tears at the cut INTO each named clip: the entry + // before it must be a clip too (a cut between two clips, as ever). + if (isObj(fx.glitch) && fx.glitch.on === "clips" && Array.isArray(fx.glitch.clips)) { + const w = "render.chrome.fx.glitch.clips"; + const missing = fx.glitch.clips.filter((id) => !clipIds.has(id)); + if (missing.length) errors.push(`${w} names ${missing.join(", ")}, which ${missing.length === 1 ? "is not a clip" : "are not clips"} of the cut`); + const at = new Map(timeline.map((e, i) => [e?.id, i])); + const noCut = fx.glitch.clips.filter((id) => clipIds.has(id) && timeline[at.get(id) - 1]?.type !== "clip"); + if (noCut.length) errors.push(`${w} names ${noCut.join(", ")}, with no clip right before (the glitch tears at a cut between two clips)`); + } if (isObj(fx.thenNow) && Array.isArray(fx.thenNow.pairs)) { const at = new Map(timeline.map((e, i) => [e?.id, i])); const used = new Set(); @@ -655,23 +678,27 @@ export function fxSchedule({ segments, entries, metas = [], render, D, total, wo } } - // ---- the glitch: a tear at a cut between years ------------------------------- + // ---- the glitch: a tear at a cut between years (every cut; the cuts into named clips) const gl = resolveFx(render, "glitch"); if (gl) { const bursts = []; + const named = gl.on === "clips" ? new Set(gl.clips ?? []) : null; for (let k = 1; k < vclips.length; k += 1) { const a = vclips[k - 1], b = vclips[k]; // Consecutive in the cut: a card between them is its own break. if (b.i !== a.i + 1) continue; const da = fxClipDate(a.entry, a.meta), db = fxClipDate(b.entry, b.meta); if (gl.on === "year" && !(da && db && da.y !== db.y)) continue; + if (named && !named.has(b.id)) continue; const m = segments[b.i].start + D / 2; bursts.push({ segment: b.id, at: r3(m), seconds: gl.seconds, year: db ? db.y : null, date: db ? fxDateLabel(db) : "", seed: k, }); } - out.glitch = { stamp: gl.stamp, bursts }; + // `year: false` (a bare tear, no text) is written only when it is off, so + // every schedule without it is byte for byte what it was. + out.glitch = { stamp: gl.stamp, ...(gl.year === false ? { year: false } : {}), bursts }; } // ---- THEN / NOW --------------------------------------------------------------- diff --git a/umtool/report-to-video/fx.test.mjs b/umtool/report-to-video/fx.test.mjs @@ -102,7 +102,7 @@ test("fxOn / fxKeysOn / resolveFx: an effect is on when it is an object", () => assert.equal(fxOn(render({})), false); assert.equal(fxOn(render({ glitch: null })), false); assert.deepEqual(fxKeysOn(render({ glitch: {}, odometer: null, scrubber: {} })), ["scrubber", "glitch"]); - assert.deepEqual(resolveFx(render({ glitch: { seconds: 0.8 } }), "glitch"), { on: "year", seconds: 0.8, stamp: true }); + assert.deepEqual(resolveFx(render({ glitch: { seconds: 0.8 } }), "glitch"), { on: "year", seconds: 0.8, stamp: true, year: true, clips: null }); assert.equal(resolveFx(render({}), "glitch"), null); }); @@ -255,6 +255,82 @@ test("the glitch tears at each cut between years, centred on the mid-dissolve", assert.equal(sched({ glitch: { on: "every" } }, { timeline }).fx.glitch.bursts.length, 3); }); +test("the glitch on \"clips\": a tear only at the cut INTO each named clip, the rest as on \"every\"", () => { + const timeline = [clip("c1", "2019-05-02"), clip("c2", "2019-08-02"), clip("c3", "2021-01-01"), clip("c4", "2026-01-01")]; + const every = sched({ glitch: { on: "every", stamp: false } }, { timeline }).fx.glitch; + const named = sched({ glitch: { on: "clips", clips: ["c4", "c2"], stamp: false } }, { timeline }).fx.glitch; + // The list's order is not the cut's: the bursts are in the cut's order, each + // exactly the burst "every" makes at that cut (its time, seed, year and date). + assert.deepEqual(named.bursts.map((b) => b.segment), ["c2", "c4"]); + assert.deepEqual(named.bursts, every.bursts.filter((b) => b.segment !== "c3")); + assert.equal(named.stamp, false); + // Into c2 is a cut within one year: "clips" tears there all the same. + assert.deepEqual(sched({ glitch: { on: "clips", clips: ["c2"] } }, { timeline }).fx.glitch.bursts.map((b) => [b.segment, b.year]), [["c2", 2019]]); + // The first clip has no cut into it; a card between two clips is its own break. + assert.deepEqual(sched({ glitch: { on: "clips", clips: ["c1"] } }, { timeline }).fx.glitch.bursts, []); + const carded = [clip("c1", "2019-05-02"), { type: "card", id: "k1", seconds: 4, heading: "x" }, clip("c2", "2021-01-01"), clip("c3", "2022-01-01")]; + assert.deepEqual(sched({ glitch: { on: "clips", clips: ["c2", "c3"] } }, { timeline: carded, durs: [6.4, 4, 6.4, 6.4] }).fx.glitch.bursts.map((b) => b.segment), ["c3"]); +}); + +test("the glitch on \"year\" and \"every\" schedule as they did before \"clips\"", () => { + const timeline = [clip("c1", "2019-05-02"), clip("c2", "2019-08-02"), clip("c3", "2021-01-01"), clip("c4", "2026-01-01")]; + // Pinned from the schedule before the "clips" mode was added. + assert.deepEqual(sched({ glitch: {} }, { timeline }).fx.glitch, { + stamp: true, + bursts: [ + { segment: "c3", at: 12.05, seconds: 0.5, year: 2021, date: "1 Jan 2021", seed: 2 }, + { segment: "c4", at: 17.95, seconds: 0.5, year: 2026, date: "1 Jan 2026", seed: 3 }, + ], + }); + assert.deepEqual(sched({ glitch: { on: "every", stamp: false, seconds: 0.8 } }, { timeline }).fx.glitch, { + stamp: false, + bursts: [ + { segment: "c2", at: 6.15, seconds: 0.8, year: 2019, date: "2 Aug 2019", seed: 1 }, + { segment: "c3", at: 12.05, seconds: 0.8, year: 2021, date: "1 Jan 2021", seed: 2 }, + { segment: "c4", at: 17.95, seconds: 0.8, year: 2026, date: "1 Jan 2026", seed: 3 }, + ], + }); +}); + +test("the glitch's clips: a list for on \"clips\" alone, 1 to 60 ids, each a clip of the cut with a clip before it", () => { + assert.deepEqual(validateFx({ glitch: { on: "clips", clips: ["c2"], stamp: false } }), []); + assert.match(validateFx({ glitch: { on: "clips" } }).join(), /glitch\.clips is needed with on "clips"/); + assert.match(validateFx({ glitch: { on: "clips", clips: null } }).join(), /glitch\.clips is needed/); + assert.match(validateFx({ glitch: { on: "clips", clips: [] } }).join(), /clips must be a list of 1 to 60 clip ids/); + assert.match(validateFx({ glitch: { on: "clips", clips: ["c2", 3] } }).join(), /clips must be a list of 1 to 60 clip ids/); + assert.match(validateFx({ glitch: { on: "clips", clips: "c2" } }).join(), /clips must be a list of 1 to 60 clip ids/); + assert.match(validateFx({ glitch: { on: "clips", clips: Array.from({ length: 61 }, (_, i) => `c${i}`) } }).join(), /clips must be a list of 1 to 60/); + assert.deepEqual(validateFx({ glitch: { on: "clips", clips: Array.from({ length: 60 }, (_, i) => `c${i}`) } }), []); + assert.match(validateFx({ glitch: { on: "every", clips: ["c2"] } }).join(), /glitch\.clips is only for on "clips" \(on is "every"\)/); + assert.match(validateFx({ glitch: { clips: ["c2"] } }).join(), /glitch\.clips is only for on "clips" \(on is "year"\)/); + assert.match(validateFx({ glitch: { on: "never" } }).join(), /on must be "year", "every", "clips"/); + // Against the cut: every id a clip, each with a clip right before it. + const m = (glitch, timeline = TIMELINE) => validateFxEntries({ render: render({ glitch }), timeline }); + assert.deepEqual(m({ on: "clips", clips: ["c2", "c4"] }), []); + assert.deepEqual(m({ on: "clips", clips: ["c2", "c9", "c8"] }), ["render.chrome.fx.glitch.clips names c9, c8, which are not clips of the cut"]); + assert.deepEqual(m({ on: "clips", clips: ["c9"] }), ["render.chrome.fx.glitch.clips names c9, which is not a clip of the cut"]); + assert.match(m({ on: "clips", clips: ["c1"] }).join(), /names c1, with no clip right before/); + const carded = [clip("c1", "2019-05-02"), { type: "card", id: "k1", seconds: 4, heading: "x" }, clip("c2", "2021-01-01")]; + assert.match(m({ on: "clips", clips: ["k1"] }, carded).join(), /names k1, which is not a clip/); + assert.match(m({ on: "clips", clips: ["c2"] }, carded).join(), /names c2, with no clip right before/); + // The other modes never look at the list's ids (validateFx refuses the list there). + assert.deepEqual(m({ on: "every" }), []); +}); + +test("the glitch's year: true or false; false is written to the schedule, true (the default) leaves it as it was", () => { + assert.deepEqual(validateFx({ glitch: { year: false, stamp: false } }), []); + assert.deepEqual(validateFx({ glitch: { year: true } }), []); + assert.match(validateFx({ glitch: { year: "no" } }).join(), /glitch\.year must be true or false/); + const timeline = [clip("c1", "2019-05-02"), clip("c2", "2021-01-01"), clip("c3", "2021-06-01"), clip("c4", "2026-01-01")]; + const dflt = sched({ glitch: { on: "every" } }, { timeline }).fx.glitch; + assert.ok(!("year" in dflt), "no year key unless it is off"); + assert.deepEqual(sched({ glitch: { on: "every", year: true } }, { timeline }).fx.glitch, dflt); + const bare = sched({ glitch: { on: "every", year: false, stamp: false } }, { timeline }).fx.glitch; + assert.equal(bare.year, false); + // The bursts are the same tears: only the page leaves the year out. + assert.deepEqual(bare.bursts, dflt.bursts); +}); + test("the scrubber: a tick per dated clip, the rail padded, a year mark per new year", () => { const s = sched({ scrubber: {} }); const sc = s.fx.scrubber; diff --git a/umtool/report-to-video/modules/fx.mjs b/umtool/report-to-video/modules/fx.mjs @@ -21,6 +21,7 @@ export default defineModule({ intro: "Overlays on the picture -- receipts, a zoom, the scrubber, a kinetic quote, punch-ins, whip cuts -- (`render.chrome.fx`, fx.mjs); `umtool takes effects <p>` lists the presets.", rows: [ ["`render.chrome.fx.<effect>`", "scrubber · receipts · zoom · kineticQuote · redact · odometer · punchIn · thenNow · whip · glitch", "a take: `umtool take <p> --effect <name>`"], + ["`render.chrome.fx.glitch.on`, `.clips`", "`year` (a tear at each cut between years) · `every` (each cut between clips) · `clips` (only the cut INTO each clip `clips` names: 1–60 ids, each with a clip right before it) · default `year`; `clips` only with `on: \"clips\"`. `.seconds` 0.2–1.5 · 0.5, `.stamp` (the `PLAY ▶` date) · `true`, `.year` (the new year big over the tear; `false` with `stamp: false` is a bare tear, no text) · `true`", "manifest"], ], }, region: "fx",