Archilyzer · Source

archilyzer

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

commit 90247e9ac762187c4e7d12285df3e70c459a21af
parent e8a45f98e8b166e0293c411d2757e45b0c84090b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 13:35:59 -0500

measure widgets: an update flash -- a widget's outline lights as its value changes (off by default)

Operator, 11 Nov: "whenever a widget gets updated, have it show a subtle
border flash ... to indicate that at a glance". update-flash.mjs: at the
moment a widget's shown value changes, a thin outline in its own colour
lights over 0.15 s and decays over 0.7 s -- no size change, no layout shift.
The dial on a weight stated or remembered or a goal in force changing; the
odometer on the pounds lost (or its runs) and NET; the trail on each weight
landing; the goal stack on a goal set; the diet tags on a new diet or new
words for it, never the running day count. Widgets that change on one event
flash together. Never before frame 1, never while the deck is away (the
intro, a card), never on a widget's first appearance (the goal stack's and the
diet's first card).

render.chrome.deck.measure.flash (default false) turns it on for all; each
widget's own `flash` (dial, odometer, trail, goals, diet) overrides it, in
the Modules panel beside its siblings. Off, every page is byte for byte what
it was.

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

Diffstat:
Mumtool/docs/knobs.md | 6++++++
Mumtool/report-to-video/chrome-instruments.mjs | 34+++++++++++++++++++++++++++++-----
Mumtool/report-to-video/chrome-measure-extras.mjs | 57+++++++++++++++++++++++++++++++++++++++++++++++++++------
Mumtool/report-to-video/instruments.mjs | 9+++++++++
Mumtool/report-to-video/instruments.test.mjs | 4++--
Mumtool/report-to-video/measure-slice.mjs | 4+++-
Mumtool/report-to-video/modules/dial.mjs | 3+++
Mumtool/report-to-video/modules/diet.mjs | 2++
Mumtool/report-to-video/modules/goals.mjs | 2++
Mumtool/report-to-video/modules/measure-extras-settings.mjs | 12++++++++----
Mumtool/report-to-video/modules/odometer.mjs | 2++
Mumtool/report-to-video/modules/trail.mjs | 2++
Aumtool/report-to-video/update-flash.mjs | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/report-to-video/update-flash.test.mjs | 130+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 files changed, 333 insertions(+), 18 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -2368,6 +2368,7 @@ The diet he names as a rubber stamp in a corner of the footage box (`render.chro | `deck.diet.overlap` | 0–0.8, the share of each older tag hidden behind the one in front · default 0 (side by side, the slam and the dim). Above 0 the tags FAN sideways the way the goal stack's notes pile: the newest in front at the left, landing from above like a goal note, each older one a place to the right behind it with its own small turn, keeping its colours (the depth is the overlap and the shadow), showing its regime word and date in the strip beside the one in front; the one past `tags` slides off the back. The fan is narrower by what hides. An older tag's word and date need 110 design px of it, so it is refused past 0.5 (0.63 with `days`) | `umtool look <p> deck.diet.overlap=0.5` | | `deck.diet.days` | `true` · `false`: the front tag's running count of days on its diet (to the in-record date at the playhead, the streak chain's "Day N"), in a column of its own -- the tag 300 design px wide · default `false` | `umtool look <p> deck.diet.days=true` | | `deck.diet.colors`, `.labels` | `{<regime>: #hex}` · `{<regime>: words ≤40}` · default the regimes' inks and names | `umtool look <p> deck.diet.labels='{"glp1":"Ozempic"}'` | +| `deck.diet.flash` | bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): with `form: "tags"`: the new front tag lights, in its ink, at a new diet or new words for it -- never the running day count, never the first tag; the stamp form does not flash; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away | `umtool look <p> deck.diet.flash=false` | | `deck.diet.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.diet.onPosts=hide` | | `deck.diet.position=shelf` | in its own slot on the shelf (`deck.shelf`: under or over the footage), scaled to the shelf's height, left to right in `deck.shelf.items` order -- nothing covers it there, so it never dodges (`onPosts`, `onChapters`, `x`/`y`, `scale` and `avoid` do not apply), and it is over the finale as the shelf is (`deck.shelf.finale`) | `umtool look <p> deck.shelf=true deck.diet.position=shelf` | | a timeline entry's `hideModules` | `["diet", …]` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too | `umtool set <p> <entry> hideModules=diet` (`--take <t>` for a take) | @@ -2398,6 +2399,7 @@ A sticky note per goal on a pile in a corner of the footage box, read off the sc | `deck.goals.max`, `.color`, `.countdown` | 1–8 notes · #hex paper · bool · default 4, the palette's amber, `true` | `umtool look <p> deck.goals.max=6` | | `deck.goals.base` | bool · default `false`: each note also says the weight he had stated when he set the goal -- "LOSE 100 (FROM 346.7)", its qualifier kept ("(FROM ≈390)") -- the slice's own base for that goal, the one the gauge reckons its target from (measure-slice.mjs `goalBase`: the start of the run open when he set it, else the latest weight he gave by the goal's date, stated or remembered). A goal with no base (no weight by then, a target goal such as "250 LB", a base the scale's foot refuses) shows none -- never one made up. On a back card it is a line of its own, right-aligned like the label | `umtool look <p> deck.goals.base=true` | | `deck.goals.hold`, `.finale` | 0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide` | `umtool look <p> deck.goals.hold=0` | +| `deck.goals.flash` | bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the note that lands lights as a goal is set -- not the first note (the stack coming up), not the board's own changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away | `umtool look <p> deck.goals.flash=false` | | `deck.goals.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.goals.onPosts=hide` | | `deck.goals.position=shelf` | in its own slot on the shelf (`deck.shelf`: under or over the footage), scaled to the shelf's height, left to right in `deck.shelf.items` order -- nothing covers it there, so it never dodges (`onPosts`, `onChapters`, `x`/`y`, `scale` and `avoid` do not apply), and it is over the finale as the shelf is (`deck.shelf.finale`) | `umtool look <p> deck.shelf=true deck.goals.position=shelf` | | a timeline entry's `hideModules` | `["goals", …]` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too | `umtool set <p> <entry> hideModules=goals` (`--take <t>` for a take) | @@ -2420,6 +2422,7 @@ A bathroom-scale face at the top of the instruments' column (the right of the fr | `deck.dial.mark` | a weight, or `null` · default `300` (its tick and label in the accent) | `umtool look <p> deck.dial.mark=300` | | `deck.dial.ghosts`, `.goal` | bool · default `true` each (`.goal`: every goal in force, the closest headlined) | `umtool look <p> deck.dial.ghosts=false` | | `deck.measure.ghosts` | `true` · `{opacity, tolerance, ramp, pulse}` · `false` / absent: off (the default). CLAIM GHOSTS (measure-ghosts.mjs), not `deck.dial.ghosts`: every weight he has claimed so far -- each stated weight the needle goes to and each remembered one, his own, in cut order -- leaves a thin faint tick across the dial's rim at its value, under everything else on the face; a value claimed again (within `tolerance` lb of the tick's first value; an `≈` value as its rounded number; `>300` and `<300` at 300) steps that tick along the `ramp` -- 1× faint, 2× warm, 3× and up hot, a little thicker each step -- and it pulses once as the repeat lands (`pulse`). In the finale every tick stays at its count at the cut's end. Seek-safe: a frame at t draws the claims before t | `umtool look <p> deck.measure.ghosts=true` | +| `deck.measure.flash` | bool · default `false` (off: every cut renders as before) -- THE UPDATE FLASH for every measure widget at once (update-flash.mjs): at the moment a widget's shown value changes its outline lights in its own colour and decays (0.15 s up, 0.7 s down) -- the dial on a weight stated or remembered or a goal change, the odometer on the pounds lost or NET, the trail on each weight landing, the goal stack on a goal set, the diet tags on a new diet; widgets that change on one event flash together; never on frame 0, while the deck is away (the intro, a card) or on a widget's first appearance. A widget's own `flash` overrides it | `umtool look <p> deck.measure.flash=true` | | `deck.measure.ghosts.opacity`, `.tolerance` | 0.15–0.9 (the 1× tick's; +0.2 a step, at most 0.95) · 0–5 lb · default `0.5`, `0.5` | `umtool look <p> deck.measure.ghosts='{"tolerance":1}'` | | `deck.measure.ghosts.ramp`, `.pulse` | 2–4 #hex, 1× first (the last for every count from there up), or `null`: the palette's muted, amber, and amber half way to the needle's red · bool · default `null`, `true` | `umtool look <p> deck.measure.ghosts='{"ramp":["#98a29b","#e8a33f","#f37e47"],"pulse":false}'` | | `deck.dial.needle` | a #hex · default `#ff5a4e` | `umtool look <p> deck.dial.needle='"#ff5a4e"'` | @@ -2430,6 +2433,7 @@ A bathroom-scale face at the top of the instruments' column (the right of the fr | `deck.dial.corner` | `bottom-right` `bottom-left` `top-right` `top-left` · default `bottom-right` (the corner only): the dial in that corner, the odometer and the trail up the same side. The measure extras stand at their own anchors in the footage (goals bottom-right, peak top-right, promise top-centre, diet bottom-left, streak bottom-centre): a corner instrument over one that is on is REFUSED by the build, naming it -- move one (`deck.goals.position`, …) or the corner; `top-left` is clear of all five | `umtool look <p> deck.dial.corner=top-left` | | `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` | `auto` `odometer` `promise` · default `auto` (`promise` when a promise is on camera, else `odometer`): `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`) and the clock takes their place in the finale's lower column, clear of the rail; with no promise module on the cut it ends on the odometer | `umtool look <p> deck.dial.finaleEnd=promise` | +| `deck.dial.flash` | bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the bezel lights as a weight is stated or remembered, or the goal in force changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away | `umtool look <p> deck.dial.flash=false` | ### Lost odometer @@ -2440,6 +2444,7 @@ Under the dial: the measure's `state.lost.total` (the highest real-time loss cla | `deck.odometer` | `true` · an object of the knobs below · `false` off · absent: ON when the cut draws a measure (`deck.measure` set), else off | `umtool look <p> deck.odometer=false` | | `deck.odometer.label` | words over the wheels, ≤ 40 · default `POUNDS HE SAYS HE'S LOST` | `umtool look <p> deck.odometer.label='"…"'` | | `deck.odometer.net`, `.runs` | bool · default `true` each | `umtool look <p> deck.odometer.net=false` | +| `deck.odometer.flash` | bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the card lights as the pounds lost go up (or the runs change) and as NET changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away | `umtool look <p> deck.odometer.flash=false` | ### Weight trail @@ -2454,6 +2459,7 @@ At the foot of the instruments' column: every weight the cut shows -- the STATED | `deck.trail.bounds` | `fit` · `fixed` · default `fit`: the axes fit the weights said so far and reflow as each lands; `fixed` lays every moment on the axes of all the cut's weights | `umtool look <p> deck.trail.bounds=fixed` | | `deck.trail.remembered` | bool · default `true`: his remembered weights are points too, hollow and grey, not joined into the line | `umtool look <p> deck.trail.remembered=false` | | `deck.trail.gap` | `auto` · days 30–3650 · `0` none · default `auto`: a stretch with no statement longer than a year (or 8× the median spacing, if longer) is a break in the time axis | `umtool look <p> deck.trail.gap=540` | +| `deck.trail.flash` | bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the card lights as each weight lands on it; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away | `umtool look <p> deck.trail.flash=false` | ### Flips diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs @@ -20,6 +20,7 @@ import { finaleLayout } from "./chrome-finale.mjs"; import { FINALE_MOTION } from "./finale.mjs"; import { resolveDial, resolveOdometer, resolveTrail } from "./instruments.mjs"; import { TRAIL_REFLOW, trailLayout, trailPoints, trailStates } from "./trail-plan.mjs"; +import { deckAwaySpans, flashCss, flashCues, flashOn, flashTimes } from "./update-flash.mjs"; import { promiseStates, upSpans } from "./measure-extras.mjs"; import { ghostOpacity, ghostRamp, ghostTicks, resolveGhosts } from "./measure-ghosts.mjs"; import { goalBoard, goalsAt } from "./measure-goals.mjs"; @@ -584,12 +585,22 @@ export function dialHtml(schedule, render, opts = {}) { const L = cueList(fps); withDeck(L, schedule, render, "rt"); dialCues(L, { track, scale: M.scale, cfg, marks, lines, ghosts }); + // THE UPDATE FLASH (update-flash.mjs): the bezel lights as a weight is stated or remembered, or the goal changes. + let flash = { html: "", css: "" }; + if (flashOn(render, cfg.flash)) { + const times = [...track.current.slice(1), ...track.remembered, ...track.goals.slice(1)].map((x) => x.t); + flashCues(L, "fl", flashTimes(times, { fps, away: deckAwaySpans(schedule, render) })); + flash = { + html: `<div class="flw" style="left:${Math.floor((W - size) / 2)}px; top:${Math.floor((H - size) / 2)}px; width:${size}px; height:${size}px"><div class="fl" data-k="fl"></div></div>`, + css: `\n .flw { position: absolute; }\n ${flashCss(".flw .fl", colors.accent, { radius: "50%", width: 3 })}`, + }; + } const { init, cues } = L.build(); return pageHtml({ id: "dial", W, H, fps, fonts, gsap: opts.gsap, data: { total: r4(schedule.total), window: windowOf(schedule, opts, "dial"), init, cues }, - css: `#rt { position: absolute; inset: 0; }${parts.css}`, - body: `<div id="rt" data-k="rt">${parts.html}</div>`, + css: `#rt { position: absolute; inset: 0; }${parts.css}${flash.css}`, + body: `<div id="rt" data-k="rt">${parts.html}${flash.html}</div>`, }); } @@ -683,12 +694,19 @@ export function odometerHtml(schedule, render, opts = {}) { }); if (cfg.runs) blocks(L, track.lost, "rn"); if (cfg.net) blocks(L, track.net, "nt"); + // THE UPDATE FLASH (update-flash.mjs): the card lights as the pounds lost go up, its runs or NET change. + let flash = { html: "", css: "" }; + if (flashOn(render, cfg.flash)) { + const times = [...track.lost.slice(1), ...(cfg.net ? track.net.slice(1) : [])].map((x) => x.t); + flashCues(L, "fl", flashTimes(times, { fps, away: deckAwaySpans(schedule, render) })); + flash = { html: `<div class="fl" data-k="fl"></div>`, css: `\n ${flashCss("#rt > .fl", colors.accent, { radius: `${Math.round(10 * u * 100) / 100}px`, width: 2 })}` }; + } const { init, cues } = L.build(); return pageHtml({ id: "odometer", W, H, fps, fonts, gsap: opts.gsap, data: { total: r4(schedule.total), window: windowOf(schedule, opts, "odometer"), init, cues }, - css: `#rt { position: absolute; inset: 0; }${parts.css}`, - body: `<div id="rt" data-k="rt">${parts.html}</div>`, + css: `#rt { position: absolute; inset: 0; }${parts.css}${flash.css}`, + body: `<div id="rt" data-k="rt">${parts.html}${flash.html}</div>`, }); } @@ -840,10 +858,16 @@ export function trailHtml(schedule, render, opts = {}) { if (sp.out < schedule.total - 0.05) L.add("ty", sp.out, 0.4, { autoAlpha: 1 }, "power1.out"); } L.set("ty", { autoAlpha: 1 }); + // THE UPDATE FLASH (update-flash.mjs): the card lights as each weight lands on it. + const flashing = flashOn(render, cfg.flash); + if (flashing) { + flashCues(L, "fl", flashTimes(states.map((st) => st.at), { fps, away: deckAwaySpans(schedule, render) })); + parts.push(`<div class="fl" data-k="fl"></div>`); + } const { init, cues } = L.build(); const css = ` #rt { position: absolute; inset: 0; } - .ty { position: absolute; inset: 0; } + .ty { position: absolute; inset: 0; }${flashing ? `\n ${flashCss(".trail .fl", colors.accent, { radius: `${px(10)}px`, width: 2 })}` : ""} .trail { position: absolute; inset: 0; border-radius: ${px(10)}px; background: ${colors.card}; overflow: hidden; } .trail .lab { position: absolute; left: ${px(14)}px; top: ${px(10)}px; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(14)}px; letter-spacing: 0.12em; color: ${colors.muted}; white-space: nowrap; } diff --git a/umtool/report-to-video/chrome-measure-extras.mjs b/umtool/report-to-video/chrome-measure-extras.mjs @@ -22,6 +22,7 @@ import { import { dietTagWidth, MEASURE_RED, resolveMeasureExtra, SHELF_POSITION } from "./modules/measure-extras-settings.mjs"; import { dialFinaleGeometry, dialFinaleHandoff } from "./chrome-instruments.mjs"; import { goalBoard, goalsAt } from "./measure-goals.mjs"; +import { deckAwaySpans, flashCss, flashEvents, flashOn, flashTimes } from "./update-flash.mjs"; /** How each module's panel comes in and goes out, s. */ export const MEASURE_FADE = Object.freeze({ in: 0.35, out: 0.4 }); @@ -203,9 +204,19 @@ export function goalsHtml(schedule, render, opts = {}) { const paper = cfg.color ?? pal.amber ?? "#E8A33F"; const spans = upSpans(states.map((s) => s.at), cfg, schedule); const items = []; + // THE UPDATE FLASH (update-flash.mjs): a goal set lights the note that lands -- not the first, the stack's entrance. + const flashing = flashOn(render, cfg.flash); + const away = flashing ? deckAwaySpans(schedule, render) : []; const { init, cues } = stateCues(states, spans, { own: (st, j, init) => { const ev = []; + if (flashing && j > 0) { + const top = st.notes.find((n) => n.key === st.top); + if (top) { + init[`s${j}.${top.id}.fl`] = { opacity: 0 }; + ev.push(...flashEvents(`s${j}.${top.id}.fl`, flashTimes([st.at], { fps: F.fps, away }))); + } + } for (const n of st.notes) { const k = `s${j}.${n.id}`; const to = notePlace(n, n.depth, px, H); @@ -237,7 +248,8 @@ export function goalsHtml(schedule, render, opts = {}) { const count = n.count > 1 ? `<div class="ct" data-k="${k}c">×${n.count}</div>` : ""; const shade = n.depth ? `<div class="sh" style="opacity:${r4(Math.min(0.5, 0.14 * n.depth))}"></div>` : ""; const fr = n.base ? `<div class="fr">${esc(n.base)}</div>` : ""; - return `<div class="note${dl ? " due" : ""}${fr ? " based" : ""}" data-k="${k}" style="z-index:${20 - n.depth}"><div class="tape"></div><div class="nh">Goal${n.date ? ` · ${esc(monthYear(n.date))}` : ""}</div><div class="nt">${esc(n.text)}</div>${fr}${dl}${count}${shade}</div>`; + const fl = flashing && j > 0 && n.key === st.top ? `<div class="fl" data-k="${k}.fl"></div>` : ""; + return `<div class="note${dl ? " due" : ""}${fr ? " based" : ""}" data-k="${k}" style="z-index:${20 - n.depth}"><div class="tape"></div><div class="nh">Goal${n.date ? ` · ${esc(monthYear(n.date))}` : ""}</div><div class="nt">${esc(n.text)}</div>${fr}${dl}${count}${shade}${fl}</div>`; }).join(""); const html = `<div class="st" data-k="s${j}">${notes}<div class="hd"><span class="hn">${st.goalsSet}</span> goal${st.goalsSet === 1 ? "" : "s"} set</div></div>`; items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html }); @@ -270,7 +282,8 @@ export function goalsHtml(schedule, render, opts = {}) { .hd { position: absolute; left: ${px(10)}px; bottom: ${px(4)}px; height: ${px(32)}px; padding: 0 ${px(14)}px; border-radius: ${px(16)}px; background: ${rgba(pal.bg, 0.88)}; color: ${pal.muted}; font-family: 'DeckSansBold', sans-serif; font-size: ${px(17)}px; line-height: ${px(32)}px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; } - .hn { color: ${paper}; font-family: ${DISPLAY}; font-size: ${px(22)}px; letter-spacing: 0.02em; }`; + .hn { color: ${paper}; font-family: ${DISPLAY}; font-size: ${px(22)}px; letter-spacing: 0.02em; }${flashing ? ` + ${flashCss(".note .fl", paper, { radius: `${px(5)}px`, width: Math.max(2, Math.round(px(3))), inset: `-${px(5)}px` })}` : ""}`; const body = `<div id="pn" data-k="pn"> ${blocks.join("\n ")} </div>`; @@ -323,9 +336,22 @@ function goalsShelfHtml(schedule, render, opts, cfg, states) { // THE ORDER ON THE SHELF is the dial's (shelfGoalStates): the goal board's headline -- the closest goal in force -- // in front with "+N more" for the others in force, the rest by how recently he set them, a missed goal struck. const shelfStates = shelfGoalStates(schedule, states); + // THE UPDATE FLASH (update-flash.mjs): a goal set lights the note that lands -- not the first, the shelf's entrance. + const flashing = flashOn(render, cfg.flash); + const away = flashing ? deckAwaySpans(schedule, render) : []; + const flashKey = (st, j) => { + if (!flashing || j === 0 || !st.top) return null; + const top = st.notes.find((n) => n.key === st.top); + return top ? `s${j}.${top.id}.fl` : null; + }; const { init, cues } = stateCues(shelfStates, spans, { own: (st, j, init) => { const ev = []; + const fk = flashKey(st, j); + if (fk) { + init[fk] = { opacity: 0 }; + ev.push(...flashEvents(fk, flashTimes([st.at], { fps: F.fps, away }))); + } for (const n of st.notes) { const k = `s${j}.${n.id}`; const to = place(n, n.depth); @@ -377,7 +403,8 @@ function goalsShelfHtml(schedule, render, opts, cfg, states) { : ""; // Missed (the board's, held as the dial holds it): struck in red, MISSED on it. const miss = st.missed?.includes(n.key) ? `<div class="mx"></div><div class="ms">Missed</div>` : ""; - return `<div class="note${miss ? " missed" : ""}" data-k="${k}" style="z-index:${20 - n.depth}"><div class="tape"></div>${face}${back}${count}${more}${miss}</div>`; + const fl = flashKey(st, j) === `${k}.fl` ? `<div class="fl" data-k="${k}.fl"></div>` : ""; + return `<div class="note${miss ? " missed" : ""}" data-k="${k}" style="z-index:${20 - n.depth}"><div class="tape"></div>${face}${back}${count}${more}${miss}${fl}</div>`; }).join(""); const html = `<div class="st" data-k="s${j}"><div class="gc"><div class="gn" data-k="s${j}.c">${st.goalsSet}</div><div class="gl">goal${st.goalsSet === 1 ? "" : "s"} set</div></div>${notes}</div>`; items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html }); @@ -419,7 +446,8 @@ function goalsShelfHtml(schedule, render, opts, cfg, states) { letter-spacing: 0.1em; text-transform: uppercase; } .ct { position: absolute; right: ${px(8)}px; top: ${px(5)}px; min-width: ${px(40)}px; height: ${px(24)}px; padding: 0 ${px(7)}px; border-radius: ${px(12)}px; background: #2a1c06; color: ${paper}; text-align: center; - font-family: ${DISPLAY}; font-size: ${px(19)}px; line-height: ${px(24)}px; }`; + font-family: ${DISPLAY}; font-size: ${px(19)}px; line-height: ${px(24)}px; }${flashing ? ` + ${flashCss(".note .fl", paper, { radius: `${px(4)}px`, width: Math.max(2, Math.round(px(3))), inset: `-${px(4)}px` })}` : ""}`; const body = `<div id="pn" data-k="pn"> ${blocks.join("\n ")} </div>`; @@ -1019,6 +1047,21 @@ function dietTagsHtml(schedule, render, opts, cfg, states) { dayBlocks.get(r.card).push(`<div class="dy" data-k="${k}"><div class="dyn">${r.days}</div><div class="dyl">day${r.days === 1 ? "" : "s"}</div></div>`); }); } + // THE UPDATE FLASH (update-flash.mjs): a new diet -- a new front tag, or new words for it -- lights that tag in its + // ink; never the running day count, never the first tag (the badge's entrance). + const flashing = flashOn(render, cfg.flash); + const flashed = new Set(); + if (flashing) { + const away = deckAwaySpans(schedule, render); + states.forEach((st, j) => { + const front = st.tags[0]?.id; + if (!j || front === undefined || front === states[j - 1].tags[0]?.id) return; + const k = `t${front}.fl`; + init[k] = { opacity: 0 }; + flashed.add(front); + ev.push(...flashEvents(k, flashTimes([st.at], { fps: F.fps, away }))); + }); + } const { cues } = compileCues(init, ev); const items = []; const room = DIET_TAG.width - 44; @@ -1041,14 +1084,16 @@ function dietTagsHtml(schedule, render, opts, cfg, states) { ? `<div class="bk" data-k="${k}.b"><div class="bl" style="font-size:${px(Math.min(32, tagWordSize(label, step - 30)))}px">${esc(label)}</div>${date ? `<div class="bd">${esc(date)}</div>` : ""}</div>` : ""; const html = `<div class="tg" data-k="${k}"${fan ? ` style="z-index:${10 + t.id}"` : ""}><div class="dm" data-k="${k}.d"><div class="sw" data-k="${k}.w"><div class="sp${d ? "" : " off"}" data-k="${k}.s">` + - `<div class="ink" style="color:${ink};border-color:${ink}"><div class="fr"${fan ? ` data-k="${k}.f"` : ""}>${face}</div>${back}</div></div></div></div></div>`; + `<div class="ink" style="color:${ink};border-color:${ink}"><div class="fr"${fan ? ` data-k="${k}.f"` : ""}>${face}</div>${back}</div>` + + `${flashed.has(t.id) ? `<div class="fl" data-k="${k}.fl" style="color:${ink}"></div>` : ""}</div></div></div></div>`; items.push({ key: k, gate: [k, "autoAlpha"], html }); return html; }); const css = ` #pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; } .tg { position: absolute; left: 0; top: 0; width: ${px(W)}px; height: ${px(DIET_TAG.height)}px; visibility: hidden; opacity: 0;${fan ? " transform-origin: 30% 60%;" : ""} } - .dm, .sw { position: absolute; inset: 0; } + .dm, .sw { position: absolute; inset: 0; }${flashing ? ` + ${flashCss(".sp > .fl", "currentColor", { radius: `${px(9)}px`, width: Math.max(2, Math.round(px(3))), inset: `-${px(2)}px` })}` : ""} /* A tag: the stamp's plate and pressed ink, small. The plate is solid; only the ink is pressed. */ .sp { position: absolute; left: ${px(4)}px; top: ${px(4)}px; right: ${px(4)}px; bottom: ${px(4)}px; border-radius: ${px(8)}px; background: ${rgba(pal.bg, fan ? 0.97 : 0.93)}; padding: ${px(4)}px; diff --git a/umtool/report-to-video/instruments.mjs b/umtool/report-to-video/instruments.mjs @@ -66,6 +66,8 @@ export const DIAL_DEFAULTS = Object.freeze({ // "auto" (the default): "promise" when a promise is on camera, else "odometer" -- // the contract's finale: the dial drops, the odometer rolls, NET holds, THEN the promise clock. finaleEnd: "auto", + // The update flash (update-flash.mjs): null follows render.chrome.deck.measure.flash; true/false for this one. + flash: null, }); export const DIAL_PLACEMENTS = Object.freeze(["column", "corner"]); @@ -81,6 +83,8 @@ export const ODOMETER_DEFAULTS = Object.freeze({ net: true, // "ACROSS 8 RUNS" under the wheels. runs: true, + // The update flash (update-flash.mjs): null follows render.chrome.deck.measure.flash; true/false for this one. + flash: null, }); export const TRAIL_DEFAULTS = Object.freeze({ @@ -96,6 +100,8 @@ export const TRAIL_DEFAULTS = Object.freeze({ // A stretch with no statement longer than this many days is a break in the time axis, not a line across it: // "auto" (a year, or 8× the median spacing if that is longer), a number of days (30–3650), or 0 for none. gap: "auto", + // The update flash (update-flash.mjs): null follows render.chrome.deck.measure.flash; true/false for this one. + flash: null, }); /** A label's characters at most. */ @@ -182,6 +188,7 @@ export function validateDial(v, where = "render.chrome.deck.dial") { 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]}`); } + if (obj.flash !== undefined && obj.flash !== null) { const p = boolProblem(obj.flash, `${where}.flash`); if (p) errors.push(p); } return errors; } @@ -191,6 +198,7 @@ export function validateOdometer(v, where = "render.chrome.deck.odometer") { if (!obj) return errors; for (const k of ["net", "runs"]) if (obj[k] !== undefined) { const p = boolProblem(obj[k], `${where}.${k}`); if (p) errors.push(p); } if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); } + if (obj.flash !== undefined && obj.flash !== null) { const p = boolProblem(obj.flash, `${where}.flash`); if (p) errors.push(p); } return errors; } @@ -204,5 +212,6 @@ export function validateTrail(v, where = "render.chrome.deck.trail") { if (obj.remembered !== undefined) { const p = boolProblem(obj.remembered, `${where}.remembered`); if (p) errors.push(p); } if (obj.bounds !== undefined && !["fit", "fixed"].includes(obj.bounds)) errors.push(`${where}.bounds must be "fit" or "fixed"`); if (obj.gap !== undefined && !(obj.gap === "auto" || obj.gap === 0 || numIn(obj.gap, 30, 3650))) errors.push(`${where}.gap must be "auto", 0 (no breaks) or 30 to 3650 days`); + if (obj.flash !== undefined && obj.flash !== null) { const p = boolProblem(obj.flash, `${where}.flash`); if (p) errors.push(p); } return errors; } diff --git a/umtool/report-to-video/instruments.test.mjs b/umtool/report-to-video/instruments.test.mjs @@ -112,14 +112,14 @@ test("the instruments' settings: true, an object of known keys, or off; the side 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", placement: "column", size: 340, corner: "bottom-right", motion: "spring", finaleEnd: "auto", + mark: 300, ghosts: true, goal: true, needle: "#ff5a4e", finale: true, label: "HE SAYS HE WEIGHS", placement: "column", size: 340, corner: "bottom-right", motion: "spring", finaleEnd: "auto", flash: null, }); 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 "auto" or "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, placement, size, corner, motion, finaleEnd)"]); + 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, corner, motion, finaleEnd, flash)"]); }); // --------------------------------------------------------------------------- diff --git a/umtool/report-to-video/measure-slice.mjs b/umtool/report-to-video/measure-slice.mjs @@ -33,7 +33,7 @@ export const MEASURE_SLICE_VERSION = 1; export { PROMISE_FORMS }; /** `render.chrome.deck.measure`'s keys. */ -export const MEASURE_SETTINGS_KEYS = Object.freeze(["scopes", "scale", "asOf", "ghosts"]); +export const MEASURE_SETTINGS_KEYS = Object.freeze(["scopes", "scale", "asOf", "ghosts", "flash"]); const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); const isIso = (v) => typeof v === "string" && /^\d{4}-\d{2}-\d{2}$/.test(v) && !Number.isNaN(Date.parse(`${v}T00:00:00Z`)); @@ -66,6 +66,8 @@ export function validateMeasureSettings(v, where = "render.chrome.deck.measure") else for (const k of Object.keys(s)) if (k !== "min" && k !== "max") errors.push(`${where}.scale.${k} is not a scale setting (min, max)`); } if (v.asOf !== undefined && !isIso(v.asOf)) errors.push(`${where}.asOf must be a date (YYYY-MM-DD)`); + // The update flash (update-flash.mjs): every measure widget's outline lights as its value changes. + if (v.flash !== undefined && typeof v.flash !== "boolean") errors.push(`${where}.flash must be true or false`); errors.push(...validateGhosts(v.ghosts, `${where}.ghosts`)); return errors; } diff --git a/umtool/report-to-video/modules/dial.mjs b/umtool/report-to-video/modules/dial.mjs @@ -43,6 +43,7 @@ export default defineModule({ { key: "corner", type: "enum", options: ["bottom-right", "bottom-left", "top-right", "top-left"], label: "The corner", default: "bottom-right" }, { key: "motion", type: "enum", options: ["spring", "ease"], label: "The needle's move", default: "spring" }, { key: "finaleEnd", type: "enum", options: ["auto", "odometer", "promise"], label: "The finale's last beat", default: "auto" }, + { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { heading: "Scale dial", @@ -52,6 +53,7 @@ export default defineModule({ ["`deck.dial.mark`", "a weight, or `null` · default `300` (its tick and label in the accent)", "`umtool look <p> deck.dial.mark=300`"], ["`deck.dial.ghosts`, `.goal`", "bool · default `true` each (`.goal`: every goal in force, the closest headlined)", "`umtool look <p> deck.dial.ghosts=false`"], ["`deck.measure.ghosts`", "`true` · `{opacity, tolerance, ramp, pulse}` · `false` / absent: off (the default). CLAIM GHOSTS (measure-ghosts.mjs), not `deck.dial.ghosts`: every weight he has claimed so far -- each stated weight the needle goes to and each remembered one, his own, in cut order -- leaves a thin faint tick across the dial's rim at its value, under everything else on the face; a value claimed again (within `tolerance` lb of the tick's first value; an `≈` value as its rounded number; `>300` and `<300` at 300) steps that tick along the `ramp` -- 1× faint, 2× warm, 3× and up hot, a little thicker each step -- and it pulses once as the repeat lands (`pulse`). In the finale every tick stays at its count at the cut's end. Seek-safe: a frame at t draws the claims before t", "`umtool look <p> deck.measure.ghosts=true`"], + ["`deck.measure.flash`", "bool · default `false` (off: every cut renders as before) -- THE UPDATE FLASH for every measure widget at once (update-flash.mjs): at the moment a widget's shown value changes its outline lights in its own colour and decays (0.15 s up, 0.7 s down) -- the dial on a weight stated or remembered or a goal change, the odometer on the pounds lost or NET, the trail on each weight landing, the goal stack on a goal set, the diet tags on a new diet; widgets that change on one event flash together; never on frame 0, while the deck is away (the intro, a card) or on a widget's first appearance. A widget's own `flash` overrides it", "`umtool look <p> deck.measure.flash=true`"], ["`deck.measure.ghosts.opacity`, `.tolerance`", "0.15–0.9 (the 1× tick's; +0.2 a step, at most 0.95) · 0–5 lb · default `0.5`, `0.5`", "`umtool look <p> deck.measure.ghosts='{\"tolerance\":1}'`"], ["`deck.measure.ghosts.ramp`, `.pulse`", "2–4 #hex, 1× first (the last for every count from there up), or `null`: the palette's muted, amber, and amber half way to the needle's red · bool · default `null`, `true`", "`umtool look <p> deck.measure.ghosts='{\"ramp\":[\"#98a29b\",\"#e8a33f\",\"#f37e47\"],\"pulse\":false}'`"], ["`deck.dial.needle`", "a #hex · default `#ff5a4e`", "`umtool look <p> deck.dial.needle='\"#ff5a4e\"'`"], @@ -62,6 +64,7 @@ export default defineModule({ ["`deck.dial.corner`", "`bottom-right` `bottom-left` `top-right` `top-left` · default `bottom-right` (the corner only): the dial in that corner, the odometer and the trail up the same side. The measure extras stand at their own anchors in the footage (goals bottom-right, peak top-right, promise top-centre, diet bottom-left, streak bottom-centre): a corner instrument over one that is on is REFUSED by the build, naming it -- move one (`deck.goals.position`, …) or the corner; `top-left` is clear of all five", "`umtool look <p> deck.dial.corner=top-left`"], ["`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`", "`auto` `odometer` `promise` · default `auto` (`promise` when a promise is on camera, else `odometer`): `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`) and the clock takes their place in the finale's lower column, clear of the rail; with no promise module on the cut it ends on the odometer", "`umtool look <p> deck.dial.finaleEnd=promise`"], + ["`deck.dial.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the bezel lights as a weight is stated or remembered, or the goal in force changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look <p> deck.dial.flash=false`"], ], }, region: "dial", diff --git a/umtool/report-to-video/modules/diet.mjs b/umtool/report-to-video/modules/diet.mjs @@ -25,6 +25,7 @@ export default measureExtraModule({ { key: "tags", type: "number", min: DIET_TAGS[0], max: DIET_TAGS[1], step: 1, label: "Tags in the row", default: 3, when: { form: "tags" } }, { key: "overlap", type: "number", min: DIET_OVERLAP[0], max: DIET_OVERLAP[1], step: 0.05, label: "Overlap (0: side by side; the share of each older tag behind the one in front)", default: 0, when: { form: "tags" } }, { key: "days", type: "boolean", label: "Days on the diet, on the front tag", default: false, when: { form: "tags" } }, + { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { intro: "The diet he names as a rubber stamp in a corner of the footage box (`render.chrome.deck.diet`, measure-extras.mjs): at each change of the state's diet -- its regime or its diet number -- a new stamp slams on (in big and turned, onto the page, a shake), the regime's word in its ink and \"DIET #n\" under it with the ledger's words when they say more (\"Keto · 5 carbs a day\"); a change of words alone fades the new stamp in. A null diet after one fades to \"NO DIET\" in grey. It draws `state.diet` as the measure slice gives it -- the off-scope rule (\"off GLP-1\" while on keto is still keto) is the ledger's. The inks default to the quartering-diet regimes' (keto #E0913C, carnivore #C9534B, fasting #4E9BD8, calories #3FA9A0, glp1 #B168C6, other #8E97A8, off #98A29B).", @@ -36,6 +37,7 @@ export default measureExtraModule({ ["`deck.diet.overlap`", `${DIET_OVERLAP[0]}–${DIET_OVERLAP[1]}, the share of each older tag hidden behind the one in front · default 0 (side by side, the slam and the dim). Above 0 the tags FAN sideways the way the goal stack's notes pile: the newest in front at the left, landing from above like a goal note, each older one a place to the right behind it with its own small turn, keeping its colours (the depth is the overlap and the shadow), showing its regime word and date in the strip beside the one in front; the one past \`tags\` slides off the back. The fan is narrower by what hides. An older tag's word and date need ${DIET_BACK_MIN} design px of it, so it is refused past ${dietOverlapMax(false)} (${dietOverlapMax(true)} with \`days\`)`, "`umtool look <p> deck.diet.overlap=0.5`"], ["`deck.diet.days`", "`true` · `false`: the front tag's running count of days on its diet (to the in-record date at the playhead, the streak chain's \"Day N\"), in a column of its own -- the tag 300 design px wide · default `false`", "`umtool look <p> deck.diet.days=true`"], ["`deck.diet.colors`, `.labels`", "`{<regime>: #hex}` · `{<regime>: words ≤40}` · default the regimes' inks and names", "`umtool look <p> deck.diet.labels='{\"glp1\":\"Ozempic\"}'`"], + ["`deck.diet.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): with `form: \"tags\"`: the new front tag lights, in its ink, at a new diet or new words for it -- never the running day count, never the first tag; the stamp form does not flash; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look <p> deck.diet.flash=false`"], ], }, }); diff --git a/umtool/report-to-video/modules/goals.mjs b/umtool/report-to-video/modules/goals.mjs @@ -23,6 +23,7 @@ export default measureExtraModule({ { key: "color", type: "color", label: "Paper (default the palette's amber)" }, { key: "countdown", type: "boolean", label: "Count a deadline down to the render date", default: true }, { key: "base", type: "boolean", label: "Say the weight he had stated when he set it", default: false }, + { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { intro: "A sticky note per goal on a pile in a corner of the footage box, read off the schedule's `measure` slice (`render.chrome.deck.goals`, measure-extras.mjs): each goal or goalLoss event drops one, turned a little, onto the pile; the same goal in the same words (\"lose 100\") merges into its note with a count (\"×8\") and comes to the front; `max` notes show, the newest in front, with the goals set so far under them. A goal with a `deadline` counts down to `measure.asOfRender` (\"by Christmas · 50 days left · needs 226.5\"): Christmas is the next 25 Dec from the day he said it, \"next year\" a year on, a named year that year; words that name no date (\"by my birthday\") keep their label and no countdown. On whenever the cut has a measure slice with a goal on camera; `false` turns it off. Up for `hold` seconds after each goal (default 20), the pile as it stands each time. The four measure extras sit at anchors of the footage box by default, clear of the instrument panel's right column and of the top-left, where the streams' face cam most often is (the diet badge bottom-left, the goal stack bottom-right, the moving start top-right, the promise clock top-centre); `position` or `x`/`y` move one.", @@ -33,6 +34,7 @@ export default measureExtraModule({ ["`deck.goals.max`, `.color`, `.countdown`", "1–8 notes · #hex paper · bool · default 4, the palette's amber, `true`", "`umtool look <p> deck.goals.max=6`"], ["`deck.goals.base`", "bool · default `false`: each note also says the weight he had stated when he set the goal -- \"LOSE 100 (FROM 346.7)\", its qualifier kept (\"(FROM ≈390)\") -- the slice's own base for that goal, the one the gauge reckons its target from (measure-slice.mjs `goalBase`: the start of the run open when he set it, else the latest weight he gave by the goal's date, stated or remembered). A goal with no base (no weight by then, a target goal such as \"250 LB\", a base the scale's foot refuses) shows none -- never one made up. On a back card it is a line of its own, right-aligned like the label", "`umtool look <p> deck.goals.base=true`"], ["`deck.goals.hold`, `.finale`", "0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide`", "`umtool look <p> deck.goals.hold=0`"], + ["`deck.goals.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the note that lands lights as a goal is set -- not the first note (the stack coming up), not the board's own changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look <p> deck.goals.flash=false`"], ], }, }); diff --git a/umtool/report-to-video/modules/measure-extras-settings.mjs b/umtool/report-to-video/modules/measure-extras-settings.mjs @@ -6,10 +6,10 @@ // SETTINGS), so it imports only instruments.mjs (a leaf too: whether the // instruments' column is on decides two defaults here). // -// render.chrome.deck.goals { show, position, x, y, scale, hold, finale, max, color, countdown, base } +// render.chrome.deck.goals { show, position, x, y, scale, hold, finale, max, color, countdown, base, flash } // render.chrome.deck.peak { show, position, x, y, scale, hold, finale, title, color, values } // render.chrome.deck.promise { show, position, x, y, scale, hold, finale, label, verb, kept, broken, checks, speakers, claimVerb, claimColor } -// render.chrome.deck.diet { show, position, x, y, scale, hold, finale, colors, labels, form, tags, overlap, days } +// render.chrome.deck.diet { show, position, x, y, scale, hold, finale, colors, labels, form, tags, overlap, days, flash } // render.chrome.deck.streak { show, position, x, y, scale, hold, finale, source, axis, title, color, colors, labels } // // Each is ON whenever the cut has a measure slice (the build writes one only @@ -123,7 +123,8 @@ export const MEASURE_DEFAULTS = Object.freeze({ // after each goal; `max` notes show, the newest in front; `color` is the // paper (default the palette's amber). // `base`: each note also says the weight he had stated when he set it, "(FROM 346.7)" (the slice's goal base). - goals: Object.freeze({ ...COMMON, position: "bottom-right", hold: 20, max: 4, color: null, countdown: true, base: false }), + // `flash`: the update flash (update-flash.mjs) -- null follows deck.measure.flash, true/false for this module. + goals: Object.freeze({ ...COMMON, position: "bottom-right", hold: 20, max: 4, color: null, countdown: true, base: false, flash: null }), // The moving start: up for `hold` seconds after each retelling. peak: Object.freeze({ ...COMMON, position: "top-right", hold: 12, title: "The start keeps moving", color: null, values: "drift" }), // The promise clock: up from the promise on, through the finale. @@ -135,7 +136,7 @@ export const MEASURE_DEFAULTS = Object.freeze({ speakers: Object.freeze({}), claimVerb: "paid", claimColor: "#E37AB8", slot: "auto" }), // The diet badge: up from the first diet on, re-stamped at every change. // `form` "tags" (the default on the shelf): the last `tags` diets as dated tags, the newest slammed in at the left. - diet: Object.freeze({ ...COMMON, position: "bottom-left", colors: Object.freeze({}), labels: Object.freeze({}), form: "stamp", tags: 3, overlap: 0, days: false }), + diet: Object.freeze({ ...COMMON, position: "bottom-left", colors: Object.freeze({}), labels: Object.freeze({}), form: "stamp", tags: 3, overlap: 0, days: false, flash: null }), // The streak chain: bottom-centre, between the diet badge and the goal // stack, so either or both can run. `title` null is the source's own word. streak: Object.freeze({ ...COMMON, position: "bottom-center", source: "diet", axis: "date", title: null, color: null, colors: Object.freeze({}), labels: Object.freeze({}) }), @@ -265,6 +266,9 @@ export function validateMeasureExtra(id, v, where = `render.chrome.deck.${id}`, if (v.countdown !== undefined && typeof v.countdown !== "boolean") errors.push(`${where}.countdown must be true or false`); if (v.base !== undefined && typeof v.base !== "boolean") errors.push(`${where}.base must be true or false`); } + if (id === "goals" || id === "diet") { + if (v.flash !== undefined && v.flash !== null && typeof v.flash !== "boolean") errors.push(`${where}.flash must be true, false or null (deck.measure.flash)`); + } if (id === "peak") { text(v.title, L.text, `${where}.title`, errors, { nullable: false }); color(v.color, `${where}.color`, errors); diff --git a/umtool/report-to-video/modules/odometer.mjs b/umtool/report-to-video/modules/odometer.mjs @@ -31,6 +31,7 @@ export default defineModule({ { key: "label", type: "text", label: "Over the wheels", default: ODOMETER_DEFAULTS.label }, { key: "net", type: "boolean", label: "NET beside them", default: true }, { key: "runs", type: "boolean", label: "How many runs", default: true }, + { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { heading: "Lost odometer", @@ -39,6 +40,7 @@ export default defineModule({ ["`deck.odometer`", "`true` · an object of the knobs below · `false` off · absent: ON when the cut draws a measure (`deck.measure` set), else off", "`umtool look <p> deck.odometer=false`"], ["`deck.odometer.label`", "words over the wheels, ≤ 40 · default `POUNDS HE SAYS HE'S LOST`", "`umtool look <p> deck.odometer.label='\"…\"'`"], ["`deck.odometer.net`, `.runs`", "bool · default `true` each", "`umtool look <p> deck.odometer.net=false`"], + ["`deck.odometer.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the card lights as the pounds lost go up (or the runs change) and as NET changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look <p> deck.odometer.flash=false`"], ], }, region: "odometer", diff --git a/umtool/report-to-video/modules/trail.mjs b/umtool/report-to-video/modules/trail.mjs @@ -32,6 +32,7 @@ export default defineModule({ { key: "label", type: "text", label: "Its title", default: TRAIL_DEFAULTS.label }, { key: "bounds", type: "enum", options: ["fit", "fixed"], label: "Axes: fit what is shown so far, or fixed to the whole cut", default: "fit" }, { key: "remembered", type: "boolean", label: "His remembered weights as points too (hollow, not joined)", default: true }, + { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { heading: "Weight trail", @@ -44,6 +45,7 @@ export default defineModule({ ["`deck.trail.bounds`", "`fit` · `fixed` · default `fit`: the axes fit the weights said so far and reflow as each lands; `fixed` lays every moment on the axes of all the cut's weights", "`umtool look <p> deck.trail.bounds=fixed`"], ["`deck.trail.remembered`", "bool · default `true`: his remembered weights are points too, hollow and grey, not joined into the line", "`umtool look <p> deck.trail.remembered=false`"], ["`deck.trail.gap`", "`auto` · days 30–3650 · `0` none · default `auto`: a stretch with no statement longer than a year (or 8× the median spacing, if longer) is a break in the time axis", "`umtool look <p> deck.trail.gap=540`"], + ["`deck.trail.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the card lights as each weight lands on it; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look <p> deck.trail.flash=false`"], ], }, region: "trail", diff --git a/umtool/report-to-video/update-flash.mjs b/umtool/report-to-video/update-flash.mjs @@ -0,0 +1,84 @@ +// THE UPDATE FLASH (operator, 11 Nov: "whenever a widget gets updated, have it +// show a subtle border flash or something to indicate that at a glance"): at +// the moment a measure widget's shown value changes, a thin outline just inside +// its edge lights over FLASH_MOTION.up and decays over FLASH_MOTION.down, in the +// widget's own colour -- no size change, no layout shift. Widgets that change on +// the same event flash together (each reads the same event times). +// +// What counts as a change, per widget (each page picks its own times): +// the dial a new stated weight, a remembered one, a goal in force changing +// the odometer the pounds lost going up (or its runs), NET changing +// the trail each weight landing on the chart +// the diet a new diet (a new front tag) -- never the running day count +// the goals a goal set (a note landing) -- not the board's own changes +// Never on frame 0, never while the deck is away (the intro, a card, the +// finale's hand-over), never on a widget's first appearance (its own entrance +// marks that) unless it is the dial, which stands from the start. +// +// OFF by default: `render.chrome.deck.measure.flash: true` turns it on for +// every widget; a widget's own `flash` (true/false) overrides that for it. +import { deckChoreography } from "./deck.mjs"; + +/** Seconds: the outline's rise and its decay. */ +export const FLASH_MOTION = Object.freeze({ up: 0.15, down: 0.7 }); + +/** Is the flash on for a widget: its own `flash` when it says, else `deck.measure.flash`. */ +export function flashOn(render, own = null) { + if (typeof own === "boolean") return own; + return render?.chrome?.deck?.measure?.flash === true; +} + +/** The spans the deck is away (deckChoreography's visibility): `[{ from, to }]`, `to` Infinity when it stays away. */ +export function deckAwaySpans(schedule, render) { + let vis = []; + try { + vis = deckChoreography(schedule, render).visibility; + } catch { + return []; + } + const out = []; + let open = null; + for (const v of [...vis].sort((a, b) => a.at[0] - b.at[0])) { + if (v.hide && open === null) open = v.at[0]; + else if (!v.hide && open !== null) { out.push({ from: open, to: v.at[1] }); open = null; } + } + if (open !== null) out.push({ from: open, to: Infinity }); + return out; +} + +/** + * The moments a widget flashes: its change `times`, sorted, one per 0.05 s, none before frame 1 and none while the + * deck is away (`away`, deckAwaySpans). + */ +export function flashTimes(times, { fps = 30, away = [] } = {}) { + const frame = 1 / (Number(fps) > 0 ? Number(fps) : 30); + const out = []; + for (const t of [...times].filter(Number.isFinite).sort((a, b) => a - b)) { + if (t < frame - 1e-9) continue; + if (away.some((s) => t >= s.from - 1e-6 && t < s.to)) continue; + if (out.length && t - out[out.length - 1] < 0.05) continue; + out.push(t); + } + return out; +} + +/** The outline's cue events (compileCues / cueList shape): up, then down, at each time. */ +export function flashEvents(k, times) { + const { up, down } = FLASH_MOTION; + return times.flatMap((t) => [ + { k, at: t, dur: up, to: { opacity: 1 }, ease: "power1.out" }, + { k, at: t + up, dur: down, to: { opacity: 0 }, ease: "power2.out" }, + ]); +} + +/** A cueList's adds for the outline `k` (its init: hidden). */ +export function flashCues(L, k, times) { + L.set(k, { opacity: 0 }); + for (const e of flashEvents(k, times)) L.add(e.k, e.at, e.dur, e.to, e.ease); +} + +/** The outline's look: a thin line in `color` just inside the box (`inset` negative: just outside), a soft glow; `radius` its corners (CSS). */ +export function flashCss(sel, color, { radius = "0px", width = 2, inset = "0px" } = {}) { + return `${sel} { position: absolute; inset: ${inset}; border-radius: ${radius}; border: ${width}px solid ${color}; + box-shadow: 0 0 ${width * 5}px ${color}, inset 0 0 ${width * 3}px ${color}; opacity: 0; pointer-events: none; }`; +} diff --git a/umtool/report-to-video/update-flash.test.mjs b/umtool/report-to-video/update-flash.test.mjs @@ -0,0 +1,130 @@ +// THE UPDATE FLASH (update-flash.mjs; operator, 11 Nov): a measure widget's outline lights at the moment its +// shown value changes -- exactly that widget, exactly then -- and never on frame 0, over the intro, or on a widget's +// first appearance. Off by default: a cut renders as it did. +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 { dietHtml, goalsHtml, shelfGoalStates } from "./chrome-measure-extras.mjs"; +import { dietStates, goalStates } from "./measure-extras.mjs"; +import { measureTrack } from "./measure-draw.mjs"; +import { validateMeasureSettings } from "./measure-slice.mjs"; +import { validateDial } from "./instruments.mjs"; +import { validateMeasureExtra } from "./modules/measure-extras-settings.mjs"; +import { trailPoints } from "./trail-plan.mjs"; +import { FLASH_MOTION, flashOn, flashTimes } from "./update-flash.mjs"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const DIAL = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-dial", "measure.json"), "utf8")); +const EXTRAS = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-extras", "measure.json"), "utf8")); +const FPS = 30; +const PALETTE = { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" }; +const deckOf = (deck) => ({ width: 1920, height: 1080, fps: FPS, transition: 0.4, palette: PALETTE, chrome: { engine: "hyperframes", layout: "deck", deck } }); +const INSTR = { dial: true, odometer: true, trail: true, qr: { show: false }, finale: { video: "side", totals: false } }; +const ON = deckOf({ ...INSTR, measure: { flash: true } }); +const OFF = deckOf(INSTR); + +/** The instruments' fixture cut: 9 clips, the last the finale -- optionally opening on the intro. */ +function cut(render, { intro = false } = {}) { + 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" } : {}), + })); + if (intro) timeline.unshift({ type: "intro", id: "brand-intro", style: "boot-dark", seconds: 4.75, heading: "Intro" }); + return { ...estimateSchedule({ slug: "m", title: "M", provenance: {}, render, timeline }), measure: DIAL }; +} +const dataOf = (html, id) => JSON.parse(new RegExp(`<script id="${id}-data" type="application/json">(.*?)</script>`, "s").exec(html)[1]); +/** The moments an outline `k` lights: its rising cues. */ +const lit = (data, k = "fl") => data.cues.filter((c) => c.k === k && c.to.opacity === 1).map((c) => c.at); +const near = (a, b) => a.length === b.length && a.every((x, i) => Math.abs(x - b[i]) < 0.02); + +test("off by default: no outline on any widget, and the pages are the pages they were", () => { + const s = cut(OFF); + for (const [id, html] of [["dial", dialHtml(s, OFF, {})], ["odometer", odometerHtml(s, OFF, {})], ["trail", trailHtml(s, OFF, {})]]) { + assert.doesNotMatch(html, /data-k="fl"/, id); + assert.equal(lit(dataOf(html, id)).length, 0, id); + } + assert.equal(flashOn(OFF), false); + assert.equal(flashOn(ON), true); + assert.equal(flashOn(ON, false), false, "a widget's own false beats the measure's true"); + assert.equal(flashOn(OFF, true), true); +}); + +test("a value change at t lights exactly the widget whose value changed, at t -- and nothing else does", () => { + const s = cut(ON); + const track = measureTrack(DIAL); + const frame = 1 / FPS; + const want = (times) => flashTimes(times, { fps: FPS }); + const dialT = want([...track.current.slice(1), ...track.remembered, ...track.goals.slice(1)].map((x) => x.t)); + const odoT = want([...track.lost.slice(1), ...track.net.slice(1)].map((x) => x.t)); + const trailT = want(trailPoints(DIAL).map((p) => p.t)); + const got = { dial: lit(dataOf(dialHtml(s, ON, {}), "dial")), odometer: lit(dataOf(odometerHtml(s, ON, {}), "odometer")), trail: lit(dataOf(trailHtml(s, ON, {}), "trail")) }; + assert.ok(near(got.dial, dialT), `dial ${got.dial} vs ${dialT}`); + assert.ok(near(got.odometer, odoT), `odometer ${got.odometer} vs ${odoT}`); + assert.ok(near(got.trail, trailT), `trail ${got.trail} vs ${trailT}`); + assert.ok(got.dial.length && got.odometer.length && got.trail.length); + // A moment only the odometer changes at (a loss claim, no weight stated): the odometer lights, the dial does not. + const onlyOdo = odoT.find((t) => !dialT.some((d) => Math.abs(d - t) < 0.02) && !trailT.some((d) => Math.abs(d - t) < 0.02)); + assert.ok(onlyOdo !== undefined, "the fixture has a loss claim with no weight stated with it"); + assert.ok(!got.dial.some((t) => Math.abs(t - onlyOdo) < 0.02)); + // A stated weight lights the dial and the trail together, at the same instant. + const both = dialT.find((t) => trailT.some((d) => Math.abs(d - t) < 0.02)); + assert.ok(both !== undefined && got.trail.some((t) => Math.abs(t - both) < 0.02)); + // Up over 0.15 s, down over 0.7 s; never before frame 1. + const d = dataOf(dialHtml(s, ON, {}), "dial"); + const up = d.cues.find((c) => c.k === "fl" && c.to.opacity === 1); + const down = d.cues.find((c) => c.k === "fl" && c.to.opacity === 0); + assert.equal(up.dur, FLASH_MOTION.up); + assert.equal(down.dur, FLASH_MOTION.down); + assert.ok(Object.values(got).flat().every((t) => t >= frame)); + assert.deepEqual(d.init.fl, { opacity: 0 }, "dark on frame 0"); +}); + +test("never over the intro: a change said while the deck is away does not light anything", () => { + const s = cut(ON, { intro: true }); + const introEnd = s.segments[1].start; + for (const [id, html] of [["dial", dialHtml(s, ON, {})], ["odometer", odometerHtml(s, ON, {})], ["trail", trailHtml(s, ON, {})]]) { + const times = lit(dataOf(html, id)); + assert.ok(times.every((t) => t >= introEnd), `${id}: ${times} after ${introEnd}`); + } + // The fixture's changes at 2 and 3.75 s fall inside the 4.75 s intro: they are dropped, not moved. + assert.ok(!lit(dataOf(dialHtml(s, ON, {}), "dial")).some((t) => t < introEnd)); +}); + +test("the goal stack and the diet tags: a goal set / a new diet lights the card that lands -- never the first", () => { + const FAN = { dial: true, odometer: true, trail: true, shelf: { items: ["diet", "goals"] }, diet: { position: "shelf", form: "tags", overlap: 0.6, days: true }, goals: { position: "shelf" }, streak: false, measure: { flash: true } }; + const r = deckOf(FAN); + const sched = { kind: "deck", fps: FPS, total: 740, transition: 0.4, segments: [{ id: "a", start: 0, duration: 740, end: 740 }], measure: EXTRAS }; + const shelf = shelfGoalStates(sched, goalStates(sched, r)); + const g = dataOf(goalsHtml(sched, r, { fonts: {} }).html, "goals"); + const gLit = g.cues.filter((c) => /\.fl$/.test(c.k) && c.to.opacity === 1); + const wantG = shelf.filter((st, j) => j > 0 && st.top).map((st) => st.at); + assert.ok(near(gLit.map((c) => c.at), wantG), `goals ${gLit.map((c) => c.at)} vs ${wantG}`); + assert.ok(!gLit.some((c) => c.k.startsWith("s0.")), "the first goal is the stack's entrance"); + // A board-only change (met, missed) is not a goal set: no outline. + assert.ok(shelf.some((st) => !st.top), "the fixture's board changes on its own") ; + const states = dietStates(sched, r); + const d = dataOf(dietHtml(sched, r, { fonts: {} }).html, "diet"); + const dLit = d.cues.filter((c) => /\.fl$/.test(c.k) && c.to.opacity === 1).map((c) => c.at); + const wantD = states.filter((st, j) => j > 0 && st.tags[0]?.id !== states[j - 1].tags[0]?.id).map((st) => st.at); + assert.ok(near(dLit, wantD), `diet ${dLit} vs ${wantD}`); + // The running day count changes far more often than the diet: it never lights the tag. + assert.ok(dLit.length < d.cues.filter((c) => /\.y\d+$/.test(c.k)).length); + // Off: nothing. + const off = deckOf({ ...FAN, measure: undefined }); + assert.doesNotMatch(goalsHtml(sched, off, { fonts: {} }).html, /class="fl"/); + assert.doesNotMatch(dietHtml(sched, off, { fonts: {} }).html, /class="fl"/); +}); + +test("the knobs: deck.measure.flash and each widget's own flash validate", () => { + assert.deepEqual(validateMeasureSettings({ flash: true }), []); + assert.match(validateMeasureSettings({ flash: "on" }).join(), /measure\.flash must be true or false/); + assert.deepEqual(validateDial({ flash: false }), []); + assert.match(validateDial({ flash: 1 }).join(), /dial\.flash must be true or false/); + assert.deepEqual(validateMeasureExtra("goals", { flash: true }), []); + assert.match(validateMeasureExtra("diet", { flash: "x" }).join(), /flash must be true, false or null/); +});