// The claim checks (`deck.claims`, claims.mjs) as the footer's page draws // them: chrome-deck.mjs calls these two and splices their cues and markup // into its own, so a deck without claims composes the page it always did. // // PURE, like chrome-deck.mjs. Every cue states its from through deckCues' // walk (chrome-deck.mjs says why): what is here only adds events and t = 0 // states. // // What it draws, in the identity's one alarm colour (the markers' and the // Seizures tally's red, `#e5534b`) -- and no adjective: his words in quotes // and the record's numbers, the contrast is the argument. // // - A COUNT claim, from the second he says it to his clip's end: the clip's // own words make way and his words stand in the text column, the record // under them. Without `per`: a band over the rail spanning his window, the // rail outside it dimmed, each pip that carries the record lit red with its // count under it, in date order over ~1.2 s, while the number under his // words counts up to the window's total. With `per`: each span that holds // enough lit red on the rail with its count (`12 in a day`), left to right. // - A GOALPOST: from each step's second, a hollow bracket on the rail over // the due window his words imply, his words over it. At the next step the // old one stays as a dashed ghost and a copy of it slides to the new // window -- off the rail's end when that lies past its last date, where // the new bracket's arrow and its dates stand. import { MARKER_LABEL_SIZE } from "./deck.mjs"; import { aboveLine, aboveTop } from "./finale.mjs"; /** The claims' one colour: the alarm red the markers and the Seizures tally use. */ export const CLAIM_RED = "#e5534b"; /** The motion, in seconds: the band in, the record lit over `light`, a span each, the bracket's draw and the move. */ export const CLAIM_MOTION = Object.freeze({ in: 0.35, light: 1.2, spans: 1.0, out: 0.35, draw: 0.5, move: 0.9, settle: 0.7 }); /** The callout's two lines, px: his words, then the record. */ export const CALLOUT = Object.freeze({ size1: 28, box1: 34, size2: 28, box2: 36 }); const esc = (s) => String(s ?? "").replace(/&/g, "&").replace(//g, ">").replace(/"/g, """); const r4 = (v) => Math.round(v * 10000) / 10000; /** * The claims' events and t = 0 states for deckCues' walk, from `cl` * (deck.mjs claimsLayout). `put(k, v)` sets a t = 0 state, `add(k, at, dur, * to, ease, why)` an event; `segIndex(id)` is a segment's index (its text's * keys are `s.tc` …), `W` the page's width. */ export function claimsCues(cl, { put, add, segIndex, W }) { const m = CLAIM_MOTION; // A callout gives way to the next claim said on the same clip. const counts = cl.items.map((it, j) => ({ it, j })).filter(({ it }) => it.kind === "count"); cl.items.forEach((it, j) => { if (it.kind === "count") { const why = `claim ${it.n} ${it.segment}`; const at = it.at; const until = Math.max(at + m.in + 0.1, it.until); // Gone by the time the next one's words come in at the same place: never both at once. const nextHere = counts.find(({ it: o }) => o.segment === it.segment && o.at > at); const coEnd = nextHere ? Math.min(until, nextHere.it.at) : until; const fadeIn = (k, extra = {}) => { put(k, { autoAlpha: 0, ...Object.fromEntries(Object.keys(extra).map((p) => [p, extra[p][0]])) }); add(k, at, m.in, { autoAlpha: 1, ...Object.fromEntries(Object.keys(extra).map((p) => [p, extra[p][1]])) }, "power2.out", why); }; const out = (k, end = until, dur = m.out) => add(k, end - dur, dur, { autoAlpha: 0 }, "power1.in", `${why} out`); // The clip's own words make way for his (its QR stays). const i = segIndex(it.segment); if (i !== undefined) { for (const part of ["tc", "sc", "rule"]) { put(`s${i}.${part}`, { opacity: 1 }); add(`s${i}.${part}`, at, 0.25, { opacity: 0 }, "power1.out", why); } } put(`c${j}.co`, { autoAlpha: 0, x: -14 }); add(`c${j}.co`, at, m.in, { autoAlpha: 1, x: 0 }, "power3.out", why); out(`c${j}.co`, coEnd, nextHere ? 0.2 : m.out); if (it.band) { fadeIn(`c${j}.band`); out(`c${j}.band`); it.veils.forEach((_, v) => { put(`c${j}.v${v}`, { opacity: 0 }); add(`c${j}.v${v}`, at, 0.5, { opacity: 0.72 }, "power1.out", why); add(`c${j}.v${v}`, until - m.out, m.out, { opacity: 0 }, "power1.in", `${why} out`); }); // The record, lit in date order while the number counts up to its total. const n = it.tags.length; put(`c${j}.n0`, { autoAlpha: 1 }); it.tags.forEach((t, k) => { const lit = at + m.in + (m.light * k) / Math.max(1, n); put(`c${j}.r${k}`, { autoAlpha: 0, scale: 0.4 }); add(`c${j}.r${k}`, lit, 0.3, { autoAlpha: 1, scale: 1 }, "back.out(2.2)", `${why} lit`); out(`c${j}.r${k}`); if (!t.covered) { put(`c${j}.t${k}`, { autoAlpha: 0, y: 6 }); add(`c${j}.t${k}`, lit, 0.25, { autoAlpha: 1, y: 0 }, "power2.out", `${why} lit`); out(`c${j}.t${k}`); } put(`c${j}.n${k + 1}`, { autoAlpha: 0 }); // A number swaps for the next in one frame: a crossfade would show both. add(`c${j}.n${k}`, lit, 0.001, { autoAlpha: 0 }, "none", `${why} count`); add(`c${j}.n${k + 1}`, lit, 0.001, { autoAlpha: 1 }, "none", `${why} count`); }); } (it.spans ?? []).forEach((sp, k) => { const lit = at + 0.25 + (m.spans * k) / Math.max(1, it.spans.length); put(`c${j}.s${k}`, { autoAlpha: 0, scaleY: 0.2 }); add(`c${j}.s${k}`, lit, 0.3, { autoAlpha: 1, scaleY: 1 }, "back.out(2)", `${why} span`); out(`c${j}.s${k}`); put(`c${j}.sl${k}`, { autoAlpha: 0, y: 6 }); add(`c${j}.sl${k}`, lit + 0.1, 0.25, { autoAlpha: 1, y: 0 }, "power2.out", `${why} span`); out(`c${j}.sl${k}`); }); return; } it.steps.forEach((st, s) => { const why = `goalpost ${it.n} step ${s}`; const prev = s > 0 ? it.steps[s - 1] : null; // The first is drawn where he says it; a later one lands once the old one's copy has moved. const shows = prev ? st.at + m.settle : st.at; put(`g${j}.${s}`, { autoAlpha: 0 }); add(`g${j}.${s}`, shows, 0.3, { autoAlpha: 1 }, "power2.out", why); put(`g${j}.${s}b`, { scaleX: 0, transformOrigin: "0% 50%" }); add(`g${j}.${s}b`, shows, m.draw, { scaleX: 1, transformOrigin: "0% 50%" }, "power2.out", why); const next = it.steps[s + 1]; if (!next) return; // Superseded: the bracket goes dashed and dim, and a copy of it moves to the new window. add(`g${j}.${s}`, next.at, 0.25, { autoAlpha: 0 }, "power1.in", `${why} moved`); put(`g${j}.${s}g`, { autoAlpha: 0 }); add(`g${j}.${s}g`, next.at, 0.3, { autoAlpha: 1 }, "power1.out", `${why} moved`); const dx = (next.off ? W + 40 : next.a) - st.a; put(`g${j}.${s}m`, { autoAlpha: 0, x: 0 }); add(`g${j}.${s}m`, next.at, 0.001, { autoAlpha: 1 }, "none", `${why} moves`); add(`g${j}.${s}m`, next.at + 0.05, m.move, { x: r4(dx) }, "power2.in", `${why} moves`); add(`g${j}.${s}m`, next.at + 0.05 + m.move, 0.001, { autoAlpha: 0 }, "none", `${why} moves`); }); }); } /** * The claims' markup, as two strings: `track` goes inside the deck's * `.track` (positions are relative to it: x as the page's, y from the * track), `text` inside the panel over the segments' words. `lay` is the * deck's layout, `pal` the palette, `ground(x)` the panel's colour at the * track's height at x (what a veil is, so it dims the rail and no more). */ export function claimsMarkup(cl, { lay, pal, ground, pipSize }) { const tr = lay.pipTrack; const t = lay.text; const red = CLAIM_RED; const track = []; const text = []; // The band runs from the deck's top to under the record's counts. const bandTop = 2 - tr.y; const bandBottom = 34; const coTop = tr.y + 36; const ring = Math.max(18, pipSize + 10); cl.items.forEach((it, j) => { if (it.kind === "count") { if (it.band) { track.push( `
`, ); it.veils.forEach(([a, b], v) => { track.push(`
`); }); it.tags.forEach((tg, k) => { track.push(`
`); if (!tg.covered) track.push(`
+${tg.count}
`); }); } (it.spans ?? []).forEach((sp, k) => { track.push(`
${sp.bars.map((bar) => `
`).join("")}
`); track.push(`
${esc(sp.label)}
`); }); // His words, and the record under them. let record; if (it.band) { const values = [0]; for (const tg of it.tags) values.push(values[values.length - 1] + tg.count); const digits = String(values[values.length - 1]).length; record = `` + values.map((v, k) => `${v}`).join("") + `${esc(it.noun)} on camera`; } else if (it.spans?.length) { record = `${it.spans.map((sp) => esc(sp.label)).join('·')}`; } else record = `none on camera`; text.push( `
` + `
${esc(it.said)}
${record}
`, ); return; } const labelTop = (lay.claimBand?.y ?? 3) - tr.y; const stickTop = labelTop + 20; it.steps.forEach((st, s) => { const box = (k, ghost = false) => `
` + (st.open ? `
` : "") + `
`; const stickX = st.align === "right" ? st.b - 1 : st.a + 1; const label = (ghost) => `
` + `
${esc(st.label)}
`; track.push(`
${box(`g${j}.${s}b`)}${label(false)}
`); if (s + 1 < it.steps.length) { track.push(`
${box(null, true)}${label(true)}
`); track.push(`
${box(null)}
`); } }); }); const css = ` /* The claim checks (deck.claims): his words against the record, in the alarm red. */ .cband { position: absolute; border-radius: 6px; background: rgba(229, 83, 75, 0.13); box-shadow: inset 0 0 0 1px rgba(229, 83, 75, 0.55); } .cveil { position: absolute; top: -13px; height: 26px; } .cring { position: absolute; border-radius: 50%; box-shadow: 0 0 0 3px ${red}, 0 0 16px 4px rgba(229, 83, 75, 0.55); } .cspan-set { position: absolute; left: 0; top: 0; width: 0; height: 0; } .cspan { position: absolute; top: -5px; height: 10px; border-radius: 5px; background: ${red}; box-shadow: 0 0 14px 3px rgba(229, 83, 75, 0.5); } .ctag { position: absolute; top: 12px; width: 100px; height: 22px; text-align: center; white-space: nowrap; font-family: 'DeckSansBold', sans-serif; font-size: ${MARKER_LABEL_SIZE}px; line-height: 22px; letter-spacing: 0.04em; color: ${red}; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); font-variant-numeric: tabular-nums; } .ctag.cspl { text-transform: uppercase; } .cco { position: absolute; white-space: nowrap; overflow: hidden; } .cco1 { font-family: 'DeckSansBold', sans-serif; font-size: ${CALLOUT.size1}px; line-height: ${CALLOUT.box1}px; color: ${pal.fg}; overflow: hidden; text-overflow: ellipsis; } .cco2 { font-size: ${CALLOUT.size2}px; line-height: ${CALLOUT.box2}px; color: ${pal.muted}; display: flex; align-items: baseline; } .cnum { position: relative; display: inline-block; height: ${CALLOUT.box2}px; margin-right: 0.3em; text-align: right; font-family: 'DeckSansBold', sans-serif; font-size: ${Math.round(CALLOUT.size2 * 1.2)}px; color: ${red}; font-variant-numeric: tabular-nums; } .cnum > span { position: absolute; right: 0; bottom: 0; } .cspans { font-family: 'DeckSansBold', sans-serif; color: ${red}; text-transform: uppercase; letter-spacing: 0.02em; } .csep { padding: 0 0.45em; color: ${pal.muted}; } .gstep { position: absolute; left: 0; top: 0; width: 0; height: 0; } .gbox { position: absolute; top: -10px; height: 20px; border: 2px solid ${red}; border-radius: 5px; transform-origin: 0 50%; background: rgba(229, 83, 75, 0.1); } .gbox.open { border-right: none; border-radius: 5px 0 0 5px; } .gbox.ghost { border-style: dashed; border-color: rgba(229, 83, 75, 0.6); background: none; } .garrow { position: absolute; right: -14px; top: 1px; width: 14px; height: 14px; background: ${red}; clip-path: polygon(0% 0%, 100% 50%, 0% 100%); } .gbox.ghost .garrow { background: rgba(229, 83, 75, 0.6); } .gstick { position: absolute; width: 2px; background: ${red}; } .gstick.ghost { background: rgba(229, 83, 75, 0.45); } .glabel { position: absolute; height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'DeckSansBold', sans-serif; font-size: ${MARKER_LABEL_SIZE}px; line-height: 20px; letter-spacing: 0.04em; text-transform: uppercase; color: ${red}; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); } .glabel.ghost { color: rgba(229, 83, 75, 0.5); }`; return { track: track.join(""), text: text.join(""), css }; } // --------------------------------------------------------------------------- // The finale's large rail (chrome-finale.mjs): every claim's final state. // --------------------------------------------------------------------------- // The claims' places on the large rail (finaleClaims) are finale.mjs's: the // deck's schedule measures the room they need with them (deck.mjs finaleRail). export { finaleClaims } from "./finale.mjs"; /** * The finale's claims as markup and the keys its cues reveal (`fq`, one * per claim), from finaleClaims. `ground` is the rail panel's colour at the * track (a veil's); `Y` the track's y. */ export function finaleClaimsMarkup(fc, { Y, ground, size, pal }) { const red = CLAIM_RED; const html = []; const keys = []; const rowTop = (row) => Y - aboveTop(row, size); const labelHtml = (l) => { const top = rowTop(l.row); const stickTop = top + Math.round(size * 1.25); return ( (l.stickX === null ? "" : `
`) + // The words sit at the end of their box their stick is nearer (the box is the measure's generous width). `
` + (l.lead ? `${esc(l.lead)} ` : "") + `${esc(l.said)}${l.record ? ` ${esc(l.record)}` : ""}
` ); }; for (const it of fc.items) { const k = `fq${it.j}`; keys.push(k); const parts = []; if (it.kind === "count") { if (it.band) { const bt = aboveTop(0, size) + 4; parts.push(`
`); } for (const [a, b] of it.veils) parts.push(`
`); for (const d of it.dots) { parts.push(`
`); } for (const rg of it.rings) parts.push(`
`); for (const sp of it.spans) { for (const bar of sp.bars) parts.push(`
`); // On its bar (row 0), else higher with a leader down to the bar. const top = rowTop(sp.row ?? 0); if ((sp.row ?? 0) > 0) { const from = top + aboveLine(size); parts.push(`
`); } const bw = Math.max(240, Math.ceil(sp.w ?? 0) + 24); parts.push(`
${esc(sp.label)}
`); } parts.push(labelHtml(it.label)); } else { for (const st of it.steps) { parts.push( `
` + (st.open ? `
` : "") + `
`, ); parts.push(labelHtml(st.label)); } } html.push(`
${parts.join("")}
`); } const css = ` /* The claim checks' final state (deck.claims). */ .fq { position: absolute; left: 0; top: 0; width: 0; height: 0; } .fqband { position: absolute; border-radius: 8px; background: rgba(229, 83, 75, 0.12); box-shadow: inset 0 0 0 1.5px rgba(229, 83, 75, 0.55); } .fqveil { position: absolute; height: 8px; opacity: 0.72; } .fqveil.dot { border-radius: 50%; } .fqring { position: absolute; border-radius: 50%; box-shadow: 0 0 0 3px ${red}, 0 0 18px 5px rgba(229, 83, 75, 0.5); } .fqspan { position: absolute; height: 14px; border-radius: 7px; background: ${red}; box-shadow: 0 0 16px 4px rgba(229, 83, 75, 0.5); } .fqspl { position: absolute; width: 240px; text-align: center; white-space: nowrap; font-family: 'DeckSansBold', sans-serif; font-size: ${size}px; line-height: ${Math.round(size * 1.25)}px; letter-spacing: 0.04em; text-transform: uppercase; color: ${red}; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); } .fqbox { position: absolute; height: 30px; border: 3px solid ${red}; border-radius: 7px; background: rgba(229, 83, 75, 0.1); } .fqbox.open { border-right: none; border-radius: 7px 0 0 7px; } .fqbox.ghost { border-style: dashed; border-color: rgba(229, 83, 75, 0.6); background: none; } .fqarrow { position: absolute; right: -20px; top: 2px; width: 20px; height: 20px; background: ${red}; clip-path: polygon(0% 0%, 100% 50%, 0% 100%); } .fqbox.ghost .fqarrow { background: rgba(229, 83, 75, 0.6); } .fqstick { position: absolute; width: 3px; background: ${red}; } .fqstick.ghost { background: rgba(229, 83, 75, 0.45); } .fqlabel { position: absolute; white-space: nowrap; font-family: 'DeckSansBold', sans-serif; font-size: ${size}px; line-height: ${Math.round(size * 1.25)}px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); } .fqsaid { color: ${pal.fg}; } .fqlead { color: ${pal.muted}; } .fqrec { color: ${red}; } .fqlabel.ghost .fqsaid, .fqlabel.ghost .fqrec { color: rgba(229, 83, 75, 0.5); }`; return { html: html.join(""), keys, css }; }