// THE DIAL'S FINALE (module `dial-finale`, region `dial-finale`): the finale // (module `finale`) with the instruments large in its lower column -- the // dial's needle dropping from his highest remembered weight to his last // stated one, the odometer rolling up to the whole record's total, NET // holding beside it. A window over the finale's, laid OVER the finale (z 95): // the finale's ground covers the column's instruments while it is up. On with // the dial unless `deck.dial.finale` is false; it needs the finale's lower // column clear of stats cards (`deck.finale.stats`). chrome-instruments.mjs // writes the page. import path from "node:path"; import { snapWindow } from "../deck.mjs"; import { dialFinaleGeometry, dialFinaleHtml } from "../chrome-instruments.mjs"; import { resolveDial } from "../instruments.mjs"; import { assertRegion, defineModule } from "./contract.mjs"; import { hasMeasure, instrumentFonts, noMeasure } from "./instruments-shared.mjs"; const wanted = (render) => resolveDial(render)?.finale === true; export default defineModule({ id: "dial-finale", version: 1, z: 95, kind: "overlay-window", slot: "full", // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "finale" }, title: "Dial finale", summary: "The finale with the dial and the odometer large: the needle drops to his last stated weight, the wheels roll to the total, NET holds.", docs: { heading: "Dial finale", intro: "With the dial on (`deck.dial`) and a finale (a run of `layout: \"finale\"` clips), the finale's lower column -- beside the clip, under the finale's totals when it draws them -- carries the instruments large over the finale's window: in over the finale's grow, the needle dropping (1.8 s, `back.out`) from his highest remembered weight (the measure's `totals.peakDrift` and remembered weights) to his last stated one (`totals.net.to`), every ghost tick and the latest goal on the bezel; the odometer rolling up from zero to the whole record's `totals.lost` (the rows the cut never shows included) with `ACROSS N RUNS`; NET (`totals.net`) held beside it; out through the finale's dissolve. Laid over the finale (z 95), in Play too. It needs the lower column clear: a finale with stats cards (`deck.finale.stats`) is refused -- set `deck.dial.finale` false, or drop the cards.", rows: [ ["`deck.dial.finale`", "bool ยท default `true` (with the dial on)", "`umtool look
deck.dial.finale=false`"], ], }, region: "dial-finale", // Out through the finale's dissolve, as the finale: full-frame.mjs `ownFade`. fullFrame: { ownFade: true }, workers: "narrow", noun: "the dial finale's", on: (schedule, render) => !!schedule?.finale && hasMeasure(schedule) && wanted(render), check: (schedule, render) => { if (!schedule.finale) return "the dial's finale needs a schedule with a finale (a clip with layout \"finale\")"; if (!hasMeasure(schedule)) return noMeasure("dial's finale"); if (!dialFinaleGeometry(schedule, render)) { return "the dial's finale needs the finale's lower column clear: its stats cards (render.chrome.deck.finale.stats) fill it -- drop them, or set render.chrome.deck.dial.finale false"; } return null; }, window: (schedule, { fps, total }) => snapWindow({ segment: "dial-finale", from: schedule.finale.from, to: schedule.finale.to }, { fps, total }), names: ({ preview }) => ({ project: `dial-finale${preview ? "-preview" : ""}`, stem: "dial-finale" }), async page(ctx) { // `deck.dial.finaleEnd: "promise"` hands off only to a promise module this cut draws (measure-extras'). const { moduleById } = await import("./index.mjs"); const promise = moduleById("promise"); const on = !!promise && (typeof promise.on !== "function" || !!promise.on(ctx.schedule, ctx.render)); return dialFinaleHtml(ctx.schedule, ctx.render, ctx.window, { fonts: await instrumentFonts(ctx), promise: on }); }, /** Over the finale's window, laid at its own second (the finale's own regions, finale.mjs). */ regions(schedule, { render, outDir, shift = 0, clip = null }) { const f = schedule?.finale; if (!f || !hasMeasure(schedule)) return []; const g = dialFinaleGeometry(schedule, render); if (!g) return []; const fps = Number(schedule.fps ?? render.fps); const s = snapWindow({ segment: "dial-finale", from: f.from, to: f.to }, { fps, total: schedule.total }); if (clip && !(s.from < clip.at + clip.dur && s.to > clip.at)) return []; return [assertRegion({ name: "dial-finale", frames: path.join(outDir, "chrome", "dial-finale-frames"), ...g, offset: s.from - shift, frameCount: s.frames, window: s, }, "window")]; }, play: { clock: "cut", ready: "dial-finale:ready" }, // A window of the cut, as the finale's: its frame n is cut time `from` + n / fps. frameKeys: { data: "dial-finale-data", omit: ["init", "cues", "from", "dur"], offset: "from" }, });