Archilyzer · Source

archilyzer

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

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

dial: three other looks for a remembered weight, behind deck.dial.rememberedAs (default as it was)

Operator, 11 Nov: "max weight statements could be shown better" -- the long
grey second needle from the hub to ~390 and its small "~390 / AS OF 24 FEB
2023" crossed the main needle and the readout and did not say what it was.
deck.dial.rememberedAs: "needle" (default, byte for byte today's), "rim" (a
bold marker across the rim at the value and a flag inside it, clear of the
figures, the hub, the readout and the needle where it stands), "readout" (a
line under the date, "HEAVIEST HE'S SAID: ~390 (FEB 2023)", the goal under it,
and the rim marker), "callout" (a ghost needle sweeps to the value as he says
it, a label holds 2.2 s, then the rim's flag). The words are the ledger's: its
qualifier, its asOf's month; HEAVIEST only for the record's highest remembered
weight above every stated one (the peak extra's totals.peakDrift). Each up
while it is the latest remembered; the claim and rim ghost ticks unchanged.

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

Diffstat:
Mumtool/docs/knobs.md | 1+
Mumtool/report-to-video/chrome-instruments.mjs | 147++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
Aumtool/report-to-video/fixtures/measure-remembered/measure.json | 250+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/instruments.mjs | 6++++++
Mumtool/report-to-video/instruments.test.mjs | 4++--
Mumtool/report-to-video/modules/dial.mjs | 2++
Aumtool/report-to-video/remembered-looks.test.mjs | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 482 insertions(+), 10 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -2422,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.dial.rememberedAs` | `needle` · `rim` · `readout` · `callout` · default `needle` (as it was: a long grey second needle from the hub to the value, its words -- "≈390 / AS OF 24 FEB 2023" -- along it). `rim`: no long needle; a bold marker across the rim at the value and a flag inside it -- "HEAVIEST ≈390 / AS OF FEB 2023 · HE SAYS" -- placed clear of the scale's figures, the hub and the readout. `readout`: a line in the readout under the date -- "HEAVIEST HE'S SAID: ≈390 (FEB 2023)", the goal under it -- and the rim marker. `callout`: as he says it a ghost needle sweeps from where the needle stands to the value and a label ("HEAVIEST HE'S SAID / ≈390 / AS OF FEB 2023") holds 2.2 s, then the rim's flag. The words are the ledger's: its qualifier, its asOf's month; HEAVIEST only for the record's highest remembered weight above every weight he stated (the peak extra's `totals.peakDrift`), else "HE SAYS HE WAS". Each is up while it is the latest remembered; the thin rim ticks of every remembered weight stay as they are | `umtool look <p> deck.dial.rememberedAs=rim` | | `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}'` | diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs @@ -250,6 +250,33 @@ export function clearSpot(spots, obstacles, m = 0) { /** A centred box `w` x `h` at (x, y). */ const boxAt = (x, y, w, h) => ({ x0: x - w / 2, x1: x + w / 2, y0: y - h / 2, y1: y + h / 2 }); +/** How the dial shows a remembered weight (`deck.dial.rememberedAs`): "needle" (the long grey needle, as it was), "rim", "readout", "callout". */ +export const rememberedMode = (cfg) => (["rim", "readout", "callout"].includes(cfg?.rememberedAs) ? cfg.rememberedAs : "needle"); + +/** His highest remembered weight above every one he stated (the peak extra's `totals.peakDrift`), or null. */ +export const heaviestOf = (measure) => { + const drift = Array.isArray(measure?.totals?.peakDrift) ? measure.totals.peakDrift.filter(Number.isFinite) : []; + return drift.length ? Math.max(...drift) : null; +}; + +/** + * A remembered weight's words, from its own fields: `value` with its qualifier ("≈390"), `when` its asOf's month + * ("FEB 2023", null without one), `kind` "HEAVIEST HE'S SAID" when it is `heaviest` (heaviestOf) else "HE SAYS HE + * WAS"; and the forms the looks draw -- `head`/`sub` (the rim's flag), `line` (the readout's). + */ +export function rememberedWords(g, heaviest = null) { + const value = weightWords(g); + const top = heaviest !== null && Number.isFinite(g.value) && Math.abs(g.value - heaviest) < 0.05; + const when = g.asOf ? fmtDate(g.asOf, { day: false }) : null; + const kind = top ? "HEAVIEST HE'S SAID" : "HE SAYS HE WAS"; + return { + value, when, kind, heaviest: top, + head: top ? `HEAVIEST ${value}` : value, + sub: [when ? `AS OF ${when}` : "REMEMBERED", top ? "HE SAYS" : ""].filter(Boolean).join(" · "), + line: `${kind}: ${value}${when ? ` (${when})` : ""}`, + }; +} + /** * An as-of label's places, best first: along its ghost (angle `a`) at half the face's radius, each of its `forms` * (its small words on one line, then on two), then stepping in toward the hub; never lower than just under the hub, @@ -277,7 +304,7 @@ function asofSpots({ C, Rf, u, a, head, forms, px, fpx }) { * the hub and the readout blocks. Shared by the column's dial and the * finale's. Returns its markup and css; its cues are the caller's. */ -function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], lines = [], ghosts = null, prefix = "", preState = true }) { +function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], lines = [], ghosts = null, prefix = "", preState = true, heaviest = null }) { 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; @@ -351,7 +378,8 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], parts.push(`<div class="ly" data-k="${prefix}gm${i}">${svg(`gm${i}h`, head)}${svg(`gm${i}o`, other)}${svg(`gm${i}x`, strike)}${svg(`gm${i}p`, flash)}</div>`); }); } - if (cfg.ghosts && track.remembered.length) { + const mode = rememberedMode(cfg); + if (cfg.ghosts && track.remembered.length && (mode === "needle" || mode === "callout")) { parts.push(layer("gn", `<line x1="${C}" y1="${C + 22 * u}" x2="${C}" y2="${C - Rf + 66 * u}" stroke="${colors.ghost}" stroke-width="${px(5)}" stroke-linecap="round"/>`)); } // The needle: a tapered blade from a counterweight through the hub. @@ -362,7 +390,7 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], // The as-of labels, each by its ghost, up while it is the latest -- and never on a scale figure (rev 9: "≈390 · // AS OF FEB 2025 · TOLD 4×" sat on the 380). Along its ghost, never down into the readout's words under the hub; // where its box would touch a figure's, its words go on two lines, then it steps in toward the hub. - if (cfg.ghosts) { + if (cfg.ghosts && mode === "needle") { track.remembered.forEach((g, j) => { const a = dialAngle(g.value, scale); const head = weightWords(g); @@ -374,6 +402,52 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], parts.push(`<div class="asof" data-k="${prefix}ga${j}" style="left:${spot.x}px; top:${spot.y}px"><b>${esc(head)}</b>${spot.lines.map((l) => `<span>${esc(l)}</span>`).join("")}</div>`); }); } + // THE REMEMBERED WEIGHT'S OTHER LOOKS (`deck.dial.rememberedAs`, 11 Nov: the long grey second needle and its + // small words crossed the main needle and the readout and did not say what the weight was). Each from the + // ledger's own fields -- the qualifier, the asOf, "heaviest" only for the record's highest remembered weight above + // every one he stated (the peak extra's `totals.peakDrift`) -- never words of ours. + // rim a bold marker on the rim at the value and a flag inside it, clear of the hub, the figures and the readout + // readout a line in the readout under the date ("HEAVIEST HE'S SAID: ≈390 (FEB 2023)"), a marker on the rim + // callout a ghost needle sweeps to the value as he says it, a clear label holds ~2 s, then the rim's flag + const readoutBox = { x0: C - 128 * u, x1: C + 128 * u, y0: C + 60 * u, y1: C + 230 * u }; + if (cfg.ghosts && mode !== "needle") { + const ink = mix(colors.ghost, colors.fg, 0.55); + track.remembered.forEach((g, j) => { + const w = rememberedWords(g, heaviest); + const a = dialAngle(g.value, scale); + // The marker: a bold wedge across the rim, pointing in -- the scale's own ticks show through either side. + parts.push(layer(`gk${j}`, `<polygon points="${C - 9 * u},${C - R - 3 * u} ${C + 9 * u},${C - R - 3 * u} ${C + 3 * u},${C - Rf + 30 * u} ${C - 3 * u},${C - Rf + 30 * u}" fill="${ink}" stroke="${colors.bg}" stroke-width="${px(2)}"/>`)); + if (mode === "readout") { + parts.push(`<div class="rline" data-k="${prefix}gr${j}" style="top:${C + 188 * u}px">${esc(w.line)}</div>`); + return; + } + // The flag: inside the rim by the marker -- along it, then turning a little either way, stepping in -- clear of + // the scale's figures, the hub, the readout and the needle where it stands as he says it. + const hb = px(22), hs = fpx(12); + const flagLines = [w.heaviest ? "HEAVIEST" : "REMEMBERED", w.when ? w.when : ""].filter(Boolean); + const fw = Math.max(w.value.length * hb * 0.56, ...flagLines.map((l) => l.length * hs * 0.66)) + 2 * px(8); + const fh = hb * 1.08 + flagLines.length * hs * 1.12 + 2 * px(4); + const stands = [...track.current].filter((c) => c.t <= g.t + 1e-9 && Number.isFinite(c.value)).pop(); + const needle = []; + if (stands) { + const na = dialAngle(stands.value, scale); + for (let r = 24 * u; r <= Rf - 30 * u; r += 14 * u) { const [x, y] = polar(C, C, r, na); needle.push(boxAt(x, y, 10 * u, 10 * u)); } + } + const spots = []; + for (const da of [0, -8, 8, -16, 16, -24, 24, -32, 32, -40, -48]) { + for (let r = Rf * 0.64; r >= Rf * 0.34 - 1e-9; r -= Rf * 0.04) { + const [x, y] = polar(C, C, r, a + da); + spots.push({ x, y, box: boxAt(x, y, fw, fh) }); + } + } + const spot = clearSpot(spots, [...faceFigures.map((f) => f.box), hub, readoutBox, ...needle], 4 * u); + const [l0, l1] = flagLines; + parts.push(`<div class="rflag" data-k="${prefix}gl${j}" style="left:${spot.x}px; top:${spot.y}px"><span>${esc(l0)}</span><b>${esc(w.value)}</b>${l1 ? `<span>${esc(l1)}</span>` : ""}</div>`); + if (mode === "callout") { + parts.push(`<div class="rcall" data-k="${prefix}gc${j}" style="top:${C - 104 * u}px"><span>${esc(w.kind)}</span><b>${esc(w.value)}</b>${w.when ? `<span>AS OF ${esc(w.when)}</span>` : ""}</div>`); + } + }); + } // The readout under the hub: the words, the weight, the weighing's date, the goal. // Inside the face's open quarter: each line kept within the chord at its height. parts.push(`<div class="rlab" style="top:${C + 72 * u}px">${esc(cfg.label)}</div>`); @@ -385,7 +459,9 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], }); if (cfg.goal) { lines.forEach((g, j) => { - parts.push(`<div class="goalw${g.missed ? " miss" : ""}" data-k="${prefix}gw${j}" style="top:${C + 188 * u}px">${esc(g.words)}</div>`); + // Under the remembered line when the readout carries one (rememberedAs "readout"). + const gy = cfg.ghosts && mode === "readout" && track.remembered.length ? C + 210 * u : C + 188 * u; + parts.push(`<div class="goalw${g.missed ? " miss" : ""}" data-k="${prefix}gw${j}" style="top:${gy}px">${esc(g.words)}</div>`); }); } const css = ` @@ -411,7 +487,19 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], color: ${colors.accent}; white-space: nowrap; padding: ${px(1)}px ${px(6)}px; border-radius: ${px(5)}px; background: ${rgba(colors.face, 0.9)}; } .dial .goalw { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "bold")}; font-size: ${fpx(17)}px; line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.05em; color: ${colors.amber}; white-space: nowrap; } - .dial .goalw.miss { color: ${colors.needle}; }`; + .dial .goalw.miss { color: ${colors.needle}; }${cfg.ghosts && mode !== "needle" && track.remembered.length ? ` + .dial .rflag { position: absolute; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; line-height: 1.08; + padding: ${px(4)}px ${px(8)}px; border-radius: ${px(6)}px; background: ${rgba(colors.face, 0.92)}; + border: ${px(1.5)}px solid ${rgba(mix(colors.ghost, colors.fg, 0.55), 0.7)}; color: ${mix(colors.ghost, colors.fg, 0.6)}; } + .dial .rflag b { display: block; font-family: ${fontStack(fonts, "display")}; font-weight: 400; font-size: ${px(22)}px; } + .dial .rflag span { display: block; font-family: ${fontStack(fonts, "condensed")}; font-size: ${fpx(12)}px; letter-spacing: 0.1em; color: ${colors.ghost}; } + .dial .rline { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "condensed")}; + font-size: ${fpx(16)}px; line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.06em; color: ${mix(colors.ghost, colors.fg, 0.55)}; white-space: nowrap; } + .dial .rcall { position: absolute; left: 50%; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; line-height: 1.05; + padding: ${px(6)}px ${px(14)}px; border-radius: ${px(8)}px; background: ${rgba(colors.face, 0.94)}; + border: ${px(2)}px solid ${mix(colors.ghost, colors.fg, 0.55)}; color: ${mix(colors.ghost, colors.fg, 0.7)}; } + .dial .rcall b { display: block; font-family: ${fontStack(fonts, "display")}; font-weight: 400; font-size: ${px(40)}px; } + .dial .rcall span { display: block; font-family: ${fontStack(fonts, "condensed")}; font-size: ${fpx(15)}px; letter-spacing: 0.1em; color: ${colors.ghost}; }` : ""}`; return { html: `<div class="dial">${parts.join("\n ")}</div>`, css, face }; } @@ -464,7 +552,8 @@ function dialCues(L, { track, scale, cfg, marks = [], lines = [], ghosts = null, L.add(k(`gb${j}`), g.t, M.fade, { autoAlpha: 1 }, "power1.out"); } }); - if (track.remembered.length && finale) { + if (rememberedMode(cfg) !== "needle") rememberedCues(L, { track, scale, cfg, k, finale }); + else if (track.remembered.length && finale) { // All at once: the long ghost and its words on the last (the finale puts his highest there). const last = track.remembered.length - 1; const g = track.remembered[last]; @@ -485,6 +574,48 @@ function dialCues(L, { track, scale, cfg, marks = [], lines = [], ghosts = null, if (ghosts) ghostCues(L, { ghosts, scale, k, finale, at }); } +/** The callout's hold (rememberedAs "callout"): the label up this long after he says it, then the rim's flag. */ +export const CALLOUT_HOLD = 2.2; + +/** + * The remembered weight's cues in the looks other than the long needle (dialParts, `deck.dial.rememberedAs`): its + * rim marker and its flag (or its readout line) up while it is the latest remembered; with "callout", first the + * ghost needle sweeping from where the needle stands to the value and the label held CALLOUT_HOLD s. In the finale, + * the last one's, all at once. + */ +function rememberedCues(L, { track, scale, cfg, k, finale }) { + const M = INSTRUMENT_MOTION; + const R = track.remembered; + if (!R.length) return; + const mode = rememberedMode(cfg); + const call = mode === "callout" && !finale; + const label = mode === "readout" ? "gr" : "gl"; + const startOf = (g) => (call ? g.t + CALLOUT_HOLD : g.t); + R.forEach((g, j) => { + L.set(k(`gk${j}`), { rotation: dialAngle(g.value, scale), autoAlpha: 0 }); + L.set(k(`${label}${j}`), { autoAlpha: 0 }); + if (call) L.set(k(`gc${j}`), { autoAlpha: 0 }); + if (finale && j !== R.length - 1) return; + const next = finale ? null : R[j + 1]; + for (const key of [`gk${j}`, `${label}${j}`]) { + L.add(k(key), startOf(g), M.fade, { autoAlpha: 1 }, "power1.out"); + if (next) L.add(k(key), startOf(next), M.fade * 0.6, { autoAlpha: 0 }, "power1.in"); + } + }); + if (!call) return; + const a0 = dialAngle(scale.min, scale); + L.set(k("gn"), { rotation: dialAngle(R[0].value, scale), autoAlpha: 0 }); + R.forEach((g, j) => { + // From where the needle stands as he says it (his stated weight in force then; the scale's foot before one). + const cur = [...track.current].filter((c) => c.t <= g.t + 1e-9 && Number.isFinite(c.value)).pop(); + L.add(k("gn"), g.t, INSTANT, { rotation: cur ? dialAngle(cur.value, scale) : a0, autoAlpha: 0.9 }, "none"); + L.add(k("gn"), g.t + 0.05, M.needle, { rotation: dialAngle(g.value, scale) }, "power2.inOut"); + L.add(k("gn"), g.t + CALLOUT_HOLD, 0.4, { autoAlpha: 0 }, "power1.in"); + L.add(k(`gc${j}`), g.t + 0.25, M.fade, { autoAlpha: 1 }, "power1.out"); + L.add(k(`gc${j}`), g.t + CALLOUT_HOLD, 0.4, { autoAlpha: 0 }, "power1.in"); + }); +} + /** * The goal board's cues (goalMarks, goalLines): each mark's status from each board state -- the headline's triangle, * an other's tick, a miss struck in red with a flash -- and the goal line's words. @@ -581,7 +712,7 @@ export function dialHtml(schedule, render, opts = {}) { const marks = goalMarks(board, M.scale); const lines = goalLines(board); const ghosts = ghostsOf(M, render, colors); - const parts = dialParts({ size, ox: Math.floor((W - size) / 2), oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track, marks, lines, ghosts }); + const parts = dialParts({ size, ox: Math.floor((W - size) / 2), oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track, marks, lines, ghosts, heaviest: heaviestOf(M) }); const L = cueList(fps); withDeck(L, schedule, render, "rt"); dialCues(L, { track, scale: M.scale, cfg, marks, lines, ghosts }); @@ -1035,7 +1166,7 @@ export function dialFinaleHtml(schedule, render, window, opts = {}) { const k = size / 524; const dial = dialParts({ size, ox: portrait ? Math.floor((W - size) / 2) : 0, oy: portrait ? titleH + Math.round(18 * u) + Math.floor((cardH - size) / 2) : Math.floor((H - size) / 2), - scale: M.scale, cfg, colors, fonts, track, marks, lines, ghosts, prefix: "f", preState: false, + scale: M.scale, cfg, colors, fonts, track, marks, lines, ghosts, prefix: "f", preState: false, heaviest: heaviestOf(M), }); const rw = portrait ? W - Math.round(48 * u) : W - size - Math.round(40 * k); const top = Math.max(Number(M.totals?.lost) || 0, nums.lost); diff --git a/umtool/report-to-video/fixtures/measure-remembered/measure.json b/umtool/report-to-video/fixtures/measure-remembered/measure.json @@ -0,0 +1,249 @@ +{ + "_fixture": "rev9-a7's moment for the dial's remembered-weight looks (11 Nov): 342.9 stated (21 Mar 2013), LOSE 75 in force, ≈390 remembered as of 24 Feb 2023 -- his heaviest (totals.peakDrift) -- and a 368 as of 2008 that is not.", + "version": 1, + "unit": "lb", + "scale": { + "min": 220, + "max": 400 + }, + "asOfRender": "2026-11-11", + "scopes": [ + "weight" + ], + "events": [ + { + "t": 1, + "row": "w1", + "scope": "weight", + "kind": "stated", + "value": 342.9, + "qualifier": null, + "date": "2013-03-21", + "asOf": null, + "display": "342.9 lb" + }, + { + "t": 1.5, + "row": "g1", + "scope": "weight", + "kind": "goalLoss", + "value": -75, + "qualifier": null, + "date": "2023-07-26", + "asOf": null, + "display": "lose 75", + "deadline": null, + "due": null + }, + { + "t": 3, + "row": "w21", + "scope": "weight", + "kind": "remembered", + "value": 390, + "qualifier": "≈", + "date": "2023-09-29", + "asOf": "2023-02-24", + "display": "≈390 lb" + }, + { + "t": 8, + "row": "w35", + "scope": "weight", + "kind": "remembered", + "value": 368, + "qualifier": null, + "date": "2024-01-10", + "asOf": "2008-06-30", + "display": "368 lb" + } + ], + "hidden": [], + "state": [ + { + "t": 0, + "current": null, + "remembered": [], + "goal": null, + "goals": [], + "lost": { + "total": 0, + "runs": [] + }, + "net": null + }, + { + "t": 1, + "current": { + "value": 342.9, + "qualifier": null, + "row": "w1", + "date": "2013-03-21" + }, + "remembered": [], + "goal": null, + "goals": [], + "lost": { + "total": 0, + "runs": [] + }, + "net": null + }, + { + "t": 1.5, + "current": { + "value": 342.9, + "qualifier": null, + "row": "w1", + "date": "2013-03-21" + }, + "remembered": [], + "goal": { + "value": 267.9, + "loss": 75, + "deadline": null, + "due": null, + "row": "g1", + "display": "lose 75", + "base": { + "value": 342.9, + "row": "w1", + "from": "stated" + } + }, + "goals": [ + { + "value": 267.9, + "loss": 75, + "deadline": null, + "due": null, + "row": "g1", + "display": "lose 75", + "base": { + "value": 342.9, + "row": "w1", + "from": "stated" + } + } + ], + "lost": { + "total": 0, + "runs": [] + }, + "net": null + }, + { + "t": 3, + "current": { + "value": 342.9, + "qualifier": null, + "row": "w1", + "date": "2013-03-21" + }, + "remembered": [ + { + "value": 390, + "asOf": "2023-02-24", + "row": "w21" + } + ], + "goal": { + "value": 267.9, + "loss": 75, + "deadline": null, + "due": null, + "row": "g1", + "display": "lose 75", + "base": { + "value": 342.9, + "row": "w1", + "from": "stated" + } + }, + "goals": [ + { + "value": 267.9, + "loss": 75, + "deadline": null, + "due": null, + "row": "g1", + "display": "lose 75", + "base": { + "value": 342.9, + "row": "w1", + "from": "stated" + } + } + ], + "lost": { + "total": 0, + "runs": [] + }, + "net": null + }, + { + "t": 8, + "current": { + "value": 342.9, + "qualifier": null, + "row": "w1", + "date": "2013-03-21" + }, + "remembered": [ + { + "value": 390, + "asOf": "2023-02-24", + "row": "w21" + }, + { + "value": 368, + "asOf": "2008-06-30", + "row": "w35" + } + ], + "goal": { + "value": 267.9, + "loss": 75, + "deadline": null, + "due": null, + "row": "g1", + "display": "lose 75", + "base": { + "value": 342.9, + "row": "w1", + "from": "stated" + } + }, + "goals": [ + { + "value": 267.9, + "loss": 75, + "deadline": null, + "due": null, + "row": "g1", + "display": "lose 75", + "base": { + "value": 342.9, + "row": "w1", + "from": "stated" + } + } + ], + "lost": { + "total": 0, + "runs": [] + }, + "net": null + } + ], + "totals": { + "lost": 0, + "peakDrift": [ + 390 + ], + "under300": { + "said": 0, + "rows": [] + } + } +} +\ No newline at end of file diff --git a/umtool/report-to-video/instruments.mjs b/umtool/report-to-video/instruments.mjs @@ -66,6 +66,10 @@ 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", + // A remembered weight (11 Nov variants): "needle" -- the long grey second needle and its as-of words, as it was -- + // "rim" (a bold rim marker and a flag), "readout" (a line under the date, a rim marker), "callout" (a ghost needle + // sweeps to it with a label held ~2 s, then the rim's flag). chrome-instruments.mjs dialParts. + rememberedAs: "needle", // The update flash (update-flash.mjs): null follows render.chrome.deck.measure.flash; true/false for this one. flash: null, }); @@ -74,6 +78,7 @@ export const DIAL_PLACEMENTS = Object.freeze(["column", "corner"]); export const DIAL_CORNERS = Object.freeze(["bottom-right", "bottom-left", "top-right", "top-left"]); export const DIAL_MOTIONS = Object.freeze(["spring", "ease"]); export const DIAL_FINALE_ENDS = Object.freeze(["auto", "odometer", "promise"]); +export const DIAL_REMEMBERED = Object.freeze(["needle", "rim", "readout", "callout"]); /** A corner dial's size bounds, px at 1920 wide. */ export const DIAL_SIZE = Object.freeze([200, 540]); @@ -184,6 +189,7 @@ export function validateDial(v, where = "render.chrome.deck.dial") { oneOf("placement", DIAL_PLACEMENTS); oneOf("motion", DIAL_MOTIONS); oneOf("finaleEnd", DIAL_FINALE_ENDS); + oneOf("rememberedAs", DIAL_REMEMBERED); oneOf("corner", DIAL_CORNERS); 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]}`); 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", flash: null, + 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", rememberedAs: "needle", 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, flash)"]); + 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, rememberedAs, flash)"]); }); // --------------------------------------------------------------------------- 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: "rememberedAs", type: "enum", options: ["needle", "rim", "readout", "callout"], label: "A remembered weight drawn as", default: "needle" }, { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { @@ -53,6 +54,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.dial.rememberedAs`", "`needle` · `rim` · `readout` · `callout` · default `needle` (as it was: a long grey second needle from the hub to the value, its words -- \"≈390 / AS OF 24 FEB 2023\" -- along it). `rim`: no long needle; a bold marker across the rim at the value and a flag inside it -- \"HEAVIEST ≈390 / AS OF FEB 2023 · HE SAYS\" -- placed clear of the scale's figures, the hub and the readout. `readout`: a line in the readout under the date -- \"HEAVIEST HE'S SAID: ≈390 (FEB 2023)\", the goal under it -- and the rim marker. `callout`: as he says it a ghost needle sweeps from where the needle stands to the value and a label (\"HEAVIEST HE'S SAID / ≈390 / AS OF FEB 2023\") holds 2.2 s, then the rim's flag. The words are the ledger's: its qualifier, its asOf's month; HEAVIEST only for the record's highest remembered weight above every weight he stated (the peak extra's `totals.peakDrift`), else \"HE SAYS HE WAS\". Each is up while it is the latest remembered; the thin rim ticks of every remembered weight stay as they are", "`umtool look <p> deck.dial.rememberedAs=rim`"], ["`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}'`"], diff --git a/umtool/report-to-video/remembered-looks.test.mjs b/umtool/report-to-video/remembered-looks.test.mjs @@ -0,0 +1,82 @@ +// THE DIAL'S REMEMBERED-WEIGHT LOOKS (`deck.dial.rememberedAs`; operator, 11 Nov: "max weight statements could be +// shown better" -- the long grey second needle and its small words crossed the main needle and the readout and did +// not say what the weight was). Three looks beside today's, each worded from the ledger entry's own fields. +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 { CALLOUT_HOLD, dialHtml, heaviestOf, rememberedMode, rememberedWords } from "./chrome-instruments.mjs"; +import { estimateSchedule } from "./deck.mjs"; +import { validateDial } from "./instruments.mjs"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const MEASURE = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-remembered", "measure.json"), "utf8")); +const PALETTE = { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" }; +const renderAs = (as) => ({ width: 1920, height: 1080, fps: 30, transition: 0.4, palette: PALETTE, + chrome: { engine: "hyperframes", layout: "deck", deck: { dial: as === undefined ? true : { rememberedAs: as }, odometer: true, trail: true } } }); +const page = (as) => { + const r = renderAs(as); + const timeline = Array.from({ length: 3 }, (_, i) => ({ type: "clip", id: `c${i + 1}`, video: "v", start: 0, end: 10 })); + const html = dialHtml({ ...estimateSchedule({ slug: "m", title: "M", provenance: {}, render: r, timeline }), measure: MEASURE }, r, { fonts: {} }); + return { html, data: JSON.parse(/<script id="dial-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]) }; +}; + +test("the words are the ledger's: its qualifier, its asOf's month; HEAVIEST only for the record's highest above every stated weight", () => { + assert.equal(heaviestOf(MEASURE), 390); + assert.equal(heaviestOf({ totals: {} }), null); + const top = rememberedWords({ value: 390, qualifier: "≈", asOf: "2023-02-24" }, 390); + assert.deepEqual([top.value, top.when, top.kind, top.line], ["≈390", "FEB 2023", "HEAVIEST HE'S SAID", "HEAVIEST HE'S SAID: ≈390 (FEB 2023)"]); + const other = rememberedWords({ value: 368, qualifier: null, asOf: "2008-06-30" }, 390); + assert.deepEqual([other.kind, other.line], ["HE SAYS HE WAS", "HE SAYS HE WAS: 368 (JUN 2008)"]); + // No peak drift on the record: nothing is called his heaviest. + assert.equal(rememberedWords({ value: 390, qualifier: "≈", asOf: "2023-02-24" }, null).heaviest, false); + assert.equal(rememberedWords({ value: 390, qualifier: "≈", asOf: null }, 390).line, "HEAVIEST HE'S SAID: ≈390"); +}); + +test("needle (the default) is today's dial; rim, readout and callout draw no long needle at rest and no floating as-of words", () => { + assert.equal(rememberedMode({}), "needle"); + assert.deepEqual(validateDial({ rememberedAs: "rim" }), []); + assert.match(validateDial({ rememberedAs: "flag" }).join(), /rememberedAs must be "needle" or "rim" or "readout" or "callout"/); + const today = page(undefined); + assert.deepEqual(page("needle").html, today.html, "needle is the default, byte for byte"); + assert.match(today.html, /data-k="gn"/); + assert.match(today.html, /class="asof" data-k="ga0"/); + for (const as of ["rim", "readout"]) { + const { html } = page(as); + assert.doesNotMatch(html, /data-k="gn"|class="asof"/, as); + assert.match(html, /data-k="gk0"/, `${as}: the rim marker`); + } + assert.match(page("rim").html, /class="rflag" data-k="gl0"[^>]*><span>HEAVIEST<\/span><b>≈390<\/b><span>FEB 2023<\/span>/); + assert.match(page("rim").html, /class="rflag" data-k="gl1"[^>]*><span>REMEMBERED<\/span><b>368<\/b><span>JUN 2008<\/span>/); + assert.match(page("readout").html, /class="rline" data-k="gr0"[^>]*>HEAVIEST HE&#39;S SAID: ≈390 \(FEB 2023\)<|class="rline" data-k="gr0"[^>]*>HEAVIEST HE'S SAID: ≈390 \(FEB 2023\)</); + // The goal line moves under the remembered line in the readout look. + const goalTop = (html) => Number(/class="goalw" data-k="gw\d+" style="top:([\d.]+)px"/.exec(html)[1]); + assert.ok(goalTop(page("readout").html) > goalTop(today.html)); +}); + +test("the rim's flag is never on the hub or the readout", () => { + const { html } = page("rim"); + const at = /class="rflag" data-k="gl0" style="left:([\d.]+)px; top:([\d.]+)px"/.exec(html); + const [x, y] = [Number(at[1]), Number(at[2])]; + // The dial's 540 face: centre 270, the readout's words from 60 px under it. + assert.ok(Math.hypot(x - 270, y - 270) > 80, `clear of the hub (${x}, ${y})`); + assert.ok(!(y > 270 + 40 && Math.abs(x - 270) < 128), `clear of the readout (${x}, ${y})`); +}); + +test("one at a time, the latest remembered; the callout sweeps a ghost needle and holds its label, then the flag", () => { + const rim = page("rim").data; + const up = (d, k) => d.cues.filter((c) => c.k === k && c.to.autoAlpha === 1).map((c) => c.at); + const down = (d, k) => d.cues.filter((c) => c.k === k && c.to.autoAlpha === 0).map((c) => c.at); + assert.deepEqual(up(rim, "gl0"), [3]); + assert.deepEqual(down(rim, "gl0"), [8], "gives way to the next remembered"); + assert.deepEqual(up(rim, "gl1"), [8]); + const call = page("callout").data; + assert.deepEqual(up(call, "gl0"), [3 + CALLOUT_HOLD], "the flag after the hold"); + assert.deepEqual(up(call, "gc0"), [3.25]); + assert.deepEqual(down(call, "gc0"), [3 + CALLOUT_HOLD]); + const gn = call.cues.filter((c) => c.k === "gn"); + assert.ok(gn.some((c) => c.at === 3 && c.to.autoAlpha === 0.9), "the ghost needle comes up where the needle stands"); + assert.ok(gn.some((c) => Math.abs(c.at - (3 + CALLOUT_HOLD)) < 1e-6 && c.to.autoAlpha === 0), "and goes after the hold"); +});