diff --git a/media/teaser/README.md b/media/teaser/README.md index 33cc4535..ad0ecca9 100644 --- a/media/teaser/README.md +++ b/media/teaser/README.md @@ -1,4 +1,4 @@ -# storebound teaser (42 s, 16:9) +# storebound teaser (55.5 s, 16:9) A calm, scripted motion piece: from an empty folder to everything ready on both stores. Every frame is a pure function of time, rendered from an HTML/CSS/JS timeline in headless Chrome and encoded with ffmpeg. The music and the sound @@ -18,13 +18,16 @@ has one plain-English caption at the top, fully on screen for at least 3 s; belo | 19-23.5 | `play products --dry` (174 regions), then `catalog diff` (175 / 174 region prices, 0 mismatches) | In-app products on both stores, priced in 175 countries. | | 23.5-28.5 | the scan's declarations proposal: detected answers with file:line, one "ask owner" line highlighted; 764 Data safety answers | The forms, answered from your code. It asks what it can't know. | | 28.5-33.5 | `storebound scan`: three findings, each with a plain reason; fixed, the re-scan is clean | It catches rejections before Apple does. | -| 33.5-38 | the desktop app: the release timeline with both stores on one track, then Store readiness: "No blockers" | Both stores, one view. Ready for review. | -| 38-42 | "Submit for Review" with the cursor resting on it (it never clicks), then the end card: storebound.dev, Open source · CLI · Desktop app | You press Submit. That's it. | +| 33.5-38 | the desktop app's Portfolio: every app of three studios, App Store and Google Play per app, rollout %, crash-rate sparklines | Stop switching between two consoles. Every app, both stores, one window. | +| 38-42.5 | the Growth chart (visx) with the pointer sweeping across it, the crosshair and tooltip moving day by day; then the Health tab's crash rate, swept the same way | Installs, conversion and crashes, charted. | +| 42.5-47 | the Prices tab: products x key territories, both stores' prices per country, the gaps between them marked | Products and prices on both stores, side by side. | +| 47-51.5 | the release timeline with both stores on one track, then Store readiness: "No blockers" | Both stores, one view. Ready for review. | +| 51.5-55.5 | "Submit for Review" with the cursor resting on it (it never clicks), then the end card: storebound.dev, Open source · CLI · Desktop app | You press Submit. That's it. | | file | what | |---|---| | `script.js` | the timeline: scenes in seconds, camera moves, captions, every line shown, the sound cues | -| `desktop.ts` | the desktop frames: apps/desktop's Vite dev server in fixture mode (`VITE_FIXTURES=1`, example.com-style data), captured headlessly in dark at 1280x800 @2x with the dev markers hidden, plus `boxes.json` (callout targets) -> `out/desktop/` | +| `desktop.ts` | the desktop frames: apps/desktop's Vite dev server in fixture mode (`VITE_FIXTURES=1`, example.com-style data), captured headlessly in dark at 1280x800 @2x with the dev markers hidden, plus `boxes.json` (callout targets, the hover sweeps) -> `out/desktop/`. The chart hovers are real: the mouse moves across the chart in small steps and a frame is taken for every day the tooltip shows; the video moves its pointer the same way and shows the day it has reached | | `index.html` + `teaser.js` | the picture; `window.teaser.seek(t)` sets every element for time `t` | | `music.js` | music (D major, one chord per scene: pads, a slow soft pluck, a quiet sub) and soft sound design: a bell and an airy swell on each scene change, key clicks, quiet ticks, chimes for the fixes | | `render.ts` | frames at 60 fps blended to 30 fps -> ffmpeg (H.264 high, yuv420p), sound -> loudnorm (-16 LUFS, -1.5 dBTP), mux, poster, the 1280x720 web version | @@ -45,7 +48,9 @@ clock prefix and the "(0s)" timer left out): The plain reasons under the findings and the callouts on the desktop frames are annotations, set apart from the CLI text. The store text is `examples/demo-game/store/shots/copy.json`, the screenshots its real renders, the app icon its `store/icon/icon.png`. The mail row is fictional: no real names or addresses, no mail-app branding. The test also checks -the timing: scenes 4-5 s, captions on screen at least 3 s, 38-46 s in total, 16:9 only. +the timing (scenes 4-5 s, captions on screen at least 3 s, 50-60 s in total, 16:9 only) and that every desktop frame a +scene names is one `desktop.ts` captures, and, where they were captured, that each file is there (2560x1600 JPEG, one +sweep frame per hovered day). ## Render @@ -55,11 +60,11 @@ game's store renders: ```sh cd examples/demo-game && bun serve.ts & bun ../../cli/index.ts shots capture && bun ../../cli/index.ts shots fonts && bun ../../cli/index.ts shots render # from the repo root -bun media/teaser/render.ts > media/teaser/out/render.log 2>&1 & # master, sound, poster, web version: about 10 min +bun media/teaser/render.ts > media/teaser/out/render.log 2>&1 & # master, sound, poster, web version: about 15 min bun media/teaser/render.ts --desktop # capture the desktop app frames again (after a UI change) bun media/teaser/render.ts --stills 2,12.5,30 # PNG stills in out/stills for a quick layout check bun media/teaser/render.ts --serve --port 8750 # live preview: /index.html?play=1 (or ?t=12.5) ``` Outputs (gitignored) in `media/teaser/out/`: `teaser-1920x1080.mp4` (master), `teaser-web.mp4` (1280x720, about -4.5 MB) with `poster-web.jpg`, `teaser-1920x1080-silent.mp4`, `poster-1920x1080.jpg`, `music.wav`. +6 MB) with `poster-web.jpg`, `teaser-1920x1080-silent.mp4`, `poster-1920x1080.jpg`, `music.wav`. diff --git a/media/teaser/desktop.ts b/media/teaser/desktop.ts index 4fdb814d..63cdafc4 100644 --- a/media/teaser/desktop.ts +++ b/media/teaser/desktop.ts @@ -1,9 +1,16 @@ #!/usr/bin/env bun -// Real desktop-app frames for the teaser's desktop scene: the Vite dev server of apps/desktop in fixture mode +// Real desktop-app frames for the teaser's desktop scenes: the Vite dev server of apps/desktop in fixture mode // (VITE_FIXTURES=1: example.com-style fixture data, no Tauri, no store accounts), captured headlessly, dark theme, // with the two dev-build markers hidden (they are not in a release build). // Writes media/teaser/out/desktop/*.jpg plus boxes.json (callout targets, as fractions of the frame). // portfolio.jpg Portfolio: every app of every studio, grouped by studio +// portfolio-apps.jpg the same, scrolled to the Apps table: both stores per app, rollout %, crash-rate sparklines +// growth.jpg Prism Puddle's Growth tab: the store analytics chart (visx), pointer outside +// growth-NN.jpg the same while the pointer (real mouse moves) sweeps across the chart: one frame per hovered +// day, the crosshair and tooltip showing that day's impressions, downloads and conversion +// health.jpg the Health tab: the crash and ANR rate charts, pointer outside +// health-NN.jpg the pointer sweeping across the crash-rate chart, one frame per hovered day +// prices.jpg the Prices tab: products x key territories, both stores' prices per country, gaps marked // releases.jpg Prism Puddle's release timeline, both stores rolling out at 20% // releases-empty.jpg the same frame with the rollout bars' fill and "20%" hidden (the video fills the bar) // checks.jpg the Checks tab: the "Rejection risks" card with its findings @@ -23,6 +30,13 @@ export const VIEW = { width: 1280, height: 800 }; const log = (m: string): void => console.log(`${new Date().toISOString().slice(11, 19)} [desktop] ${m}`); type Box = { x: number; y: number; w: number; h: number }; +/** One frame of a hover sweep: the pointer position (fraction of the frame) at which this day starts to show. */ +type SweepFrame = { file: string; px: number; py: number; day: string }; +/** Hover sweeps: the chart, the part of its width the pointer crosses, the height it moves at. */ +const SWEEPS = { + growth: { start: 'app:growth', svg: '.lchart svg', x: [0.2, 0.86], y: 0.42 }, + health: { start: 'app:health', svg: '.card:has-text("User-perceived crash rate") .spark svg', x: [0.12, 0.9], y: 0.45 }, +} as const; export async function captureDesktop(): Promise { mkdirSync(OUT, { recursive: true }); @@ -39,6 +53,7 @@ export async function captureDesktop(): Promise { } const browser = await launch(ROOT, { headless: true }); const boxes: Record = {}; + const sweeps: Record = {}; const errors: string[] = []; const session = async (clean: boolean) => { @@ -83,6 +98,57 @@ export async function captureDesktop(): Promise { await box(a.page, 'table', a.page.locator('table').first()); await shot(a.page, 'portfolio'); + // the Apps table: both stores per app, rollouts, crash-rate sparklines + await a.page.evaluate(() => document.getElementById('content')?.scrollBy({ top: 140 })); + await a.page.waitForTimeout(300); + await box(a.page, 'appsTable', a.page.locator('table').first()); + await box(a.page, 'prismRow', a.page.locator('tr').filter({ hasText: 'Prism Puddle' }).first()); + await shot(a.page, 'portfolio-apps'); + + // charts: the Growth tab's store analytics and the Health tab's crash rate, then a pointer sweep across each + const sweep = async (name: keyof typeof SWEEPS, scroll: number): Promise => { + const sw = SWEEPS[name]; + await open(a.page, sw.start); + if (scroll) await a.page.evaluate((y: number) => document.getElementById('content')?.scrollBy({ top: y }), scroll); + await a.page.waitForTimeout(300); + await shot(a.page, name); + const svg = a.page.locator(sw.svg).first(); + const b = await svg.boundingBox(); + if (!b) throw new Error(`no chart for ${name}`); + const y = b.y + b.height * sw.y; + const frames: SweepFrame[] = []; + let last = ''; + for (let x = b.x + b.width * sw.x[0]; x <= b.x + b.width * sw.x[1]; x += 2) { + await a.page.mouse.move(x, y); + // the tooltip's text names the hovered day (and its values): a new text = a new day + const day = ((await a.page.locator('.vx-tip').first().textContent({ timeout: 2000 }).catch(() => '')) ?? '').trim(); + if (!day || day === last) continue; + last = day; + const file = `${name}-${String(frames.length).padStart(2, '0')}`; + await a.page.waitForTimeout(60); + await a.page.screenshot({ path: join(OUT, `${file}.jpg`), type: 'jpeg', quality: 93 }); + frames.push({ file, px: x / VIEW.width, py: y / VIEW.height, day }); + } + if (frames.length < 8) throw new Error(`${name}: the sweep hovered only ${frames.length} days`); + sweeps[name] = frames; + }; + await sweep('growth', 150); + await box(a.page, 'growthPlot', a.page.locator('.lchart-plot').first()); + await sweep('health', 0); + await box(a.page, 'crashCard', a.page.locator('.card').filter({ hasText: 'User-perceived crash rate' }).first()); + + // prices: products x key territories, both stores' prices per country, the gaps marked + await open(a.page, 'app:prices'); + const matrix = a.page.locator('.card').filter({ hasText: 'Products x key territories' }).first(); + await matrix.evaluate((el: HTMLElement) => { + el.scrollIntoView({ block: 'start' }); + document.getElementById('content')?.scrollBy({ top: -125 }); + }); + await a.page.waitForTimeout(300); + await box(a.page, 'priceMatrix', matrix); + await box(a.page, 'priceGap', matrix.locator('.chip').filter({ hasText: /Δ 2\d/ }).first()); + await shot(a.page, 'prices'); + await open(a.page, 'app:releases'); // the release timeline (both stores, rollout bars) at the top of the frame await a.page.locator('.tl-lane').first().evaluate((el: HTMLElement) => { @@ -123,10 +189,12 @@ export async function captureDesktop(): Promise { await shot(b.page, 'ready'); await b.ctx.close(); - writeFileSync(join(OUT, 'boxes.json'), `${JSON.stringify(boxes, null, 1)}\n`); + const source = 'apps/desktop, Vite dev server, VITE_FIXTURES=1, headless Chromium 1280x800 @2x, dark'; + writeFileSync(join(OUT, 'boxes.json'), `${JSON.stringify({ ...boxes, source, sweeps }, null, 1)}\n`); await browser.close(); if (errors.length) throw new Error(`page errors:\n ${[...new Set(errors)].join('\n ')}`); - log(`6 frames + boxes.json -> ${OUT}`); + const n = 9 + Object.values(sweeps).reduce((k, f) => k + f.length, 0); + log(`${n} frames (${Object.entries(sweeps).map(([k, f]) => `${k} sweep: ${f.length} days`).join(', ')}) + boxes.json -> ${OUT}`); } finally { vite.kill(); } diff --git a/media/teaser/index.html b/media/teaser/index.html index d341d714..377da224 100644 --- a/media/teaser/index.html +++ b/media/teaser/index.html @@ -171,7 +171,7 @@ html, body { margin: 0; padding: 0; background: #000; overflow: hidden; } .fd .fixed { font: 800 22px/1 var(--mono); color: #052e16; background: var(--green); border-radius: 8px; padding: 6px 12px; opacity: 0; } #rescan .ln { display: block; opacity: 0; } -/* ---------- 8 desktop window ---------- */ +/* ---------- 8-11 desktop window ---------- */ .win { position: absolute; border-radius: 20px; overflow: hidden; background: #0b0f19; border: 1.5px solid rgba(255,255,255,.12); box-shadow: 0 50px 120px rgba(0,0,0,.65), 0 0 0 1px rgba(0,0,0,.6); } .win .bar { position: absolute; left: 0; right: 0; top: 0; height: 40px; background: #161b27; border-bottom: 1px solid #222a3a; @@ -180,7 +180,12 @@ html, body { margin: 0; padding: 0; background: #000; overflow: hidden; } .win .bar .tt { position: absolute; left: 0; right: 0; text-align: center; font: 600 17px/1 var(--text); color: #8a93a6; } .win .view { position: absolute; left: 0; right: 0; top: 40px; bottom: 0; overflow: hidden; } .win .view .cam2 { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; transform-origin: 0 0; } +.win .view .grp { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; } .win .view img { position: absolute; left: 0; top: 0; display: block; width: 1280px; height: 800px; } +/* the pointer of a chart's hover sweep (same arrow as #cursor) */ +.dcur { position: absolute; z-index: 6; width: 52px; height: 52px; left: 0; top: 0; opacity: 0; + filter: drop-shadow(0 0 1.5px #000) drop-shadow(0 0 1.5px #000) drop-shadow(0 8px 12px rgba(0,0,0,.55)); } +.dcur .pi { position: absolute; inset: 0; width: 100%; height: 100%; color: #fff; } .callout { position: absolute; z-index: 5; font: 800 32px/1 var(--display); color: #fff; background: var(--accent-2); padding: 16px 26px; border-radius: 16px; white-space: nowrap; box-shadow: 0 20px 50px rgba(0,0,0,.55), 0 0 0 3px rgba(255,255,255,.12); transform-origin: 50% 100%; opacity: 0; } @@ -251,6 +256,9 @@ html, body { margin: 0; padding: 0; background: #000; overflow: hidden; }
Terminal
+
+
+
diff --git a/media/teaser/music.js b/media/teaser/music.js index 59fe7661..e9b8c529 100644 --- a/media/teaser/music.js +++ b/media/teaser/music.js @@ -17,7 +17,7 @@ function rng(seed) { // mulberry32 const CH = { Bm: [47, [0, 3, 7, 14]], G: [43, [0, 4, 7, 14]], D: [50, [0, 4, 7, 11]], A: [45, [0, 4, 7, 14]], Em: [52, [0, 3, 7, 10]], Dadd9: [50, [0, 4, 7, 14]], }; -const SCENE_CHORD = { hook: 'Bm', init: 'G', plan: 'D', store: 'A', products: 'Bm', forms: 'G', rejections: 'Em', desktop: 'A', submit: 'D' }; +const SCENE_CHORD = { hook: 'Bm', init: 'G', plan: 'D', store: 'A', products: 'Bm', forms: 'G', rejections: 'Em', portfolio: 'G', charts: 'D', catalog: 'Bm', desktop: 'A', submit: 'D' }; const ARP = [0, 1, 2, 3, 2, 1, 2, 3]; const STEP = 0.5; // one soft note every half second diff --git a/media/teaser/render.ts b/media/teaser/render.ts index 28f2ab21..d516e1f0 100644 --- a/media/teaser/render.ts +++ b/media/teaser/render.ts @@ -21,8 +21,8 @@ const args = process.argv.slice(2); const opt = (k: string): string | undefined => { const i = args.indexOf(`--${k}`); return i >= 0 ? args[i + 1] : undefined; }; /** 16:9 only. */ const FORMAT = { w: 1920, h: 1080 }; -/** The web version: 1280x720 H.264, two-pass to about this many bytes. */ -const WEB_BYTES = 4.5e6; +/** The web version: 1280x720 H.264, two-pass to about this many bytes (about 860 kbps for 55 s, as v5 had for 42 s). */ +const WEB_BYTES = 6e6; const CAPTURE_FPS = 60; const log = (m: string): void => console.log(`${new Date().toISOString().slice(11, 19)} [teaser] ${m}`); @@ -143,7 +143,7 @@ async function main(): Promise { log(`${out} (${(statSync(out).size / 1e6).toFixed(1)} MB)`); } - // web version: 1280x720 H.264, about 4.5 MB (two-pass), plus its poster + // web version: 1280x720 H.264, about 6 MB (two-pass), plus its poster const h = join(OUT, 'teaser-1920x1080.mp4'); if (existsSync(h)) { const web = join(OUT, 'teaser-web.mp4'), pass = join(OUT, 'web-pass'); diff --git a/media/teaser/script.js b/media/teaser/script.js index a0c03772..c3be9df5 100644 --- a/media/teaser/script.js +++ b/media/teaser/script.js @@ -1,5 +1,5 @@ -// Teaser timeline (v5): the single source of truth for the picture (teaser.js) and the sound (music.js). -// One idea per scene, 4-5 s each (about 42 s in all), one camera move per scene with a quick ease-out, short dissolves +// Teaser timeline (v6): the single source of truth for the picture (teaser.js) and the sound (music.js). +// One idea per scene, 4-5 s each (about 55 s in all), one camera move per scene with a quick ease-out, short dissolves // on the cuts (no whips, no rapid montages). Long terminal output streams faster instead of being cut. Every scene has // one plain-English caption at the top that is fully on screen for at least 3 s; the lower part shows the real // product: CLI output and desktop-app frames. @@ -22,7 +22,7 @@ export const FPS = 30; export const FORMAT = { w: 1920, h: 1080 }; /** Scene lengths in seconds (4-5 s each). The next scene dissolves in over DISSOLVE s centred on the cut. */ -const LENGTHS = [['hook', 4.5], ['init', 4.5], ['plan', 5], ['store', 5], ['products', 4.5], ['forms', 5], ['rejections', 5], ['desktop', 4.5], ['submit', 4]]; +const LENGTHS = [['hook', 4.5], ['init', 4.5], ['plan', 5], ['store', 5], ['products', 4.5], ['forms', 5], ['rejections', 5], ['portfolio', 4.5], ['charts', 4.5], ['catalog', 4.5], ['desktop', 4.5], ['submit', 4]]; export const SCENES = LENGTHS.reduce((a, [id, len]) => { const start = a.at(-1)?.end ?? 0; return [...a, { id, start, end: start + len }]; }, []); export const DURATION = SCENES.at(-1).end; export const DISSOLVE = 0.4; @@ -40,7 +40,11 @@ export const CAMERA = { products: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.06, x: 0, y: -10 } }, forms: { from: { z: 1.02, x: 30, y: 0 }, to: { z: 1.02, x: -30, y: 0 } }, rejections: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.05, x: 0, y: -12 } }, - desktop: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.0, x: 0, y: 0 } }, // the push happens inside the app window + // the desktop scenes: the push happens inside the app window (DESK) + portfolio: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.0, x: 0, y: 0 } }, + charts: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.0, x: 0, y: 0 } }, + catalog: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.0, x: 0, y: 0 } }, + desktop: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.0, x: 0, y: 0 } }, submit: { from: { z: 1.0, x: 0, y: 0 }, to: { z: 1.05, x: 0, y: 0 } }, }; @@ -53,6 +57,9 @@ export const CAPTIONS = [ { id: 'products', lines: ['In-app products on both stores,', 'priced in *175 countries.*'] }, { id: 'forms', lines: ['The forms, answered from your code.', 'It asks what it *can\'t know.*'] }, { id: 'rejections', lines: ['It catches rejections *before Apple does.*'], hl: 'green' }, + { id: 'portfolio', lines: ['Stop switching between two consoles.', 'Every app, both stores, *one window.*'] }, + { id: 'charts', lines: ['Installs, conversion and crashes, *charted.*'] }, + { id: 'catalog', lines: ['Products and prices on both stores, *side by side.*'] }, { id: 'desktop', lines: ['Both stores, one view. *Ready for review.*'] }, { id: 'submit', lines: ['You press *Submit.* That\'s it.'] }, ]; @@ -197,17 +204,44 @@ export const FIX_AT = [2.7, 2.95, 3.2]; export const RESCAN_AT = 3.6; export const RESCAN_LINE = 'Rejection risks: 0 blocker, 0 high, 0 medium, 0 low'; -// ---------- 8 desktop: the release timeline (both stores), then Store readiness: no blockers ---------- -/** Real frames (desktop.ts). The camera pushes from the timeline to the readiness card; the frames dissolve between. */ -export const DESKTOP = { - frames: ['releases', 'ready'], - swap: [2.1, 2.6], - cam: { from: { f: [0.56, 0.42], z: 1.0 }, to: { f: [0.8, 0.4], z: 1.22 } }, - callouts: [ - { at: 0.7, until: 2.0, target: 'timeline', text: 'App Store + Google Play, one track' }, - { at: 2.9, until: 5, target: 'readyEmpty', text: 'Validate: 0 blockers on both', green: true }, - ], +// ---------- 8-11 desktop: the app as the one console for both stores ---------- +/** Real frames of the desktop app in fixture mode (desktop.ts), one entry per scene. groups: what the window shows, in + * order; a group is one frame, or a frame plus a hover sweep (the pointer glides across a chart, the crosshair and + * tooltip follow it day by day: one captured frame per hovered day, pointer positions in boxes.json). swap: the + * dissolve from group 1 to group 2 (seconds into the scene). cam: one push, f = focus point (fraction of the 1280x800 + * frame), z = zoom. callouts: one per scene, on a box captured from the app (boxes.json). */ +export const DESK = { + portfolio: { + groups: [{ frame: 'portfolio-apps' }], + cam: { from: { f: [0.5, 0.42], z: 1.0 }, to: { f: [0.6, 0.6], z: 1.14 } }, + callouts: [{ at: 1.1, until: 5, target: 'prismRow', text: 'Both stores per app: rollout, crash rate' }], + }, + charts: { + groups: [{ frame: 'growth', sweep: { seq: 'growth', at: 0.55, d: 1.75 } }, { frame: 'health', sweep: { seq: 'health', at: 2.85, d: 1.35 } }], + swap: [2.35, 2.75], + cam: { from: { f: [0.55, 0.5], z: 1.0 }, to: { f: [0.55, 0.6], z: 1.1 } }, + callouts: [{ at: 0.7, until: 2.4, target: 'growthPlot', text: "Every day, the stores' own numbers" }], + }, + catalog: { + groups: [{ frame: 'prices' }], + cam: { from: { f: [0.55, 0.4], z: 1.0 }, to: { f: [0.72, 0.42], z: 1.14 } }, + callouts: [{ at: 1.2, until: 5, target: 'priceGap', text: 'Price gap between the stores, per country' }], + }, + // v5's desktop scene, unchanged: the release timeline, then Store readiness (validate): no blockers + desktop: { + groups: [{ frame: 'releases' }, { frame: 'ready' }], + swap: [2.1, 2.6], + cam: { from: { f: [0.56, 0.42], z: 1.0 }, to: { f: [0.8, 0.4], z: 1.22 } }, + callouts: [ + { at: 0.7, until: 2.0, target: 'timeline', text: 'App Store + Google Play, one track' }, + { at: 2.9, until: 5, target: 'readyEmpty', text: 'Validate: 0 blockers on both', green: true }, + ], + }, }; +export const DESK_SCENES = Object.keys(DESK); +/** Every captured frame a desktop scene names (sweep frames are listed in boxes.json by desktop.ts). */ +export const DESK_FRAMES = [...new Set(Object.values(DESK).flatMap(d => d.groups.map(g => g.frame)))]; +export const DESK_SWEEPS = Object.values(DESK).flatMap(d => d.groups.filter(g => g.sweep).map(g => g.sweep.seq)); // ---------- 9 submit + end card ---------- export const SUBMIT = { hover: 1.0, logoAt: 2.0, logoIn: 0.6 }; @@ -233,7 +267,7 @@ export function ticks() { ...DATA_SAFETY_ROWS.map((_, i) => ({ t: at('forms') + FORM_AT + i * FORM_STEP, kind: 'tiny' })), ...FINDINGS.map(f => ({ t: at('rejections') + f.at, kind: 'low' })), ...FIX_AT.map((t, i) => ({ t: at('rejections') + t, kind: 'good', step: i })), - ...DESKTOP.callouts.map(c => ({ t: at('desktop') + c.at, kind: 'soft' })), + ...DESK_SCENES.flatMap(id => DESK[id].callouts.map(c => ({ t: at(id) + c.at, kind: 'soft' }))), ]; } /** Seconds at which each typed character lands (soft key clicks). */ diff --git a/media/teaser/teaser.js b/media/teaser/teaser.js index cf988969..17d41085 100644 --- a/media/teaser/teaser.js +++ b/media/teaser/teaser.js @@ -1,7 +1,7 @@ -// Teaser picture (v5): every element is set from the time t alone (window.teaser.seek(t)), so frames render +// Teaser picture (v6): every element is set from the time t alone (window.teaser.seek(t)), so frames render // deterministically, in any order. 16:9 only (1920x1080). URL: &t=12.5 holds a frame, &play=1 previews in real time. import { APP_NAME, ASK_AT, CAMERA, CAP_DELAY, CAP_END, CAP_IN, CAP_OUT, CAPTIONS, captionTimes, COPY, COPY_AT, COPY_FILE, COPY_STEP, - DATA_SAFETY_ROWS, DECL_ASK, DECL_AT, DECL_LINES, DECL_STEP, DECL_TOTAL, DESKTOP, DISSOLVE, DURATION, FINDINGS, FIX_AT, FOLDER, + DATA_SAFETY_ROWS, DECL_ASK, DECL_AT, DECL_LINES, DECL_STEP, DECL_TOTAL, DESK, DESK_SCENES, DISSOLVE, DURATION, FINDINGS, FIX_AT, FOLDER, FORM_AT, FORM_STEP, FORMAT, FORMS_PILL, FPS, INIT_CMD, INIT_CPS, INIT_LINES, INIT_OUT_AT, INIT_STEP, INIT_TYPE_AT, MAIL, MAIL_IN, PLAN_AT, PLAN_CMD, PLAN_CMD_AT, PLAN_LINES, PLAN_PILL, PLAN_STEP, PRODUCT_LINES, PRODUCTS_PILL, PROMPT, PROMPT_AT, PROMPT_CPS, RESCAN_AT, RESCAN_LINE, RISKS_LINE, SCAN_CMD, SCENES, SHOT_LANGS, SHOT_SIZES, SHOTS_AT, SHOTS_CMD, SHOTS_PILL, SHOTS_STEP, @@ -292,39 +292,76 @@ function rejections(t) { appear(scanLns[3], r, RESCAN_AT + 0.35, 0.3, 6); } -// ---------- 8 desktop: real frames in a window, the camera pushes from the timeline to the readiness card ---------- +// ---------- 8-11 desktop: real frames in a window, one push per scene, one callout, hover sweeps on the charts ---------- const BOXES = await fetch('out/desktop/boxes.json').then(r => { if (!r.ok) throw new Error('out/desktop/boxes.json missing (bun media/teaser/desktop.ts)'); return r.json(); }); const WIN = { x: 370, y: 236, w: 1180, bar: 40 }; const VIEW = { w: WIN.w, h: WIN.w * 800 / 1280 }; WIN.h = VIEW.h + WIN.bar; const S0 = VIEW.w / 1280; -const deskCam = $('#s-desktop > .cam'); -deskCam.innerHTML = `
+const sweepOf = g => { + if (!g.sweep) return null; + const f = BOXES.sweeps?.[g.sweep.seq]; + if (!f?.length) throw new Error(`boxes.json: no "${g.sweep.seq}" sweep (bun media/teaser/desktop.ts)`); + return f; +}; +const desks = DESK_SCENES.map(id => { + const d = DESK[id], cam = $(`#s-${id} > .cam`); + const groups = d.groups.map(g => ({ g, sweep: sweepOf(g) })); + cam.innerHTML = `
storebound
-
${DESKTOP.frames.map((f, i) => ``).join('')}
- ${DESKTOP.callouts.map(c => `
${esc(c.text)}
`).join('')}`; -const cam2 = $('#s-desktop .cam2'), frameEls = [...cam2.querySelectorAll('img')]; -const rings = [...deskCam.querySelectorAll('.ring')], callouts = [...deskCam.querySelectorAll('.callout')]; -function deskView(r) { - const s = scene('desktop'), len = s.end - s.start; +
${groups.map((x, gi) => `
${(x.sweep ?? []).map(f => ``).join('')}
`).join('')}
+ ${d.callouts.map(c => `
${esc(c.text)}
`).join('')} + ${groups.some(x => x.sweep) ? '' : ''}`; + const grpEls = [...cam.querySelectorAll('.grp')]; + return { id, d, groups, cam2: cam.querySelector('.cam2'), grpEls, imgs: grpEls.map(g => [...g.querySelectorAll('img')]), + rings: [...cam.querySelectorAll('.ring')], callouts: [...cam.querySelectorAll('.callout')], cur: cam.querySelector('.dcur') }; +}); +function deskView(dk, r) { + const s = scene(dk.id), len = s.end - s.start; const p = ecam(clamp((r + DISSOLVE / 2) / (len + DISSOLVE))); - const { from, to } = DESKTOP.cam; + const { from, to } = dk.d.cam; const S = S0 * lerp(from.z, to.z, p), fx = lerp(from.f[0], to.f[0], p), fy = lerp(from.f[1], to.f[1], p); const ox = clamp(VIEW.w / 2 - fx * 1280 * S, VIEW.w - 1280 * S, 0), oy = clamp(VIEW.h / 2 - fy * 800 * S, VIEW.h - 800 * S, 0); return { S, ox, oy }; } const stageBox = (b, c) => ({ x: WIN.x + c.ox + b.x * 1280 * c.S, y: WIN.y + WIN.bar + c.oy + b.y * 800 * c.S, w: b.w * 1280 * c.S, h: b.h * 800 * c.S }); -function desktop(t) { - const s = scene('desktop'); if (t < s.start - 1 || t > s.end + 1) return; - const r = t - s.start; - const c = deskView(r); - set(cam2, 'transform', `translate(${c.ox.toFixed(2)}px, ${c.oy.toFixed(2)}px) scale(${c.S.toFixed(5)})`); - const sw = eio(prog(r, DESKTOP.swap[0], DESKTOP.swap[1] - DESKTOP.swap[0])); - set(frameEls[1], 'opacity', String(sw)); - DESKTOP.callouts.forEach((co, i) => { +/** A hover sweep at r: the pointer glides from the first hovered day's position to the last one's (ease in-out); the + * frame is the last day whose position the pointer has reached, as on the real chart. */ +function sweepAt(sw, f, r) { + const p = eio(prog(r, sw.at, sw.d)); + const px = lerp(f[0].px, f.at(-1).px, p), py = lerp(f[0].py, f.at(-1).py, p); + let k = -1; + if (r >= sw.at) { k = 0; while (k + 1 < f.length && f[k + 1].px <= px + 1e-9) k++; } + return { px, py, k }; +} +function deskScene(dk, t) { + const s = scene(dk.id); if (t < s.start - 1 || t > s.end + 1) return; + const r = t - s.start, d = dk.d; + const c = deskView(dk, r); + set(dk.cam2, 'transform', `translate(${c.ox.toFixed(2)}px, ${c.oy.toFixed(2)}px) scale(${c.S.toFixed(5)})`); + const sw = d.swap ? eio(prog(r, d.swap[0], d.swap[1] - d.swap[0])) : 0; + if (dk.grpEls[1]) set(dk.grpEls[1], 'opacity', String(sw)); + // the pointer: fades in just before its group's sweep, rests after it, fades with the dissolve to the next group + let cur = null; + dk.groups.forEach((x, gi) => { + if (!x.sweep) return; + const st = sweepAt(x.g.sweep, x.sweep, r); + dk.imgs[gi].forEach((im, i) => set(im, 'opacity', i === 0 || i === st.k + 1 ? '1' : '0')); + const vis = gi === 0 && d.swap ? 1 - prog(r, d.swap[0] - 0.2, 0.25) : 1; + const op = prog(r, x.g.sweep.at - 0.35, 0.3) * vis; + if (op > 0 && (!cur || op > cur.op)) cur = { ...st, op }; + }); + if (dk.cur) { + set(dk.cur, 'opacity', String(cur ? cur.op : 0)); + if (cur) { + const b = stageBox({ x: cur.px, y: cur.py, w: 0, h: 0 }, c); + set(dk.cur, 'transform', `translate(${(b.x - 10).toFixed(1)}px, ${(b.y - 10).toFixed(1)}px)`); + } + } + d.callouts.forEach((co, i) => { const b = stageBox(BOXES[co.target], c); const op = eoc(prog(r, co.at, 0.4)) * (1 - prog(r, co.until - 0.3, 0.3)); - const ring = rings[i], call = callouts[i]; + const ring = dk.rings[i], call = dk.callouts[i]; const x0 = Math.max(b.x - 10, WIN.x + 8), y0 = Math.max(b.y - 10, WIN.y + WIN.bar + 6); const x1 = Math.min(b.x + b.w + 10, WIN.x + WIN.w - 8), y1 = Math.min(b.y + b.h + 10, WIN.y + WIN.h - 8); set(ring, 'opacity', String(op)); @@ -339,6 +376,7 @@ function desktop(t) { set(call, 'transform', `translate(-50%, ${below ? '0' : '-100%'}) scale(${lerp(0.92, 1, eoc(prog(r, co.at, 0.4))).toFixed(3)})`); }); } +const desktop = t => desks.forEach(dk => deskScene(dk, t)); // ---------- 9 submit + end card ---------- const sbtn = $('#sbtn'), shov = $('#sbtn .hov'), brand = $('#brand'), cursorEl = $('#cursor'); diff --git a/tests/teaser.test.ts b/tests/teaser.test.ts index cdad7cfa..81219db0 100644 --- a/tests/teaser.test.ts +++ b/tests/teaser.test.ts @@ -1,8 +1,9 @@ -// The teaser video (media/teaser, v5): every CLI line it shows is real output of the command it names, each scene holds -// 4-5 s, each caption is fully on screen for at least 3 s, the whole cut is 38-46 s, and it is 16:9 only. +// The teaser video (media/teaser, v6): every CLI line it shows is real output of the command it names, every desktop +// frame is a real capture of the app (desktop.ts), each scene holds 4-5 s, each caption is fully on screen for at least +// 3 s, the whole cut is 50-60 s, and it is 16:9 only. import { afterAll, beforeAll, describe, expect, test } from 'bun:test'; import { generateKeyPairSync } from 'node:crypto'; -import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; +import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { ALPHA3 } from '../cli/lib/money'; @@ -26,6 +27,8 @@ interface Teaser { DECL_LINES: { what: string; value: string; where: string }[]; DECL_ASK: string; DECL_TOTAL: number; SCAN_CMD: string; RISKS_LINE: string; RESCAN_LINE: string; FINDINGS: { sev: string; guideline: string; title: string; where: string; why: string }[]; + DESK: Record; + DESK_SCENES: string[]; DESK_FRAMES: string[]; DESK_SWEEPS: string[]; } const T = (await import(join(ROOT, 'media/teaser/script.js'))) as Teaser; @@ -156,7 +159,7 @@ describe('teaser: timing and format', () => { expect(render).not.toMatch(/1080\s*x\s*1920|w: 1080, h: 1920|vertical/i); expect(render).toContain('scale=1280:720'); }); - test('scenes are contiguous, 4-5 s each, 38-46 s in total', () => { + test('scenes are contiguous, 4-5 s each, 50-60 s in total', () => { expect(T.SCENES[0]!.start).toBe(0); for (let i = 1; i < T.SCENES.length; i++) expect(T.SCENES[i]!.start).toBe(T.SCENES[i - 1]!.end); for (const s of T.SCENES) { @@ -164,8 +167,8 @@ describe('teaser: timing and format', () => { expect(s.end - s.start, s.id).toBeLessThanOrEqual(5); } expect(T.DURATION).toBe(T.SCENES.at(-1)!.end); - expect(T.DURATION).toBeGreaterThanOrEqual(38); - expect(T.DURATION).toBeLessThanOrEqual(46); + expect(T.DURATION).toBeGreaterThanOrEqual(50); + expect(T.DURATION).toBeLessThanOrEqual(60); }); test('one caption per scene, fully on screen for at least 3 s, inside its scene', () => { const c = T.captionTimes(); @@ -182,3 +185,64 @@ describe('teaser: timing and format', () => { expect(T.MAIL.guideline).toStartWith('Guideline 2.1'); }); }); + +// The desktop sequence: four scenes of the real app (fixture mode), captured by media/teaser/desktop.ts. The frames are +// gitignored output; the file checks run wherever they were captured (render.ts captures them before every render). +const DESK_DIR = join(ROOT, 'media/teaser/out/desktop'); +const captured = existsSync(join(DESK_DIR, 'boxes.json')); +/** Width and height of a JPEG (its first SOF marker). */ +function jpegSize(buf: Buffer): { w: number; h: number } | null { + if (buf[0] !== 0xff || buf[1] !== 0xd8) return null; + for (let i = 2; i + 9 < buf.length;) { + if (buf[i] !== 0xff) { i++; continue; } + const m = buf[i + 1]!; + if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xc8 && m !== 0xcc) return { w: buf.readUInt16BE(i + 7), h: buf.readUInt16BE(i + 5) }; + i += 2 + buf.readUInt16BE(i + 2); + } + return null; +} + +describe('teaser: the desktop scenes are real captures of the app', () => { + test('four desktop scenes in a row before the submit card, the last one is v5\'s (timeline, then 0 blockers)', () => { + expect(T.DESK_SCENES).toEqual(['portfolio', 'charts', 'catalog', 'desktop']); + const ids = T.SCENES.map(s => s.id); + expect(ids.slice(-5)).toEqual([...T.DESK_SCENES, 'submit']); + expect(T.DESK.desktop!.groups.map(g => g.frame)).toEqual(['releases', 'ready']); + expect(T.CAPTIONS.find(c => c.id === 'desktop')!.lines.join(' ').replace(/\*/g, '')).toBe('Both stores, one view. Ready for review.'); + for (const id of T.DESK_SCENES) expect(T.DESK[id]!.callouts.length, id).toBe(1 + (id === 'desktop' ? 1 : 0)); + expect(T.DESK_SWEEPS).toEqual(['growth', 'health']); + }); + test('every frame a scene names is one desktop.ts captures from the app (no mock frames)', () => { + const src = readFileSync(join(ROOT, 'media/teaser/desktop.ts'), 'utf8'); + expect(src).toContain("VITE_FIXTURES: '1'"); + for (const f of T.DESK_FRAMES) expect(src, f).toMatch(new RegExp(`shot\\([a-z.]+, '${f}'\\)|sweep\\('${f}'`)); + for (const s of T.DESK_SWEEPS) expect(src, s).toContain(`sweep('${s}'`); + // the picture shows only files from out/desktop, never a drawn stand-in + const js = readFileSync(join(ROOT, 'media/teaser/teaser.js'), 'utf8'); + expect(js).toContain('out/desktop/${x.g.frame}.jpg'); + expect(js).toContain('out/desktop/${f.file}.jpg'); + }); + test.if(captured)('the captured frames are present: 1280x800 @2x JPEGs, the sweeps one frame per hovered day', () => { + const boxes = JSON.parse(readFileSync(join(DESK_DIR, 'boxes.json'), 'utf8')) as Record & { source: string; sweeps: Record }; + expect(boxes.source).toContain('VITE_FIXTURES=1'); + const files = [...T.DESK_FRAMES]; + for (const s of T.DESK_SWEEPS) { + const f = boxes.sweeps[s]!; + expect(f.length, s).toBeGreaterThanOrEqual(8); + expect(new Set(f.map(x => x.day)).size, s).toBe(f.length); + for (let i = 1; i < f.length; i++) expect(f[i]!.px).toBeGreaterThan(f[i - 1]!.px); + files.push(...f.map(x => x.file)); + } + const sizes = new Set(); + for (const f of files) { + const p = join(DESK_DIR, `${f}.jpg`); + expect(existsSync(p), p).toBe(true); + const buf = readFileSync(p); + expect(jpegSize(buf), f).toEqual({ w: 2560, h: 1600 }); + sizes.add(buf.length); + } + // every sweep frame differs from the others (the tooltip moved): no copied frames + expect(sizes.size).toBeGreaterThan(files.length * 0.9); + for (const id of T.DESK_SCENES) for (const c of T.DESK[id]!.callouts) expect(boxes[c.target], c.target).toBeDefined(); + }); +});