Archilyzer · Source

archilyzer

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

commit 0e64a563a537f5a0a4d1695bbbb973ed21cda9a9
parent ed982b06b624482b71cc2f0d92b2ea3636c0361f
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu,  5 Nov 2026 23:48:33 -0500

umtool: the dial's variants -- placement, needle motion, the finale's last beat -- as knobs

Operator, 5 Nov: "Make variants for me to judge when it makes sense." Each
is a deck.dial setting, set with `umtool look`, no code:

- placement "column" (default) | "corner": the corner drops the column --
  the footage stays where the deck puts it, the dial a `size` square
  (default 340 px at 1920) over its lower-right corner, the odometer and
  the trail at 4/5 size stacked in its lower-left; posts.shift applies
  again and the side panel is allowed there (the feed is still refused);
- motion "spring" (default, back.out) | "ease" (power2.inOut, no
  overshoot), the finale's drop too;
- finaleEnd "odometer" (default) | "promise": the dial's finale fades out
  once NET has held (dialFinaleHandoff, on the cue grid, for the promise
  clock to come in on) -- only when a module `promise` is on the cut; with
  none it ends on the odometer.

Small words on the dial keep a 12 px floor (the corner dial is a third of
the column's).

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

Diffstat:
Mumtool/docs/knobs.md | 4++++
Mumtool/report-to-video/chrome-instruments.mjs | 48++++++++++++++++++++++++++++++++++++++----------
Mumtool/report-to-video/deck.mjs | 26++++++++++++++++++++++++--
Mumtool/report-to-video/instruments.mjs | 39+++++++++++++++++++++++++++++++++++++--
Mumtool/report-to-video/instruments.test.mjs | 65++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Mumtool/report-to-video/modules/dial-finale.mjs | 6+++++-
Mumtool/report-to-video/modules/dial.mjs | 8++++++++
7 files changed, 178 insertions(+), 18 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -1710,6 +1710,10 @@ A bathroom-scale face at the top of the instruments' column (the right of the fr | `deck.dial.needle` | a #hex · default `#ff5a4e` | `umtool look <p> deck.dial.needle='"#ff5a4e"'` | | `deck.dial.label` | words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS` | `umtool look <p> deck.dial.label='"…"'` | | `deck.dial.finale` | bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`) | `umtool look <p> deck.dial.finale=false` | +| `deck.dial.placement` | `column` `corner` · default `column`. A VARIANT: `corner` drops the column -- the footage stays where the deck puts it, the dial a `size` square over its lower-right corner, the odometer and the trail (at 4/5 size) stacked in its lower-left; the side panel is allowed there, the feed still refused | `umtool look <p> deck.dial.placement=corner` | +| `deck.dial.size` | 200–540 px at 1920 wide · default `340` (the corner dial only) | `umtool look <p> deck.dial.size=300` | +| `deck.dial.motion` | `spring` `ease` · default `spring`. A VARIANT: the needle's `back.out` overshoot and settle, or a plain `power2.inOut` (the finale's drop too) | `umtool look <p> deck.dial.motion=ease` | +| `deck.dial.finaleEnd` | `odometer` `promise` · default `odometer`. A VARIANT: `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`); with no promise module on the cut it ends on the odometer | `umtool look <p> deck.dial.finaleEnd=promise` | ### Lost odometer diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs @@ -13,7 +13,7 @@ // states its from, so a seek lands on the same pixels from either side and a // frame whose values did not move keys as the frame before it -- the needle at // rest between two weights is captured once, not once a frame. -import { deckChoreography, even, instrumentsGeometry, railGap } from "./deck.mjs"; +import { cueTime, deckChoreography, even, instrumentsGeometry, railGap } from "./deck.mjs"; import { mix, rgba } from "./chrome-deck.mjs"; import { finaleLayout } from "./chrome-finale.mjs"; import { FINALE_MOTION } from "./finale.mjs"; @@ -25,7 +25,7 @@ import { /** The motion's seconds: the needle's swing, a ghost's move, the odometer's roll, a block's fade. */ export const INSTRUMENT_MOTION = Object.freeze({ - needle: 0.9, needleEase: "back.out(1.7)", ghost: 0.7, goal: 0.6, roll: 1.3, fade: 0.25, point: 0.4, segment: 0.45, + needle: 0.9, needleEase: "back.out(1.7)", needlePlain: "power2.inOut", ghost: 0.7, goal: 0.6, roll: 1.3, fade: 0.25, point: 0.4, segment: 0.45, }); /** The faces a measure page draws in: the deck's, and the manifest's display and condensed faces when it names them. */ @@ -115,6 +115,8 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = "" const face = dialFaceSvg({ size, scale, mark: cfg.mark, colors: { ...colors, mark: colors.accent }, labelFont: fontStack(fonts, "condensed") }); const { C, R, Rf, u } = face; const px = (v) => Math.round(v * u * 100) / 100; + // Small words keep a floor: a corner dial is a third of the column's, and 8 px does not read. + const fpx = (v) => Math.max(12, px(v)); const layer = (k, inner, cls = "ly") => `<div class="${cls}" data-k="${prefix}${k}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">${inner}</svg></div>`; const parts = []; parts.push(`<div class="ly face">${face.svg}</div>`); @@ -171,21 +173,24 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = "" color: ${colors.ghost}; line-height: 1.05; padding: ${px(3)}px ${px(7)}px; border-radius: ${px(6)}px; background: ${rgba(colors.face, 0.86)}; } .dial .asof b { display: block; font-family: ${fontStack(fonts, "display")}; font-weight: 400; font-size: ${px(24)}px; } - .dial .asof span { display: block; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(13)}px; letter-spacing: 0.08em; } + .dial .asof span { display: block; font-family: ${fontStack(fonts, "condensed")}; font-size: ${fpx(13)}px; letter-spacing: 0.08em; } .dial .rlab { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "condensed")}; - font-size: ${px(15)}px; letter-spacing: 0.14em; color: ${colors.muted}; } + font-size: ${fpx(15)}px; letter-spacing: 0.14em; color: ${colors.muted}; } .dial .read { position: absolute; left: 0; width: ${size}px; text-align: center; } .dial .read .big { font-family: ${fontStack(fonts, "display")}; font-size: ${px(72)}px; line-height: ${px(76)}px; color: ${colors.fg}; font-variant-numeric: tabular-nums; white-space: nowrap; } .dial .read .big i { font-style: normal; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(20)}px; letter-spacing: 0.1em; color: ${colors.muted}; margin-left: ${px(6)}px; } - .dial .read .when { position: absolute; left: 0; width: ${size}px; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(16)}px; - line-height: ${px(20)}px; letter-spacing: 0.1em; color: ${colors.muted}; } + .dial .read .when { position: absolute; left: 0; width: ${size}px; font-family: ${fontStack(fonts, "condensed")}; font-size: ${fpx(16)}px; + line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.1em; color: ${colors.muted}; } .dial .goalw { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "bold")}; - font-size: ${px(17)}px; line-height: ${px(20)}px; letter-spacing: 0.05em; color: ${colors.amber}; white-space: nowrap; }`; + font-size: ${fpx(17)}px; line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.05em; color: ${colors.amber}; white-space: nowrap; }`; return { html: `<div class="dial">${parts.join("\n ")}</div>`, css, face }; } +/** The needle's ease (`deck.dial.motion`): the spring's overshoot and settle, or a plain ease. */ +const needleEase = (cfg, spring = INSTRUMENT_MOTION.needleEase) => (cfg.motion === "ease" ? INSTRUMENT_MOTION.needlePlain : spring); + /** The dial's cues over the cut: the needle on each stated weight, the ghosts, the wedges, the goal, the readout. */ function dialCues(L, { track, scale, cfg, prefix = "", finale = false }) { const M = INSTRUMENT_MOTION; @@ -194,7 +199,7 @@ function dialCues(L, { track, scale, cfg, prefix = "", finale = false }) { // The finale drives its own needle (dialFinaleHtml). if (!finale) L.set(k("nd"), { rotation: a0 }); track.current.forEach((c, j) => { - if (j > 0 && !finale) L.add(k("nd"), c.t, M.needle, { rotation: Number.isFinite(c.value) ? dialAngle(c.value, scale) : a0 }, M.needleEase); + if (j > 0 && !finale) L.add(k("nd"), c.t, M.needle, { rotation: Number.isFinite(c.value) ? dialAngle(c.value, scale) : a0 }, needleEase(cfg)); // The wedge once the needle is all but there, gone with its state. const w = Number.isFinite(c.value) ? wedgeRange(c.value, c.qualifier) : null; if (w && dialAngle(w[1], scale) > dialAngle(w[0], scale)) { @@ -519,6 +524,25 @@ export function finaleNumbers(measure) { }; } +/** The handoff to the promise clock: NET's beat (in at the grow + 3.2 s) held `hold` s, then a `fade`. */ +export const FINALE_HANDOFF = Object.freeze({ net: 3.2, hold: 2.3, fade: 0.5 }); + +/** + * When the dial's finale hands the finale's lower column to the promise clock + * (cut seconds) -- `deck.dial.finaleEnd: "promise"` -- or null: it ends on the + * odometer, or the finale is too short to hold NET first. The promise module + * (measure-extras) reads it to come in as the instruments go. Whether a + * promise module is on the cut is the caller's to say (the dial-finale + * module's page asks the registry). + */ +export function dialFinaleHandoff(schedule, render) { + const fin = schedule?.finale; + if (!fin || resolveDial(render)?.finaleEnd !== "promise") return null; + // On the cue grid, so the promise clock's cue and the instruments' land on the same frame. + const at = cueTime(fin.from + FINALE_MOTION.grow + FINALE_HANDOFF.net + 0.5 + FINALE_HANDOFF.hold, schedule.fps ?? render.fps ?? 30); + return at + FINALE_HANDOFF.fade < fin.to ? at : null; +} + /** * The dial's finale page over the finale's `window` (cut seconds; the * finale's own, finale.mjs): the dial large, its needle dropping from his @@ -569,12 +593,16 @@ export function dialFinaleHtml(schedule, render, window, opts = {}) { L.set("rt", { autoAlpha: 0 }); L.add("rt", A, 0.4, { autoAlpha: 1 }, "power2.out"); const D = Number(schedule.transition) || 0; - if (D > 0 && from + dur - D > A + 0.4) L.add("rt", from + dur - D, D, { autoAlpha: 0 }, "power1.in"); + // The last beat: the promise clock's (deck.dial.finaleEnd "promise", a promise module on the cut) -- + // the instruments go at the handoff and leave it the column -- else theirs, out through the dissolve. + const handoff = opts.promise ? dialFinaleHandoff(schedule, render) : null; + if (handoff !== null) L.add("rt", handoff, FINALE_HANDOFF.fade, { autoAlpha: 0 }, "power1.in"); + else if (D > 0 && from + dur - D > A + 0.4) L.add("rt", from + dur - D, D, { autoAlpha: 0 }, "power1.in"); // The needle starts at his highest remembered weight (the scale's top without one) and drops. const start = Number.isFinite(nums.peak) ? nums.peak : M.scale.max; dialCues(L, { track, scale: M.scale, cfg, prefix: "f", finale: true }); L.set("fnd", { rotation: dialAngle(start, M.scale) }); - if (Number.isFinite(nums.weight)) L.add("fnd", A + 0.4, 1.8, { rotation: dialAngle(nums.weight, M.scale) }, "back.out(1.4)"); + if (Number.isFinite(nums.weight)) L.add("fnd", A + 0.4, 1.8, { rotation: dialAngle(nums.weight, M.scale) }, needleEase(cfg, "back.out(1.4)")); for (let i = 0; i <= wheels; i += 1) L.set(`ow${i}`, { y: 0 }); rollCues(L, { a: 0, b: nums.lost, t: A + 0.6, dur: 2.6, wheels, wh: odo.wh, prefix: "o", ease: "power3.out" }); blocks(L, [{ t: from, runs: 0 }, { t: A + 0.6 + 2.6, runs: nums.runs }], "orn", { fade: 0.3, shown: (x) => x.runs > 0 }); diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -28,7 +28,7 @@ import { claimOf, marksOf, originalUrlAt, resolveFactcheck, roundStamps, stampSchedule, stampsWithFinale, tallyOf, tallyVerdicts, validateFactcheck, } from "./factcheck.mjs"; import { resolveCounter } from "./counter.mjs"; -import { INSTRUMENT_COLUMN, instrumentsOn, instrumentsWanted } from "./instruments.mjs"; +import { INSTRUMENT_COLUMN, instrumentsOn, instrumentsPlacement, instrumentsWanted, resolveDial } from "./instruments.mjs"; import { TRAILER_HIT_TIERS, TRAILER_SWELL } from "./trailer-hits.mjs"; import { DECK_PAD_X, COUNTER_CELL } from "./modules/design.mjs"; import { @@ -201,7 +201,8 @@ export function validateChrome(chrome, render = {}) { const instruments = instrumentsWanted({ chrome }); if (instruments.length) { const names = instruments.map((n) => `${w}.${n}`).join(", "); - if (railOn({ chrome })) errors.push(`${threadsOn({ chrome }) ? "render.chrome.threads" : "render.chrome.flips"} and ${names} both need the frame beside the footage: set one`); + // In the corner (deck.dial.placement) they stand in the footage: only the feed, which reframes it, is refused. + if (railOn({ chrome }) && instrumentsOn({ chrome })) errors.push(`${threadsOn({ chrome }) ? "render.chrome.threads" : "render.chrome.flips"} and ${names} both need the frame beside the footage: set one`); if (resolveDeck({ chrome }).posts.layout === "feed") errors.push(`${names} need the popup posts, not the feed (${w}.posts.layout)`); } if (railOn({ chrome })) { @@ -497,6 +498,7 @@ export function instrumentsGeometry(render) { const { W, deck, footage } = deckGeometry(render); const k = W / 1920; const gap = railGap(render); + if (instrumentsPlacement(render) === "corner") return instrumentsCorner(render, { k, footage }); const x = footage.x + footage.width + gap; const column = { x, y: gap, width: W - gap - x, height: deck.y - 2 * gap }; const on = instrumentsWanted(render); @@ -513,6 +515,26 @@ export function instrumentsGeometry(render) { return out; } +/** + * The instruments in the CORNER (`deck.dial.placement: "corner"`): over the + * footage box where the deck puts it, `inset` in from its edges -- the dial a + * `size` square in the lower right, the odometer and the trail at four fifths + * of their column size stacked in the lower left (the trail over the + * odometer). `column` is the footage box they stand in. + */ +function instrumentsCorner(render, { k, footage: f }) { + const on = new Set(instrumentsWanted(render)); + const inset = Math.round(28 * k); + const size = even(Math.min((resolveDial(render)?.size ?? 340) * k, f.height - 2 * inset, f.width / 2)); + const ow = even(480 * k), oh = even(112 * k), th = even(110 * k), between = Math.round(10 * k); + const out = { column: { ...f }, dial: null, odometer: null, trail: null }; + if (on.has("dial")) out.dial = { x: f.x + f.width - inset - size, y: f.y + f.height - inset - size, width: size, height: size }; + let y = f.y + f.height - inset; + if (on.has("odometer")) { y -= oh; out.odometer = { x: f.x + inset, y, width: ow, height: oh }; y -= between; } + if (on.has("trail")) { y -= th; out.trail = { x: f.x + inset, y, width: ow, height: th }; } + return out; +} + /** The air the band keeps under its text block, px. */ export const BAND_FOOT = 0; /** In a crowded band, the share of the width the title and byline keep at the left (the section title stays out of it). */ diff --git a/umtool/report-to-video/instruments.mjs b/umtool/report-to-video/instruments.mjs @@ -44,8 +44,28 @@ export const DIAL_DEFAULTS = Object.freeze({ finale: true, // The words over the big digits. label: "HE SAYS HE WEIGHS", + // Where the instruments stand (a variant to judge): "column" -- the frame's right + // column, the footage moved left for it -- or "corner": a smaller dial over the + // footage's lower-right corner (`size` px at 1920 wide), the odometer and the trail + // stacked in its lower-left, the footage where the deck always puts it. + placement: "column", + size: 340, + // The needle's move to a stated weight: "spring" (back.out, an overshoot and a + // settle, as a scale's) or "ease" (power2.inOut, no overshoot). + motion: "spring", + // The finale's last beat: "odometer" (the wheels roll, NET holds, to the end) or + // "promise" -- the instruments hand off to the promise clock (module `promise`): + // they fade out at the handoff (dialFinaleHandoff) and the clock takes the column. + // With no promise module on the cut it ends as "odometer". + finaleEnd: "odometer", }); +export const DIAL_PLACEMENTS = Object.freeze(["column", "corner"]); +export const DIAL_MOTIONS = Object.freeze(["spring", "ease"]); +export const DIAL_FINALE_ENDS = Object.freeze(["odometer", "promise"]); +/** A corner dial's size bounds, px at 1920 wide. */ +export const DIAL_SIZE = Object.freeze([200, 540]); + export const ODOMETER_DEFAULTS = Object.freeze({ label: "POUNDS HE SAYS HE'S LOST", // NET (first stated weight of the record to the latest) in plain digits beside the wheels. @@ -89,8 +109,14 @@ export function instrumentsWanted(render) { return out; } -/** Is the instrument column on: any of the three asked for. The frame's layout changes with it. */ -export const instrumentsOn = (render) => instrumentsWanted(render).length > 0; +/** Where the instruments stand: the dial's `placement` ("column" without a dial). */ +export const instrumentsPlacement = (render) => resolveDial(render)?.placement ?? "column"; + +/** + * Is the instrument COLUMN on: any of the three asked for, placed in the column. + * The frame's layout changes with it (the footage moves left); in the corner it does not. + */ +export const instrumentsOn = (render) => instrumentsWanted(render).length > 0 && instrumentsPlacement(render) === "column"; function labelProblem(v, where) { if (typeof v !== "string") return `${where} must be text`; @@ -121,6 +147,15 @@ export function validateDial(v, where = "render.chrome.deck.dial") { for (const k of ["ghosts", "goal", "finale"]) if (obj[k] !== undefined) { const p = boolProblem(obj[k], `${where}.${k}`); if (p) errors.push(p); } if (obj.needle !== undefined && !(typeof obj.needle === "string" && HEX_RE.test(obj.needle))) errors.push(`${where}.needle must be a #hex colour`); if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); } + const oneOf = (k, list) => { + if (obj[k] !== undefined && !list.includes(obj[k])) errors.push(`${where}.${k} must be ${list.map((x) => `"${x}"`).join(" or ")}`); + }; + oneOf("placement", DIAL_PLACEMENTS); + oneOf("motion", DIAL_MOTIONS); + oneOf("finaleEnd", DIAL_FINALE_ENDS); + if (obj.size !== undefined && !(Number.isInteger(obj.size) && numIn(obj.size, DIAL_SIZE[0], DIAL_SIZE[1]))) { + errors.push(`${where}.size must be a whole number of pixels from ${DIAL_SIZE[0]} to ${DIAL_SIZE[1]}`); + } return errors; } diff --git a/umtool/report-to-video/instruments.test.mjs b/umtool/report-to-video/instruments.test.mjs @@ -11,7 +11,7 @@ import { fileURLToPath } from "node:url"; import { deckGeometry, estimateSchedule, instrumentsGeometry, postsGeometry, resolveDeck, validateChrome } from "./deck.mjs"; import { deckHtml } from "./chrome-deck.mjs"; -import { dialFinaleGeometry, dialFinaleHtml, dialHtml, finaleNumbers, odometerHtml, trailHtml } from "./chrome-instruments.mjs"; +import { dialFinaleGeometry, dialFinaleHandoff, dialFinaleHtml, dialHtml, finaleNumbers, odometerHtml, trailHtml } from "./chrome-instruments.mjs"; import { frameKeys } from "./frame-keys.mjs"; import { instrumentsOn, resolveDial, validateDial } from "./instruments.mjs"; import { dialAngle, fmtDate, fmtSigned, measureTrack, wheelDigits, wheelRoll } from "./measure-draw.mjs"; @@ -106,9 +106,15 @@ test("the instruments' settings: true, an object of known keys, or off; the side assert.ok(feed.some((e) => /need the popup posts, not the feed/.test(e)), feed.join("\n")); const side = validateChrome({ ...chromeWith({ trail: true }), threads: { list: [{ id: "a", label: "A" }] } }, {}); assert.ok(side.some((e) => /render\.chrome\.threads and render\.chrome\.deck\.trail both need the frame/.test(e)), side.join("\n")); - assert.deepEqual(resolveDial(RENDER), { mark: 300, ghosts: true, goal: true, needle: "#ff5a4e", finale: true, label: "HE SAYS HE WEIGHS" }); + assert.deepEqual(resolveDial(RENDER), { + mark: 300, ghosts: true, goal: true, needle: "#ff5a4e", finale: true, label: "HE SAYS HE WEIGHS", placement: "column", size: 340, motion: "spring", finaleEnd: "odometer", + }); + assert.match(validateDial({ placement: "left" })[0], /placement must be "column" or "corner"/); + assert.match(validateDial({ size: 100 })[0], /size must be a whole number of pixels from 200 to 540/); + assert.match(validateDial({ motion: "bounce" })[0], /motion must be "spring" or "ease"/); + assert.match(validateDial({ finaleEnd: "net" })[0], /finaleEnd must be "odometer" or "promise"/); assert.equal(resolveDial({ chrome: chromeWith({ dial: false }) }), null); - assert.deepEqual(moduleProblems({ render: { ...RENDER, chrome: chromeWith({ dial: { ghost: true } }) } }).dial, ["render.chrome.deck.dial.ghost is not a setting of it (mark, ghosts, goal, needle, finale, label)"]); + assert.deepEqual(moduleProblems({ render: { ...RENDER, chrome: chromeWith({ dial: { ghost: true } }) } }).dial, ["render.chrome.deck.dial.ghost is not a setting of it (mark, ghosts, goal, needle, finale, label, placement, size, motion, finaleEnd)"]); }); // --------------------------------------------------------------------------- @@ -235,3 +241,56 @@ test("the dial's finale: the record's numbers, a window page the frame keys mode assert.equal(at(win.from + 6), at(win.from + 9)); assert.notEqual(at(win.from + 1.5), at(win.from + 1.6)); }); + +// --------------------------------------------------------------------------- +// The variants (deck.dial.placement, .motion, .finaleEnd). +// --------------------------------------------------------------------------- + +test("placement corner: the column dropped, the footage where the deck puts it, the instruments over its corners", () => { + const corner = { ...RENDER, chrome: chromeWith({ dial: { placement: "corner" }, odometer: true, trail: true }) }; + const f = deckGeometry(corner).footage; + assert.deepEqual(f, { x: 173, y: 2, width: 1574, height: 886 }); + assert.equal(instrumentsOn(corner), false); + assert.ok(resolveDeck(corner).posts.shift, "posts.shift applies again: the footage is the deck's own"); + const g = instrumentsGeometry(corner); + assert.deepEqual(g.dial, { x: 173 + 1574 - 28 - 340, y: 2 + 886 - 28 - 340, width: 340, height: 340 }); + assert.deepEqual(g.odometer, { x: 201, y: 2 + 886 - 28 - 112, width: 480, height: 112 }); + assert.equal(g.trail.y + g.trail.height, g.odometer.y - 10); + assert.equal(instrumentsGeometry({ ...corner, chrome: chromeWith({ dial: { placement: "corner", size: 260 } }) }).dial.width, 260); + assert.deepEqual(validateChrome(corner.chrome, corner), []); + // In the corner the side panel may stand beside the footage; the feed still may not. + assert.deepEqual(validateChrome({ ...corner.chrome, threads: { list: [{ id: "a", label: "A" }] } }, corner).filter((e) => /both need the frame/.test(e)), []); + const { schedule } = cut(corner); + for (const id of ["dial", "odometer", "trail"]) { + const [r] = moduleById(id).regions(schedule, { render: corner, outDir: "/o" }); + assert.deepEqual([r.x, r.y, r.width, r.height], [g[id].x, g[id].y, g[id].width, g[id].height], id); + } + const html = dialHtml(schedule, corner, { fonts }); + assert.match(html, /width=340, height=340/); +}); + +test("motion ease: the needle moves on a plain ease, no overshoot; spring is back.out", () => { + const { schedule } = cut(); + const spring = dialHtml(schedule, RENDER, { fonts }); + const ease = dialHtml(schedule, { ...RENDER, chrome: chromeWith({ ...RENDER.chrome.deck, dial: { motion: "ease" } }) }, { fonts }); + const needleEases = (html) => [...new Set(JSON.parse(/<script id="dial-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]).cues.filter((c) => c.k === "nd").map((c) => c.ease))]; + assert.deepEqual(needleEases(spring), ["back.out(1.7)"]); + assert.deepEqual(needleEases(ease), ["power2.inOut"]); +}); + +test("finaleEnd promise: the instruments hand off to the promise clock once NET has held -- only when a promise module is on", () => { + const { schedule } = cut(); + const promiseRender = { ...RENDER, chrome: chromeWith({ ...RENDER.chrome.deck, dial: { finaleEnd: "promise" } }) }; + assert.equal(dialFinaleHandoff(schedule, RENDER), null); + const at = dialFinaleHandoff(schedule, promiseRender); + assert.ok(Math.abs(at - (schedule.finale.from + 0.8 + 3.2 + 0.5 + 2.3)) < 1 / (FPS * 8)); + const win = moduleById("dial-finale").window(schedule, { fps: FPS, total: schedule.total }); + const fadesOf = (opts) => { + const html = dialFinaleHtml(schedule, promiseRender, win, { fonts, ...opts }); + const d = JSON.parse(/<script id="dial-finale-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]); + return d.cues.filter((c) => c.k === "rt" && c.to.autoAlpha === 0).map((c) => c.at); + }; + assert.deepEqual(fadesOf({ promise: true }), [at]); + // No promise module drawing: it ends on the odometer, out through the dissolve. + assert.notDeepEqual(fadesOf({ promise: false }), [at]); +}); diff --git a/umtool/report-to-video/modules/dial-finale.mjs b/umtool/report-to-video/modules/dial-finale.mjs @@ -47,7 +47,11 @@ export default defineModule({ window: (schedule, { fps, total }) => snapWindow({ segment: "dial-finale", from: schedule.finale.from, to: schedule.finale.to }, { fps, total }), names: ({ preview }) => ({ project: `dial-finale${preview ? "-preview" : ""}`, stem: "dial-finale" }), async page(ctx) { - return dialFinaleHtml(ctx.schedule, ctx.render, ctx.window, { fonts: await instrumentFonts(ctx) }); + // `deck.dial.finaleEnd: "promise"` hands off only to a promise module this cut draws (measure-extras'). + const { moduleById } = await import("./index.mjs"); + const promise = moduleById("promise"); + const on = !!promise && (typeof promise.on !== "function" || !!promise.on(ctx.schedule, ctx.render)); + return dialFinaleHtml(ctx.schedule, ctx.render, ctx.window, { fonts: await instrumentFonts(ctx), promise: on }); }, /** Over the finale's window, laid at its own second (the finale's own regions, finale.mjs). */ regions(schedule, { render, outDir, shift = 0, clip = null }) { diff --git a/umtool/report-to-video/modules/dial.mjs b/umtool/report-to-video/modules/dial.mjs @@ -32,6 +32,10 @@ export default defineModule({ { key: "goal", type: "boolean", label: "The latest goal on the bezel", default: true }, { key: "finale", type: "boolean", label: "Large in the finale", default: true }, { key: "label", type: "text", label: "Over the digits", default: DIAL_DEFAULTS.label }, + { key: "placement", type: "enum", options: ["column", "corner"], label: "Where the instruments stand", default: "column" }, + { key: "size", type: "number", min: 200, max: 540, step: 10, label: "The corner dial's size (px at 1920)", default: 340 }, + { key: "motion", type: "enum", options: ["spring", "ease"], label: "The needle's move", default: "spring" }, + { key: "finaleEnd", type: "enum", options: ["odometer", "promise"], label: "The finale's last beat", default: "odometer" }, ], docs: { heading: "Scale dial", @@ -43,6 +47,10 @@ export default defineModule({ ["`deck.dial.needle`", "a #hex · default `#ff5a4e`", "`umtool look <p> deck.dial.needle='\"#ff5a4e\"'`"], ["`deck.dial.label`", "words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS`", "`umtool look <p> deck.dial.label='\"…\"'`"], ["`deck.dial.finale`", "bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`)", "`umtool look <p> deck.dial.finale=false`"], + ["`deck.dial.placement`", "`column` `corner` · default `column`. A VARIANT: `corner` drops the column -- the footage stays where the deck puts it, the dial a `size` square over its lower-right corner, the odometer and the trail (at 4/5 size) stacked in its lower-left; the side panel is allowed there, the feed still refused", "`umtool look <p> deck.dial.placement=corner`"], + ["`deck.dial.size`", "200–540 px at 1920 wide · default `340` (the corner dial only)", "`umtool look <p> deck.dial.size=300`"], + ["`deck.dial.motion`", "`spring` `ease` · default `spring`. A VARIANT: the needle's `back.out` overshoot and settle, or a plain `power2.inOut` (the finale's drop too)", "`umtool look <p> deck.dial.motion=ease`"], + ["`deck.dial.finaleEnd`", "`odometer` `promise` · default `odometer`. A VARIANT: `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`); with no promise module on the cut it ends on the odometer", "`umtool look <p> deck.dial.finaleEnd=promise`"], ], }, region: "dial",