From 4139b67c9666c75ce93112a661e1851cb878a8d8 Mon Sep 17 00:00:00 2001 From: CRT Date: Sun, 11 Oct 2026 15:54:02 +0000 Subject: [PATCH] Teaser remake: inbox hook, real scan and re-scan, screenshot wall, Data safety, three desktop scenes, Submit card New cut on the approved storyboard (33.75 s, every cut on the 128 BPM beat): rejection mails in a generic inbox, storebound scan typed on black with its real output (tests/fixtures/scan/teaser), the re-scan of the fixed copy (new fixture teaser-fixed) flipping five reds to green, 200 store screenshots, 764 Data safety answers, the desktop app's Portfolio, release timeline (rollout to 20%) and Checks tab, then the Submit card and the logo. 60 fps capture blended to 30 fps for motion blur, whip / mask / zoom transitions, sound design on every cut, a 1280x720 web version. tests/teaser.test.ts checks the scan text, beat grid, caption length and holds. --- media/teaser/README.md | 51 +- media/teaser/desktop.ts | 116 ++- media/teaser/icons/arrow-right-bold.svg | 1 - media/teaser/icons/check-circle-fill.svg | 1 + media/teaser/icons/magnifying-glass-bold.svg | 1 + media/teaser/icons/paper-plane-tilt-fill.svg | 1 + media/teaser/icons/pencil-simple-bold.svg | 1 + media/teaser/icons/terminal-window-bold.svg | 1 + media/teaser/icons/tray-bold.svg | 1 + media/teaser/icons/user-bold.svg | 1 - media/teaser/icons/warning-octagon-fill.svg | 1 + media/teaser/icons/x-circle-fill.svg | 1 + media/teaser/index.html | 468 ++++----- media/teaser/music.js | 166 +++- media/teaser/render.ts | 93 +- media/teaser/script.js | 307 +++--- media/teaser/teaser.js | 922 ++++++++++-------- .../Planner.xcodeproj/project.pbxproj | 13 + .../scan/teaser-fixed/Planner/Ads.swift | 11 + .../scan/teaser-fixed/Planner/Info.plist | 12 + .../scan/teaser-fixed/Planner/LoginView.swift | 25 + .../Planner/PrivacyInfo.xcprivacy | 19 + .../scan/teaser-fixed/Planner/ProStore.swift | 10 + .../teaser-fixed/Planner/SettingsView.swift | 10 + tests/fixtures/scan/teaser-fixed/Podfile.lock | 9 + tests/fixtures/scan/teaser-fixed/README.md | 8 + .../scan/teaser-fixed/store/appstore.md | 23 + .../scan/teaser-fixed/storebound.config.ts | 18 + tests/teaser.test.ts | 84 ++ tools/site-icons.ts | 5 +- 30 files changed, 1431 insertions(+), 949 deletions(-) delete mode 100644 media/teaser/icons/arrow-right-bold.svg create mode 100644 media/teaser/icons/check-circle-fill.svg create mode 100644 media/teaser/icons/magnifying-glass-bold.svg create mode 100644 media/teaser/icons/paper-plane-tilt-fill.svg create mode 100644 media/teaser/icons/pencil-simple-bold.svg create mode 100644 media/teaser/icons/terminal-window-bold.svg create mode 100644 media/teaser/icons/tray-bold.svg delete mode 100644 media/teaser/icons/user-bold.svg create mode 100644 media/teaser/icons/warning-octagon-fill.svg create mode 100644 media/teaser/icons/x-circle-fill.svg create mode 100644 tests/fixtures/scan/teaser-fixed/Planner.xcodeproj/project.pbxproj create mode 100644 tests/fixtures/scan/teaser-fixed/Planner/Ads.swift create mode 100644 tests/fixtures/scan/teaser-fixed/Planner/Info.plist create mode 100644 tests/fixtures/scan/teaser-fixed/Planner/LoginView.swift create mode 100644 tests/fixtures/scan/teaser-fixed/Planner/PrivacyInfo.xcprivacy create mode 100644 tests/fixtures/scan/teaser-fixed/Planner/ProStore.swift create mode 100644 tests/fixtures/scan/teaser-fixed/Planner/SettingsView.swift create mode 100644 tests/fixtures/scan/teaser-fixed/Podfile.lock create mode 100644 tests/fixtures/scan/teaser-fixed/README.md create mode 100644 tests/fixtures/scan/teaser-fixed/store/appstore.md create mode 100644 tests/fixtures/scan/teaser-fixed/storebound.config.ts create mode 100644 tests/teaser.test.ts diff --git a/media/teaser/README.md b/media/teaser/README.md index 99dc227c..7f851289 100644 --- a/media/teaser/README.md +++ b/media/teaser/README.md @@ -1,40 +1,55 @@ -# storebound teaser (about 50 s social video) +# storebound teaser (about 34 s social video) -A scripted terminal animation, not a screen recording. Every frame is a pure function of time, rendered from an -HTML/CSS/JS timeline in headless Chrome and encoded with ffmpeg. The music is original and synthesized from scratch in -the same browser (Web Audio `OfflineAudioContext`): no samples, no downloaded audio, nothing to license. +A scripted motion piece, not a screen recording. 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 design are original and +synthesized from scratch in the same browser (Web Audio `OfflineAudioContext`): no samples, no downloaded audio, +nothing to license. + +| s | scene | +|---|---| +| 0.00-3.28 | hook: a generic, made-up inbox; three rejection mails stack up, then "Rejected. Again." | +| 3.28-11.25 | hard cut to black: `storebound scan` is typed; the real output: SDKs with file:line, five findings with guideline and fix, the camera on each | +| 11.25-14.06 | the re-scan after the fixes: the five reds flip green, 0 blockers | +| 14.06-16.88 | the store screenshot wall (the demo game's real renders), 200 store screenshots | +| 16.88-19.69 | the declarations proposal from the scan, Data safety answers ticking, 764 answers | +| 19.69-28.13 | the desktop app (real frames, fixture data): Portfolio across studios · release timeline, rollout filling to 20% · Checks, rejection risks turning green | +| 28.13-30.94 | "It never presses Submit. You do." over a Submit button | +| 30.94-33.75 | logo, storebound.dev, Open source · macOS · Windows · Linux | | file | what | |---|---| -| `script.js` | the timeline: tempo (128 BPM, 26 bars = 48.75 s), scenes, terminal lines, prices, languages, blockers, the desktop steps | -| `desktop.ts` | the desktop scene's frames: apps/desktop's Vite dev server in fixture mode (`VITE_FIXTURES=1`, example.com-style data), captured headlessly in dark at 1280x800 @2x, plus `boxes.json` (cursor targets) -> `out/desktop/` | +| `script.js` | the timeline: 128 BPM, scenes in beats (every cut on the beat), captions, the inbox, the scan lines, the desktop camera, the sound cues | +| `desktop.ts` | the desktop scenes' 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` (cursor and callout targets) -> `out/desktop/` | | `index.html` + `teaser.js` | the picture; `window.teaser.seek(t)` sets every element for time `t` | -| `music.js` | the music: arp, kick, hats, clap, offbeat bass, pad, impacts on the cuts, key clicks, riser | -| `render.ts` | frames -> ffmpeg (H.264 high, yuv420p, 30 fps), music -> loudnorm (-14 LUFS, -1.5 dBTP), mux, posters | -| `icons/` | the mouse cursor and the blocker-list icons: Phosphor files copied unchanged by `bun tools/site-icons.ts` (no hand-written SVG; CI checks it) | +| `music.js` | music (F minor: tense intro, silence for the typed command, the groove from Enter, a calm bar under Submit, the logo hit) and sound design: mail blips, key clicks, a whoosh into every whip / mask / zoom, a hit on every cut, ticks on findings, rising chimes on fixes | +| `render.ts` | frames at 60 fps blended to 30 fps (motion blur) -> ffmpeg (H.264 high, yuv420p), sound -> loudnorm (-14 LUFS, -1.5 dBTP), mux, posters, the 1280x720 web version | +| `icons/` | the mouse cursor and the UI icons: Phosphor files copied unchanged by `bun tools/site-icons.ts` (no hand-written SVG; CI checks it) | | `poster.jpg` | end card still (1920x1080, small) | -The terminal text is modelled on real storebound output for the demo game (`examples/demo-game`, placeholder ids, -dry runs); the price table values are illustrative. The store art is the demo game's real renders. The desktop scene -shows real frames of the desktop app on its fixture data in a CSS window; only the confirm dialog is drawn (in the app it -is a native OS dialog), with the app's own wording and the dry run of the diff in the frame behind it. +The scan text is the real `storebound scan` output of `tests/fixtures/scan/teaser` (five classic App Review +rejections) and, after the fixes, of `tests/fixtures/scan/teaser-fixed`; `tests/teaser.test.ts` runs both scans and +checks every line the video shows, the beat grid, the caption lengths (at most 7 words) and holds (at least 1.2 s), and +that every scene holds at least 2.5 s. Each fix line shows a verbatim piece of the real fix. The mail list is fictional: +no real names or addresses, no mail-app branding. The desktop scenes are real frames of the app on its fixture data; +the "after" Checks frame is the same tab with the fixture's scan answering no findings. ## Render Needs Bun, ffmpeg and Playwright (repo devDependency; Playwright's Chromium or an installed Google Chrome). ```sh -# optional, for sharp store art: the demo renders (otherwise crops of docs/img/showcase.jpg are used) +# optional, for the real screenshot wall: the demo renders (otherwise crops of docs/img/showcase.jpg are used) 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 # both formats + music, about 12 min (captures out/desktop/ first when missing) +bun media/teaser/render.ts # both formats, sound, posters, 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 --only v # vertical only (h = horizontal) +bun media/teaser/render.ts --only v # vertical only (h = horizontal; the web version is made from h) 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?w=1080&h=1920&play=1 (or &t=12.5) ``` Outputs (gitignored) in `media/teaser/out/`: `teaser-1080x1920.mp4` (X / TikTok / Reels), `teaser-1920x1080.mp4` -(X / YouTube), `-silent` variants, `poster-*.jpg`, `music.wav`. +(X / YouTube), `teaser-web.mp4` (1280x720, about 3.5 MB, for the site) with `poster-web.jpg`, `-silent` variants, +`poster-*.jpg`, `music.wav`. -Vertical layout keeps captions and key text inside the central 80% and leaves the bottom ~22% free for app overlays. +The vertical layout keeps captions inside the centre 80% and the bottom ~22% free of key text for app overlays. diff --git a/media/teaser/desktop.ts b/media/teaser/desktop.ts index 860d4513..1a5883c5 100644 --- a/media/teaser/desktop.ts +++ b/media/teaser/desktop.ts @@ -1,7 +1,14 @@ #!/usr/bin/env bun -// Real desktop-app frames for the teaser's desktop scene: 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. -// Writes media/teaser/out/desktop/*.jpg plus boxes.json (where the cursor goes, as fractions of the frame). +// Real desktop-app frames for the teaser's three 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 (cursor and callout targets, as fractions of the frame). +// portfolio.jpg Portfolio: every app of every studio, grouped by studio +// 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 +// checks-clean.jpg the same tab after the fixes: the fixture's scan answer with no findings (the app's own +// "No rejection risks found" state; the fixture module is served with an empty findings list) // render.ts runs it when out/desktop/ is missing; run it by hand after a UI change: bun media/teaser/desktop.ts import { mkdirSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; @@ -29,65 +36,80 @@ export async function captureDesktop(): Promise { await Bun.sleep(250); } const browser = await launch(ROOT, { headless: true }); - const ctx = await browser.newContext({ viewport: VIEW, deviceScaleFactor: 2, colorScheme: 'dark', reducedMotion: 'reduce' }); - const page = await ctx.newPage(); - const errors: string[] = []; - page.on('pageerror', (e: unknown) => errors.push(String(e))); const boxes: Record = {}; - const box = async (name: string, loc: any): Promise => { + const errors: string[] = []; + + const session = async (clean: boolean) => { + const ctx = await browser.newContext({ viewport: VIEW, deviceScaleFactor: 2, colorScheme: 'dark', reducedMotion: 'reduce' }); + if (clean) { + // after the fixes: the fixture's scan of Prism Puddle answers with no findings (the UI is unchanged) + await ctx.route(/\/src\/dev\/fixtures\.ts/, async (route: any) => { + const res = await route.fetch(); + const src = await res.text(); + const body = src.replace(/findings:\s*SCAN_PRISM,\s*counts:\s*scanCounts\(SCAN_PRISM\)/, 'findings: [], counts: scanCounts([])'); + if (body === src) errors.push('fixtures.ts: the Prism Puddle scan entry moved (desktop.ts clean capture)'); + await route.fulfill({ response: res, body }); + }); + } + const page = await ctx.newPage(); + page.on('pageerror', (e: unknown) => errors.push(String(e))); + return { ctx, page }; + }; + const open = async (page: any, start: string): Promise => { + await page.goto(`${base}/?start=${encodeURIComponent(start)}&theme=dark&lang=en`); + await page.waitForLoadState('networkidle'); + await page.addStyleTag({ content: '.brand small, .dev-pill { display: none !important; }' }); + await page.waitForTimeout(1200); + }; + const box = async (page: any, name: string, loc: any): Promise => { const b = await loc.first().boundingBox(); if (!b) throw new Error(`no box for ${name}`); boxes[name] = { x: b.x / VIEW.width, y: b.y / VIEW.height, w: b.width / VIEW.width, h: b.height / VIEW.height }; }; - const open = async (start: string): Promise => { - await page.goto(`${base}/?start=${encodeURIComponent(start)}&theme=dark&lang=en`); - await page.waitForLoadState('networkidle'); - // the two dev-build markers ("DEV" by the name, the "DEV FIXTURES" pill) are not in a release build - await page.addStyleTag({ content: '.brand small, .dev-pill { display: none !important; }' }); - await page.waitForTimeout(900); - }; - const shot = async (name: string): Promise => { + const shot = async (page: any, name: string): Promise => { await page.mouse.move(VIEW.width - 2, VIEW.height - 2); - await page.waitForTimeout(150); - await page.screenshot({ path: join(OUT, `${name}.jpg`), type: 'jpeg', quality: 92 }); + await page.waitForTimeout(200); + await page.screenshot({ path: join(OUT, `${name}.jpg`), type: 'jpeg', quality: 93 }); }; - await open('portfolio'); - await shot('portfolio'); + const a = await session(false); + await open(a.page, 'portfolio'); + await box(a.page, 'studios', a.page.locator('.fchips')); + await box(a.page, 'table', a.page.locator('table').first()); + await shot(a.page, 'portfolio'); - await open('app:releases'); - await box('console', page.getByRole('button', { name: /App Store Connect/ })); - await shot('releases'); - - await open('app:growth'); - const chart = page.locator('#tabpanel .lchart-plot').first(); - await box('chart', chart); - await shot('growth'); - const c = boxes.chart!; - const hx = (c.x + c.w * 0.68) * VIEW.width, hy = (c.y + c.h * 0.5) * VIEW.height; - await page.mouse.move(hx, hy, { steps: 4 }); - await page.waitForTimeout(400); - boxes.hover = { x: hx / VIEW.width, y: hy / VIEW.height, w: 0, h: 0 }; - await page.screenshot({ path: join(OUT, 'growth-hover.jpg'), type: 'jpeg', quality: 92 }); - - await open('palette'); - await shot('palette'); - - await open('app:prices'); - await page.getByRole('button', { name: /Compare store\/prices.csv/ }).click(); - await page.waitForTimeout(5200); // the "compared" result toast closes by itself after 4.5 s - await page.getByText(/against the stores/).first().evaluate((el: HTMLElement) => { + 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) => { el.scrollIntoView({ block: 'start' }); - document.getElementById('content')?.scrollBy({ top: -24 }); + document.getElementById('content')?.scrollBy({ top: -150 }); }); - await page.waitForTimeout(300); - await box('apply', page.getByRole('button', { name: /^Apply \d+ changes/ })); - await shot('prices-diff'); + await a.page.waitForTimeout(300); + await box(a.page, 'roll', a.page.locator('.tl-roll').first()); + await box(a.page, 'roll2', a.page.locator('.tl-roll').nth(1)); + await box(a.page, 'timeline', a.page.locator('.tl-lane').first()); + await shot(a.page, 'releases'); + await a.page.addStyleTag({ content: '.tl-roll .rbar rect:not(.track) { display: none !important; } .tl-roll .pct { visibility: hidden !important; }' }); + await a.page.waitForTimeout(150); + await shot(a.page, 'releases-empty'); + + await open(a.page, 'app:checks'); + await box(a.page, 'scan', a.page.locator('.card').first()); + await box(a.page, 'finding', a.page.locator('.card').first().locator('.li').first()); + await box(a.page, 'scanAgain', a.page.locator('.card').first().locator('.btn').first()); + await shot(a.page, 'checks'); + await a.ctx.close(); + + const b = await session(true); + await open(b.page, 'app:checks'); + await box(b.page, 'scanClean', b.page.locator('.card').first()); + await shot(b.page, 'checks-clean'); + await b.ctx.close(); writeFileSync(join(OUT, 'boxes.json'), `${JSON.stringify(boxes, 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}`); + log(`5 frames + boxes.json -> ${OUT}`); } finally { vite.kill(); } diff --git a/media/teaser/icons/arrow-right-bold.svg b/media/teaser/icons/arrow-right-bold.svg deleted file mode 100644 index f7bab32e..00000000 --- a/media/teaser/icons/arrow-right-bold.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/media/teaser/icons/check-circle-fill.svg b/media/teaser/icons/check-circle-fill.svg new file mode 100644 index 00000000..ee1317cf --- /dev/null +++ b/media/teaser/icons/check-circle-fill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/icons/magnifying-glass-bold.svg b/media/teaser/icons/magnifying-glass-bold.svg new file mode 100644 index 00000000..0a90a2fb --- /dev/null +++ b/media/teaser/icons/magnifying-glass-bold.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/icons/paper-plane-tilt-fill.svg b/media/teaser/icons/paper-plane-tilt-fill.svg new file mode 100644 index 00000000..c0381c08 --- /dev/null +++ b/media/teaser/icons/paper-plane-tilt-fill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/icons/pencil-simple-bold.svg b/media/teaser/icons/pencil-simple-bold.svg new file mode 100644 index 00000000..83e2db01 --- /dev/null +++ b/media/teaser/icons/pencil-simple-bold.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/icons/terminal-window-bold.svg b/media/teaser/icons/terminal-window-bold.svg new file mode 100644 index 00000000..5309a417 --- /dev/null +++ b/media/teaser/icons/terminal-window-bold.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/icons/tray-bold.svg b/media/teaser/icons/tray-bold.svg new file mode 100644 index 00000000..1f544bf6 --- /dev/null +++ b/media/teaser/icons/tray-bold.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/icons/user-bold.svg b/media/teaser/icons/user-bold.svg deleted file mode 100644 index 0adad1ad..00000000 --- a/media/teaser/icons/user-bold.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/media/teaser/icons/warning-octagon-fill.svg b/media/teaser/icons/warning-octagon-fill.svg new file mode 100644 index 00000000..b93dce1e --- /dev/null +++ b/media/teaser/icons/warning-octagon-fill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/icons/x-circle-fill.svg b/media/teaser/icons/x-circle-fill.svg new file mode 100644 index 00000000..7952fafa --- /dev/null +++ b/media/teaser/icons/x-circle-fill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/teaser/index.html b/media/teaser/index.html index c27658f2..c476e2f0 100644 --- a/media/teaser/index.html +++ b/media/teaser/index.html @@ -6,268 +6,268 @@ storebound teaser
-
+
-
-
- your AI agentprism-puddle · scripted demo
-
-
- -
-

Regional prices API

-

USD base · Play converts per region · your overrides

-
regioncurremove_adsdrops_500
-
-
- -
-

Store listings API0/14

-

title · short + full description · keywords · per language

-
-
- -
-

Store questionnaires

-

API where the stores have one · a skill where they do not

-
-
- -
-
- -
- -
-
storebound
-
-
- Owner action: Apply the price sheet -

Apply the price sheet · Prism Puddle

-

This is your decision: it changes what users get on the store right away. storebound does it only because you press the button below.

-

-          
CancelYes: Apply the price sheet
-
-
+
+
+
Inbox3
+
Flagged
Sent
Drafts
Archive
-
- - +
+

Inbox

0 new +
+
+
+
+ +
+ +
+
+
+
5
rejection risks
+
+ +
+
0 store screenshots
+
$ storebound shots render
-
-
storebound never presses Submit.
-
Submit for review
-
your click.YOU
-
Play: Send changes for review · App Store: Submit for Review
+
+
storebound scandeclarations proposal
+
Data safetyGoogle Play
+
0 answers
- -
- storebound logo +
+
+
+ +
+
Submit for Review
+
+ +
+
storebound
-
From zero to “Submit for review”
on Google Play and the App Store.
storebound.dev
-
open source · MIT
-
Desktop app for macOS, Windows, Linux
-
$bunx storebound init
-
+
Open source · macOS · Windows · Linux
+
+
+ + +
+
diff --git a/media/teaser/music.js b/media/teaser/music.js index e605dd48..355f386f 100644 --- a/media/teaser/music.js +++ b/media/teaser/music.js @@ -1,8 +1,10 @@ -// Original teaser music, synthesized from nothing with the Web Audio API (OfflineAudioContext): no samples, no -// downloaded audio. 128 BPM, F minor, tight 16th arpeggio, kick / hats / clap, offbeat bass, a pad, impacts on every -// scene cut (script.js CUTS), key clicks on every typed character, a riser into the end card. Deterministic (seeded). +// Original teaser music and sound design, synthesized from nothing with the Web Audio API (OfflineAudioContext): no +// samples, no downloaded audio. 128 BPM, F minor: a tense intro under the inbox, a hard cut to near silence for the +// typed command, the groove from the Enter key on, a calm bar under the Submit button, the hit on the logo. On top: +// mail blips, key clicks, a whoosh into every whip / mask / zoom and a hit on every cut (script.js CUTS), ticks on +// every finding, rising chimes on every fix, ticks for the screenshot wall and the Data safety rows. Deterministic. // renderWav() returns a 32-bit float stereo WAV (48 kHz) as base64; render.ts masters it with ffmpeg loudnorm. -import { BAR, BEAT, CUTS, DURATION, keyTimes, scene } from './script.js'; +import { B, BAR, BEAT, CUTS, DESKTOP, DURATION, ENTER_AT, keyTimes, scene, TICKS } from './script.js'; const SR = 48000; const midi = m => 440 * Math.pow(2, (m - 69) / 12); @@ -13,9 +15,8 @@ function rng(seed) { // mulberry32 // chords per bar (root midi in octave 3, intervals) const CH = { Fm: [53, [0, 3, 7]], Db: [49, [0, 4, 7]], Ab: [56, [0, 4, 7]], Eb: [51, [0, 4, 7]] }; -// prompt · config · prices · languages · questionnaires · shots · validate · desktop · submit · brand (script.js SCENES) -const BARS = ['Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', - 'Db', 'Ab', 'Eb', 'Fm', 'Eb', 'Eb', 'Db', 'Eb', 'Fm', 'Eb', 'Fm']; +// 18 bars: hook (0-1) · command + scan (1-5) · fixed, shots, decl (6-10) · desktop (10-14) · submit (15-16) · brand (16-17) +const BARS = ['Fm', 'Db', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Eb', 'Fm']; const ARP = [0, 2, 4, 3, 5, 4, 2, 3, 0, 2, 4, 6, 5, 4, 3, 2]; export async function renderMusic() { @@ -54,25 +55,56 @@ export async function renderMusic() { } const arpVerb = ctx.createGain(); arpVerb.gain.value = 0.18; arpLP.connect(arpVerb); arpVerb.connect(verbIn); - // arp filter: closed intro, open drop, wide on the riser, dark under the Submit card, bright on the brand + // arp filter: closed under the inbox, open from the Enter key, wide into the Submit card, dark under it, bright on the logo const f = arpLP.frequency; - const at = s => scene(s).start; - f.setValueAtTime(420, 0); - f.exponentialRampToValueAtTime(2400, at('config') - 0.02); - f.setValueAtTime(3000, at('config')); - f.linearRampToValueAtTime(3400, at('submit') - BAR); - f.exponentialRampToValueAtTime(7000, at('submit') - 0.01); - f.setValueAtTime(900, at('submit')); - f.exponentialRampToValueAtTime(1800, at('brand') - 0.01); - f.setValueAtTime(4200, at('brand')); - f.setValueAtTime(4200, at('brand') + BAR * 2); - f.exponentialRampToValueAtTime(800, DURATION); + const sub = scene('submit').start, brand = scene('brand').start; + f.setValueAtTime(380, 0); + f.exponentialRampToValueAtTime(900, B(7) - 0.01); + f.setValueAtTime(2600, ENTER_AT); + f.linearRampToValueAtTime(3400, sub - BAR); + f.exponentialRampToValueAtTime(7000, sub - 0.01); + f.setValueAtTime(900, sub); + f.exponentialRampToValueAtTime(1800, brand - 0.01); + f.setValueAtTime(4200, brand); + f.exponentialRampToValueAtTime(900, DURATION); const env = (g, t, a, peak, d, end = 0.0005) => { g.gain.setValueAtTime(0, t); g.gain.linearRampToValueAtTime(peak, t + a); g.gain.exponentialRampToValueAtTime(end, t + a + d); }; const noiseSrc = (t, dur, off = R() * 1.5) => { const s = ctx.createBufferSource(); s.buffer = noise; s.start(t, off, dur); return s; }; + // sound effects bus (balanced under the music, before the master compressor) + const sfx = ctx.createGain(); sfx.gain.value = 0.85; sfx.connect(master); + const sfxVerb = ctx.createGain(); sfxVerb.gain.value = 0.35; sfxVerb.connect(verbIn); + function blip(t, m, g, len = 0.18, type = 'sine', pan = 0) { + const o = ctx.createOscillator(); o.type = type; o.frequency.value = midi(m); + const p = ctx.createStereoPanner(); p.pan.value = pan; + const v = ctx.createGain(); env(v, t, 0.003, g, len); o.connect(v); v.connect(p); p.connect(sfx); p.connect(sfxVerb); + o.start(t); o.stop(t + len + 0.05); + } + /** A mail arriving: a soft two-tone notification blip and a short swish. */ + function mail(t) { blip(t, 84, 0.12, 0.16); blip(t + 0.075, 91, 0.1, 0.3); whoosh(t - 0.12, 0.14, 0.08, 1200, 6000); } + /** A finding landing: a low, slightly sour thud with a click on top. */ + function bad(t) { + blip(t, 41, 0.3, 0.28, 'triangle'); blip(t, 47, 0.12, 0.2, 'square'); + const n = noiseSrc(t, 0.03); const hp = ctx.createBiquadFilter(); hp.type = 'highpass'; hp.frequency.value = 2500; + const v = ctx.createGain(); env(v, t, 0.001, 0.25, 0.03); n.connect(hp); hp.connect(v); v.connect(sfx); + } + /** A fix: rising bell chimes (Ab major pentatonic), the fifth one brighter. */ + const GOOD = [68, 70, 72, 75, 80]; + function good(t, i) { blip(t, GOOD[i], 0.13, 0.5, 'sine', -0.3 + i * 0.15); blip(t, GOOD[i] + 12, 0.05, 0.35, 'triangle', 0.2); if (i === 4) { blip(t + 0.09, 84, 0.1, 0.8); blip(t + 0.09, 87, 0.07, 0.8); } } + /** A small UI pop (callouts). */ + function pop(t) { const o = ctx.createOscillator(); o.type = 'sine'; o.frequency.setValueAtTime(520, t); o.frequency.exponentialRampToValueAtTime(1300, t + 0.07); + const v = ctx.createGain(); env(v, t, 0.002, 0.14, 0.09); o.connect(v); v.connect(sfx); o.start(t); o.stop(t + 0.15); } + /** A tick (screenshot tiles, checkboxes). */ + function tick(t, g = 0.08, f0 = 3200) { const n = noiseSrc(t, 0.015); const bp = ctx.createBiquadFilter(); bp.type = 'bandpass'; bp.frequency.value = f0; bp.Q.value = 4; + const v = ctx.createGain(); env(v, t, 0.0006, g, 0.012); n.connect(bp); bp.connect(v); v.connect(sfx); } + /** A mouse click. */ + function click(t) { tick(t, 0.22, 2400); tick(t + 0.055, 0.12, 1800); } + /** A sub drop for the hard cut. */ + function thud(t, g = 0.7) { const o = ctx.createOscillator(); o.type = 'sine'; o.frequency.setValueAtTime(70, t); o.frequency.exponentialRampToValueAtTime(30, t + 0.6); + const v = ctx.createGain(); env(v, t, 0.004, g, 0.7); o.connect(v); v.connect(master); o.start(t); o.stop(t + 0.8); } + // ---- voices ---- function kick(t, g = 1) { const o = ctx.createOscillator(); o.type = 'sine'; @@ -167,57 +199,83 @@ export async function renderMusic() { const v = ctx.createGain(); env(v, t, 0.0008, g * (0.7 + R() * 0.6), 0.012); n.connect(bp); bp.connect(v); v.connect(p); p.connect(master); } - // ---- arrangement ---- - const sub = scene('submit').start, brand = scene('brand').start, drop = scene('config').start; - const rollBar = scene('submit').start - BAR; // last bar before the Submit card + // ---- arrangement ---- + const cut = scene('scan').start; // the hook's hard cut to black + const drop = ENTER_AT; // the Enter key: the groove starts + const roll = sub - BAR; // the bar before the Submit card + const music = ctx.createGain(); music.gain.value = 1; // the arrangement's gain: silent for the typed command + duck.disconnect(); duck.connect(music); drums.disconnect(); drums.connect(music); music.connect(master); + music.gain.setValueAtTime(1, 0); music.gain.setValueAtTime(1, cut - 0.01); music.gain.linearRampToValueAtTime(0.0, cut + 0.005); + music.gain.setValueAtTime(0.0, drop - 0.02); music.gain.linearRampToValueAtTime(1, drop); duck.gain.setValueAtTime(1, 0); const last = BARS.length - 1; for (let b = 0; b <= last; b++) { const t0 = b * BAR, name = BARS[b], [root, iv] = CH[name]; const tones = [0, iv[1], iv[2], 12, 12 + iv[1], 12 + iv[2], 24].map(x => root + 12 + x); - const main = t0 >= drop && t0 < sub, end = b === last, calm = t0 >= sub && t0 < brand; - const groove = main || (t0 >= brand && !end); - // pad - if (!end) pad(t0, BAR, [root, root + iv[1], root + iv[2], root + 12], calm ? 0.06 : t0 < drop ? 0.045 : 0.035, calm ? 1100 : 1500); + const calmBar = t0 >= sub && t0 < brand, end = b === last, intro = t0 < cut; + if (!end) pad(t0, BAR, [root, root + iv[1], root + iv[2], root + 12], calmBar ? 0.06 : intro ? 0.05 : 0.035, calmBar ? 1100 : intro ? 900 : 1500); + else pad(t0, BAR * 0.9, [root, root + iv[1], root + iv[2], root + 12], 0.05, 1600); for (let s = 0; s < 16; s++) { const t = t0 + s * BEAT / 4; - const beat = s % 4 === 0, off = s % 4 === 2; - const cutDrums = t0 === rollBar && s >= 8; // drums drop out for the last half bar of the riser - // arp + const beat = s % 4 === 0, off = s % 4 === 2, calm = t >= sub && t < brand; + const groove = t >= drop - 0.001 && t < sub && !(t >= roll + BAR / 2); if (!end) { - if (calm) { if (s % 2 === 0) arpNote(t, tones[ARP[s]] ?? root, 0.09, 0.3); } - else arpNote(t, tones[ARP[s]] ?? root, t0 < drop ? 0.08 : 0.11, 0.16); + if (calm) { if (s % 2 === 0) arpNote(t, tones[ARP[s]] ?? root, 0.08, 0.3); } + else if (t < cut) arpNote(t, tones[ARP[s]] ?? root, 0.07, 0.14); + else if (t >= drop) arpNote(t, tones[ARP[s]] ?? root, 0.1, 0.16); } - if (groove && !cutDrums) { + if (intro && s % 2 === 0) hat(t, s % 4 === 0 ? 0.05 : 0.025, 0.1); + if (intro && beat) { const o = ctx.createOscillator(); o.type = 'sine'; o.frequency.setValueAtTime(58, t); o.frequency.exponentialRampToValueAtTime(40, t + 0.2); + const v = ctx.createGain(); env(v, t, 0.004, 0.35, 0.3); o.connect(v); v.connect(drums); o.start(t); o.stop(t + 0.4); } + if (groove) { if (beat) kick(t); - if (off) { hat(t, 0.14, 0.2); bass(t, root - 12); } - else if (!beat) hat(t, 0.045, -0.2); - if (t0 >= drop + BAR * 2 && (s === 4 || s === 12)) clap(t); + if (off) { hat(t, 0.13, 0.2); bass(t, root - 12); } else if (!beat) hat(t, 0.04, -0.2); + if (t >= drop + BAR && (s === 4 || s === 12)) clap(t, 0.32); } - if (calm && off) hat(t, 0.05, 0.15); - if (b === 1 && s >= 8 && s % 2 === 0) hat(t, 0.02 + 0.06 * (s - 8) / 8, 0); // intro tick-in + if (calm && off) hat(t, 0.045, 0.15); } } // snare roll + riser into the Submit card - for (let i = 0; i < 8; i++) snare(rollBar + i * BEAT / 4, 0.04 + 0.1 * i / 7); - for (let i = 0; i < 16; i++) snare(rollBar + BAR / 2 + i * BEAT / 8, 0.14 + 0.18 * i / 15); - riser(rollBar, BAR); - riser(brand - BAR / 2, BAR / 2, 0.05); - whoosh(drop - BAR / 2, BAR / 2, 0.25); - // hits on the cuts + for (let i = 0; i < 8; i++) snare(roll + i * BEAT / 4, 0.04 + 0.09 * i / 7); + for (let i = 0; i < 16; i++) snare(roll + BAR / 2 + i * BEAT / 8, 0.12 + 0.16 * i / 15); + riser(roll, BAR, 0.06); + riser(brand - BAR / 2, BAR / 2, 0.045); + + // ---- sound design on the cuts ---- + // the hook: mails, then the two slams; the hard cut drops to silence with a sub thud + for (const t of TICKS.filter(x => x.kind === 'mail').map(x => x.t)) mail(t); + impact(B(3), true); stab(B(3), 'Db', 0.07); snare(B(3), 0.3); + impact(B(4), true); stab(B(4), 'Fm', 0.09); kick(B(4), 1); clap(B(4), 0.4); + riser(B(5), B(2) - 0.02, 0.035); + thud(cut, 0.55); + // the Enter key + click(drop - 0.01); impact(drop, true); stab(drop, 'Fm', 0.07); + // every later cut: a whoosh into it and a hit on it for (const c of CUTS) { - const big = c === sub || c === brand; - if (!big && c !== drop) whoosh(c - 0.32, 0.32, 0.16, 800, 6000); - impact(c, big || c === drop); + if (c.kind === 'hard' || c.t === drop) continue; + const big = c.id === 'submit' || c.id === 'brand'; + if (c.kind.startsWith('whip')) whoosh(c.t - 0.3, 0.32, 0.2, 700, 7500); + else if (c.kind === 'iris' || c.kind === 'wipe') whoosh(c.t - 0.22, 0.42, 0.14, 300, 3500); + else if (c.kind === 'zoom') whoosh(c.t - 0.36, 0.36, 0.22, 400, 9000); + impact(c.t, big); } - stab(drop, 'Fm', 0.06); - stab(sub, 'Db', 0.1); - stab(brand, 'Fm', 0.1); - stab(last * BAR, 'Fm', 0.11); - impact(last * BAR, true); - kick(last * BAR, 1); - // key clicks - for (const t of keyTimes()) key(t, t < drop ? 0.16 : 0.07); + stab(sub, 'Db', 0.09); + stab(brand, 'Fm', 0.1); kick(brand, 1); + // ticks: SDKs and the risks line (soft), findings (bad), fixes (good), callouts (pop) + for (const x of TICKS) { + if (x.kind === 'soft') tick(x.t, 0.12, 2600); + else if (x.kind === 'bad') bad(x.t); + else if (x.kind === 'good') good(x.t, x.step); + else if (x.kind === 'pop') pop(x.t); + } + // the screenshot wall (tiles pop for 1.5 s) and the Data safety rows + const shots = scene('shots').start, decl = scene('decl').start; + for (let i = 0; i < 26; i++) tick(shots + 0.14 + i * 0.058, 0.05 + 0.03 * Math.sin(i), 2800 + (i % 5) * 300); + for (let i = 0; i < 7; i++) { tick(decl + 0.95 + i * 0.16, 0.12, 2000); blip(decl + 0.95 + i * 0.16, 79 + (i % 3) * 2, 0.035, 0.08); } + // the mouse click on "Scan again" in the desktop Checks tab + click(scene('desk3').start + DESKTOP.desk3.cursor[1][0] + 0.02); + // key clicks: the typed command loud (the only sound there), the re-scan softer + for (const t of keyTimes()) key(t, t < drop ? 0.24 : 0.08); const buf = await ctx.startRendering(); const n = Math.round(DURATION * SR); diff --git a/media/teaser/render.ts b/media/teaser/render.ts index fe946f0b..bb2b5553 100644 --- a/media/teaser/render.ts +++ b/media/teaser/render.ts @@ -1,13 +1,14 @@ #!/usr/bin/env bun // Renders the storebound teaser: frames from index.html (Playwright, headless Chrome) piped into ffmpeg, plus the -// original music (music.js, OfflineAudioContext in the same browser), mastered to about -14 LUFS. -// bun media/teaser/render.ts both formats, music, posters -> media/teaser/out/ -// bun media/teaser/render.ts --only v vertical only (v = 1080x1920, h = 1920x1080) +// original music and sound design (music.js, OfflineAudioContext in the same browser), mastered to about -14 LUFS. +// Frames are captured at 60 fps and blended in pairs down to 30 fps (a 180° shutter), so fast moves get real motion blur. +// bun media/teaser/render.ts both formats, sound, posters, web version -> media/teaser/out/ +// bun media/teaser/render.ts --only v vertical only (v = 1080x1920, h = 1920x1080; the web version needs h) // bun media/teaser/render.ts --stills 1,9.5,30 PNG stills only (out/stills/), quick layout check // bun media/teaser/render.ts --desktop capture the desktop app frames again first (desktop.ts) // bun media/teaser/render.ts --serve preview server: open /index.html?w=1080&h=1920&play=1 // Needs ffmpeg and Playwright (devDependency; Playwright's Chromium or an installed Google Chrome). -import { existsSync, mkdirSync, statSync } from 'node:fs'; +import { existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; import { launch } from '../../cli/shots/browser'; import { captureDesktop } from './desktop'; @@ -19,29 +20,38 @@ const ASSETS = join(OUT, 'assets'); const args = process.argv.slice(2); const opt = (k: string): string | undefined => { const i = args.indexOf(`--${k}`); return i >= 0 ? args[i + 1] : undefined; }; const FORMATS = [{ id: 'v', w: 1080, h: 1920 }, { id: 'h', w: 1920, h: 1080 }].filter(f => !opt('only') || opt('only') === f.id); +const CAPTURE_FPS = 60; const log = (m: string): void => console.log(`${new Date().toISOString().slice(11, 19)} [teaser] ${m}`); -function sh(cmd: string[], input?: Uint8Array): void { +function sh(cmd: string[], input?: Uint8Array): string { const r = Bun.spawnSync(cmd, { stdin: input, stdout: 'pipe', stderr: 'pipe' }); if (r.exitCode !== 0) throw new Error(`${cmd.slice(0, 3).join(' ')} failed:\n${r.stderr.toString().slice(-2000)}`); + return r.stderr.toString(); } -const ff = (...a: string[]): void => sh(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-y', ...a]); +const ff = (...a: string[]): string => sh(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-y', ...a]); -/** Screenshots used by the store-art scene: the demo game's real renders, or crops of docs/img/showcase.jpg. */ +/** The screenshot wall: the demo game's real store renders (4 languages, two sets), or crops of docs/img/showcase.jpg. */ function prepAssets(): void { - mkdirSync(ASSETS, { recursive: true }); - const names = ['en-01', 'en-02', 'en-03', 'en-04', 'tr-01', 'ja-01', 'ar-01']; + const dir = join(ASSETS, 'grid'); + rmSync(dir, { recursive: true, force: true }); + mkdirSync(dir, { recursive: true }); const renders = join(ROOT, 'examples/demo-game/store/renders'); - const src = (n: string): string => { const [l, k] = n.split('-'); return join(renders, l!, 'play', `${k}.png`); }; - if (names.every(n => existsSync(src(n)))) { - for (const n of names) ff('-i', src(n), '-vf', 'scale=720:1280:flags=lanczos', '-q:v', '2', join(ASSETS, `${n}.jpg`)); - log('assets: demo game renders (examples/demo-game/store/renders)'); - } else { + const files: string[] = []; + for (const set of ['', 'b/']) for (const lang of ['en', 'tr', 'ja', 'ar']) for (const n of ['01', '02', '03', '04']) { + const src = join(renders, `${set}${lang}`, 'play', `${n}.png`); + if (!existsSync(src)) continue; + const name = `${set ? 'b-' : ''}${lang}-${n}.jpg`; + ff('-i', src, '-vf', 'scale=360:640:flags=lanczos', '-q:v', '3', join(dir, name)); + files.push(name); + } + if (files.length) log(`assets: ${files.length} demo game renders (examples/demo-game/store/renders)`); + else { // showcase.jpg: 7 panes (en 01-04, tr, ja, ar hero), 263 x 571 each, 283 px apart, from (20, 20) const show = join(ROOT, 'docs/img/showcase.jpg'); - names.forEach((n, i) => ff('-i', show, '-vf', `crop=263:468:${20 + i * 283}:20,scale=720:1280:flags=lanczos`, '-q:v', '2', join(ASSETS, `${n}.jpg`))); - log('assets: demo renders not found, using crops of docs/img/showcase.jpg (run the demo\'s `shots render` for sharper art)'); + for (let i = 0; i < 7; i++) { const name = `show-${i}.jpg`; ff('-i', show, '-vf', `crop=263:468:${20 + i * 283}:20,scale=360:640:flags=lanczos`, '-q:v', '3', join(dir, name)); files.push(name); } + log('assets: demo renders not found, using crops of docs/img/showcase.jpg (run the demo\'s `shots render` for the real wall)'); } + writeFileSync(join(ASSETS, 'grid.json'), `${JSON.stringify(files)}\n`); } function serve(): ReturnType { @@ -51,7 +61,7 @@ function serve(): ReturnType { const p = decodeURIComponent(new URL(req.url).pathname).replace(/^\/+/, '') || 'index.html'; if (p.includes('..')) return new Response('no', { status: 400 }); // the logo comes from the repo's brand/ folder (tools/brand-assets.py), not a copy - const f = Bun.file(p.startsWith('brand/') ? join(DIR, '../..', p) : join(DIR, p)); + const f = Bun.file(p.startsWith('brand/') ? join(ROOT, p) : join(DIR, p)); return f.size ? new Response(f) : new Response('not found', { status: 404 }); }, }); @@ -60,7 +70,6 @@ function serve(): ReturnType { async function main(): Promise { mkdirSync(OUT, { recursive: true }); prepAssets(); - // the desktop scene's frames: the real app in fixture mode (desktop.ts); --desktop captures them again if (args.includes('--desktop') || !existsSync(join(OUT, 'desktop/boxes.json'))) await captureDesktop(); const server = serve(); const base = `http://127.0.0.1:${server.port}/index.html`; @@ -71,9 +80,11 @@ async function main(): Promise { const stills = opt('stills'); for (const f of FORMATS) { const page = await browser.newPage({ viewport: { width: f.w, height: f.h }, deviceScaleFactor: 1 }); - page.on('pageerror', (e: Error) => console.error('page error:', e.message)); + const errors: string[] = []; + page.on('pageerror', (e: Error) => errors.push(e.message)); + page.on('response', (r: any) => { if (r.status() >= 400 && !r.url().endsWith('/favicon.ico')) errors.push(`${r.status()} ${r.url()}`); }); await page.goto(`${base}?w=${f.w}&h=${f.h}`); - await page.waitForFunction('window.teaser'); // teaser.js loads out/desktop/boxes.json first + await page.waitForFunction('window.teaser', null, { timeout: 30_000 }); await page.evaluate('window.teaser.ready'); const { DURATION, FPS } = await page.evaluate('({ DURATION: teaser.DURATION, FPS: teaser.FPS })') as { DURATION: number; FPS: number }; const shot = async (t: number): Promise => { @@ -82,47 +93,50 @@ async function main(): Promise { }; if (stills) { mkdirSync(join(OUT, 'stills'), { recursive: true }); - for (const t of stills.split(',').map(Number)) { - await Bun.write(join(OUT, 'stills', `${f.id}-${t.toFixed(2)}.png`), await shot(t)); - } + for (const t of stills.split(',').map(Number)) await Bun.write(join(OUT, 'stills', `${f.id}-${t.toFixed(2)}.png`), await shot(t)); log(`${f.id}: ${stills.split(',').length} stills in out/stills`); + if (errors.length) throw new Error(`page errors:\n ${errors.join('\n ')}`); await page.close(); continue; } - const frames = Math.round(DURATION * FPS); + // 60 fps capture, then each pair of frames is averaged into one 30 fps frame (motion blur on fast moves) + const frames = Math.round(DURATION * CAPTURE_FPS); const silent = join(OUT, `teaser-${f.w}x${f.h}-silent.mp4`); - const enc = Bun.spawn(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-y', '-f', 'image2pipe', '-framerate', String(FPS), '-c:v', 'png', '-i', '-', - '-c:v', 'libx264', '-profile:v', 'high', '-preset', 'slow', '-crf', '17', '-pix_fmt', 'yuv420p', '-r', String(FPS), + const enc = Bun.spawn(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-y', '-f', 'image2pipe', '-framerate', String(CAPTURE_FPS), '-c:v', 'png', '-i', '-', + '-vf', `tmix=frames=2:weights='1 1',select='not(mod(n\\,2))',setpts=N/${FPS}/TB`, '-r', String(FPS), + '-c:v', 'libx264', '-profile:v', 'high', '-preset', 'slow', '-crf', '16', '-pix_fmt', 'yuv420p', '-g', String(FPS * 2), '-movflags', '+faststart', silent], { stdin: 'pipe', stdout: 'inherit', stderr: 'inherit' }); const t0 = Date.now(); for (let i = 0; i < frames; i++) { - enc.stdin.write(await shot(i / FPS)); - if (i % 60 === 0 || i === frames - 1) { + // frame i shows t = (i + 1) / 60 blended with i / 60: the pair (2k, 2k+1) becomes output frame k + enc.stdin.write(await shot(i / CAPTURE_FPS)); + if (i % 120 === 0 || i === frames - 1) { const el = (Date.now() - t0) / 1000; log(`${f.id}: frame ${i + 1}/${frames} · ${el.toFixed(0)}s · eta ${((frames - i - 1) * el / (i + 1)).toFixed(0)}s`); } } await enc.stdin.end(); if (await enc.exited !== 0) throw new Error('ffmpeg encode failed'); + if (errors.length) throw new Error(`page errors:\n ${[...new Set(errors)].join('\n ')}`); ff('-ss', String(DURATION - 0.5), '-i', silent, '-frames:v', '1', '-q:v', '3', join(OUT, `poster-${f.w}x${f.h}.jpg`)); log(`${f.id}: ${silent} (${(statSync(silent).size / 1e6).toFixed(1)} MB)`); await page.close(); } if (stills || args.includes('--no-audio')) return; - // music + // music + sound design const page = await browser.newPage(); await page.goto(base); - log('music: rendering (OfflineAudioContext)'); + log('sound: rendering (OfflineAudioContext)'); const wav = await page.evaluate(`import('./music.js').then(m => m.renderWav())`) as { base64: string; peak: number; seconds: number }; - log(`music: ${wav.seconds.toFixed(2)} s, raw peak ${wav.peak.toFixed(3)}`); + log(`sound: ${wav.seconds.toFixed(2)} s, raw peak ${wav.peak.toFixed(3)}`); const raw = join(OUT, 'music-raw.wav'), music = join(OUT, 'music.wav'); await Bun.write(raw, Buffer.from(wav.base64, 'base64')); const dur = wav.seconds; - // two-pass loudnorm to -14 LUFS / -1 dBTP, then a 2 s fade out + // two-pass loudnorm to -14 LUFS / -1.5 dBTP, then a short fade out const m = Bun.spawnSync(['ffmpeg', '-hide_banner', '-i', raw, '-af', 'loudnorm=I=-14:TP=-1.5:LRA=11:print_format=json', '-f', 'null', '-'], { stderr: 'pipe' }); const j = JSON.parse(m.stderr.toString().match(/\{[\s\S]*?\}/)![0]) as Record; - ff('-i', raw, '-af', `loudnorm=I=-14:TP=-1.5:LRA=11:measured_I=${j.input_i}:measured_TP=${j.input_tp}:measured_LRA=${j.input_lra}:measured_thresh=${j.input_thresh}:offset=${j.target_offset}:linear=true,afade=t=out:st=${(dur - 2).toFixed(2)}:d=2,aresample=48000`, + ff('-i', raw, '-af', `loudnorm=I=-14:TP=-1.5:LRA=11:measured_I=${j.input_i}:measured_TP=${j.input_tp}:measured_LRA=${j.input_lra}:measured_thresh=${j.input_thresh}:offset=${j.target_offset}:linear=true,afade=t=out:st=${(dur - 1.2).toFixed(2)}:d=1.2,aresample=48000`, '-c:a', 'pcm_s16le', '-ar', '48000', '-ac', '2', music); for (const f of FORMATS) { const silent = join(OUT, `teaser-${f.w}x${f.h}-silent.mp4`), out = join(OUT, `teaser-${f.w}x${f.h}.mp4`); @@ -130,6 +144,19 @@ async function main(): Promise { ff('-i', silent, '-i', music, '-map', '0:v', '-map', '1:a', '-c:v', 'copy', '-c:a', 'aac', '-b:a', '192k', '-ar', '48000', '-ac', '2', '-shortest', '-movflags', '+faststart', out); log(`${out} (${(statSync(out).size / 1e6).toFixed(1)} MB)`); } + + // web version for the site: 1280x720 H.264, about 3.5 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'); + const kbps = Math.floor((3.5e6 * 8) / dur / 1000) - 96; + const common = ['-vf', 'scale=1280:720:flags=lanczos', '-c:v', 'libx264', '-profile:v', 'high', '-preset', 'slow', '-b:v', `${kbps}k`, '-maxrate', `${Math.round(kbps * 1.8)}k`, '-bufsize', `${kbps * 3}k`, '-pix_fmt', 'yuv420p', '-g', '60', '-passlogfile', pass]; + ff('-i', h, ...common, '-pass', '1', '-an', '-f', 'mp4', '/dev/null'); + ff('-i', h, ...common, '-pass', '2', '-c:a', 'aac', '-b:a', '96k', '-ac', '2', '-movflags', '+faststart', web); + for (const x of readdirSync(OUT)) if (x.startsWith('web-pass')) rmSync(join(OUT, x)); + ff('-ss', String(dur - 0.5), '-i', web, '-frames:v', '1', '-q:v', '4', join(OUT, 'poster-web.jpg')); + log(`${web} (${(statSync(web).size / 1e6).toFixed(2)} MB, ${kbps} kbps video) + poster-web.jpg`); + } } finally { await browser.close(); server.stop(true); diff --git a/media/teaser/script.js b/media/teaser/script.js index e986657a..76bec82e 100644 --- a/media/teaser/script.js +++ b/media/teaser/script.js @@ -1,166 +1,167 @@ -// Teaser timeline: the single source of truth for the picture (teaser.js) and the music (music.js). -// Everything is a pure function of time, so a frame at t always looks the same and the hits land on the cuts. -// The terminal text is scripted, modelled on real storebound output for the demo game (examples/demo-game, -// placeholder ids, dry runs). Nothing here talks to a store. +// Teaser timeline: the single source of truth for the picture (teaser.js) and the sound (music.js). +// Every frame is a pure function of time; every cut sits on a beat of the 128 BPM grid, and the sound effects (whoosh, +// tick, hit) are placed from the same numbers, so they land on the cuts. +// +// The scan text is the real `storebound scan` output of tests/fixtures/scan/teaser (before) and teaser-fixed (after +// the five fixes); tests/teaser.test.ts runs the scan and checks every line shown here against it. export const BPM = 128; -export const BEAT = 60 / BPM; // 0.46875 s -export const BAR = BEAT * 4; // 1.875 s +export const BEAT = 60 / BPM; // 0.46875 s +export const BAR = BEAT * 4; // 1.875 s export const FPS = 30; -export const BARS = 26; -export const DURATION = BARS * BAR; // 48.75 s +export const B = n => n * BEAT; // beats -> seconds +export const BEATS = 72; // 18 bars +export const DURATION = B(BEATS); // 33.75 s -/** Scenes in bars; start/end in seconds are derived below. */ -const SCENE_BARS = [ - ['prompt', 2], - ['config', 2], - ['prices', 2], - ['languages', 2], - ['questionnaires', 2], - ['shots', 3], - ['validate', 2], - ['desktop', 6], // the desktop app: real UI frames (desktop.ts), see DESKTOP below - ['submit', 2], - ['brand', 3], -]; -let acc = 0; -export const SCENES = SCENE_BARS.map(([id, bars]) => { - const s = { id, start: acc * BAR, end: (acc + bars) * BAR, bars }; - acc += bars; - return s; -}); +/** Scenes in beats (start, end). Cuts: the hook's hard cut, then whips and masks on the beat. */ +export const SCENES = [ + { id: 'hook', from: 0, to: 7, in: null }, // inbox, rejection mails stack, "Rejected. Again." + { id: 'scan', from: 7, to: 24, in: 'hard' }, // black, the terminal types `storebound scan`, the output + { id: 'fixed', from: 24, to: 30, in: 'whip-left' }, // the re-scan after the fixes: reds flip green, 0 blockers + { id: 'shots', from: 30, to: 36, in: 'iris' }, // store screenshots wall + { id: 'decl', from: 36, to: 42, in: 'whip-up' }, // declarations proposal -> Data safety answers + { id: 'desk1', from: 42, to: 48, in: 'wipe' }, // desktop: Portfolio across studios + { id: 'desk2', from: 48, to: 54, in: 'whip-left' }, // desktop: release timeline, rollout to 20% + { id: 'desk3', from: 54, to: 60, in: 'whip-left' }, // desktop: Checks, rejection risks turn green + { id: 'submit', from: 60, to: 66, in: 'zoom' }, // "It never presses Submit. You do." + { id: 'brand', from: 66, to: 72, in: 'iris' }, // logo, storebound.dev, platforms +].map(s => ({ ...s, start: B(s.from), end: B(s.to) })); export const scene = id => SCENES.find(s => s.id === id); - -export const PROMPT = 'ship Prism Puddle to Google Play and the App Store'; -export const PROMPT_AT = 0.35; // seconds -export const PROMPT_CPS = 21; // the user types -export const CMD_CPS = 62; // the agent types - -export const LANGS = ['en-US', 'tr-TR', 'de-DE', 'fr-FR', 'es-ES', 'es-419', 'it-IT', 'pt-BR', 'ja-JP', 'ko-KR', 'zh-CN', 'ru-RU', 'ar', 'hi-IN']; - -// Price rows for the flicker panel: illustrative local price points for a 2.99 / 0.99 USD pair (Play converts from -// USD per region; TR is a config override, as in templates/storebound.config.ts). -export const PRICES = [ - ['US', 'USD', '2.99', '0.99'], - ['TR', 'TRY', '99.99', '34.99'], - ['DE', 'EUR', '2.99', '0.99'], - ['GB', 'GBP', '2.79', '0.89'], - ['JP', 'JPY', '450', '150'], - ['BR', 'BRL', '14.90', '4.90'], - ['IN', 'INR', '249', '79'], - ['KR', 'KRW', '4,100', '1,300'], - ['MX', 'MXN', '59.00', '19.00'], - ['ID', 'IDR', '45,000', '15,000'], - ['SA', 'SAR', '10.99', '3.69'], - ['FR', 'EUR', '2.99', '0.99'], - ['CA', 'CAD', '3.99', '1.39'], - ['AU', 'AUD', '4.49', '1.49'], -]; - -export const BLOCKERS = [ - ['apple', 'build 12 is PROCESSING'], - ['apple', 'ja: missing keywords'], - ['apple', 'remove_ads: MISSING_METADATA'], - ['apple', 'no app price schedule'], - ['play', 'tr-TR: no listing'], - ['play', 'drops_500: not on Play'], - ['play', 'no release on any track'], -]; -export const BLOCKERS_AT = 0.45; // first blocker line, relative to the validate scene -export const BLOCKER_GAP = 0.05; -export const FIX_AT = 1.05; // first flip to ok -export const FIX_GAP = 0.26; +/** Transition length (seconds) per kind; the incoming scene starts at the cut, the outgoing one leaves before it. */ +export const TRANS = { hard: 0, 'whip-left': 0.34, 'whip-up': 0.34, iris: 0.42, wipe: 0.42, zoom: 0.36 }; /** - * Terminal lines per scene. at = seconds after the scene start. - * kind: cmd (typed by the agent), out (printed), note (agent comment), ok / bad (coloured output). + * Captions: one display font, at most 7 words. at / to in seconds (absolute). *word* = highlighted. + * Every caption holds at least 1.2 s (tests/teaser.test.ts). */ -const T = { - prompt: [ - { at: 2.85, kind: 'note', text: 'agent using storebound · dry runs first' }, - ], - config: [ - { at: 0.0, kind: 'cmd', text: 'bunx storebound init' }, - { at: 0.45, kind: 'out', text: '[init] create storebound.config.ts' }, - { at: 0.55, kind: 'out', text: '[init] create store/listing.md' }, - { at: 0.65, kind: 'out', text: '[init] create store/appstore.md' }, - { at: 0.75, kind: 'out', text: '[init] create store/declarations.md' }, - { at: 0.85, kind: 'out', text: '[init] create store/app-privacy.md' }, - { at: 0.95, kind: 'out', text: '[init] create store/privacy-policy.html' }, - { at: 1.875, kind: 'cmd', text: 'bunx storebound check' }, - { at: 2.3, kind: 'out', text: '[check] config ok: storebound.config.ts' }, - { at: 2.42, kind: 'out', text: '[check] play listing: 14 languages' }, - { at: 2.54, kind: 'out', text: '[check] appstore listing: 14 locales' }, - { at: 2.66, kind: 'out', text: '[check] data safety: 764 CSV rows' }, - { at: 2.78, kind: 'out', text: '[check] shots copy: 14 languages x 4 scenes' }, - ], - prices: [ - { at: 0.0, kind: 'cmd', text: 'bunx storebound play products --dry' }, - { at: 0.62, kind: 'out', text: '[play] 1/2 remove_ads: create · 173 regions (dry)' }, - { at: 0.9, kind: 'out', text: '[play] 2/2 drops_500: create · 173 regions (dry)' }, - { at: 1.4, kind: 'cmd', text: 'bunx storebound apple iap --dry' }, - { at: 1.95, kind: 'out', text: '[apple] 1/2 remove_ads: missing (dry)' }, - { at: 2.07, kind: 'out', text: '[apple] 2/2 drops_500: missing (dry)' }, - ], - languages: [ - { at: 0.0, kind: 'cmd', text: 'bunx storebound play listing --dry' }, - { at: 0.6, kind: 'out', text: `[play] 14 listings: ${LANGS.slice(0, 4).join(', ')} ...` }, - ...LANGS.map((l, i) => ({ at: 0.8 + i * 0.13, kind: 'out', text: `[play] ${String(i + 1).padStart(2)}/14 ${l}` })), - ], - questionnaires: [ - { at: 0.0, kind: 'cmd', text: 'bunx storebound play data-safety --dry' }, - { at: 0.62, kind: 'out', text: '[play] data safety: 6 data types declared' }, - { at: 0.95, kind: 'cmd', text: 'bunx storebound apple appinfo --dry' }, - { at: 1.55, kind: 'out', text: '[apple] categories: GAMES / GAMES_CASUAL (dry)' }, - { at: 1.67, kind: 'out', text: '[apple] age rating declaration: all NONE (dry)' }, - { at: 1.85, kind: 'note', text: '[apple] appinfo done (App Privacy is UI-only: store-declarations skill)' }, - ], - shots: [ - { at: 0.0, kind: 'cmd', text: 'bunx storebound shots render' }, - ...['play', 'tab7', 'tab10', 'ios69', 'ios65', 'ipad13', 'feature'].flatMap((d, k) => - ['en', 'tr', 'ja', 'ar'].map((l, j) => ({ at: 0.5 + (k * 4 + j) * 0.14, kind: 'out', - text: `[shots] store/renders/${l}/${d}/${d === 'feature' ? '1024x500' : '01'}.png` }))), - ], - validate: [ - { at: 0.0, kind: 'cmd', text: 'bunx storebound validate' }, - // the blocker lines are drawn by teaser.js from BLOCKERS (they change state) - ], -}; -export const TERMINAL = T; +export const CAPTIONS = [ + { id: 'rejected', at: B(3), to: B(7), lines: ['*Rejected.*', 'Again.'], hl: 'red', big: true, word: [B(3), B(4)] }, + { id: 'reads', at: B(10.5), to: B(16), lines: ['It reads', 'your project.'] }, + { id: 'finds', at: B(16), to: B(24), lines: ['Finds the rejections', 'before *Apple* does.'] }, + { id: 'fixed', at: B(24), to: B(30), lines: ['Fix it.', 'Scan *again.*'], hl: 'green' }, + { id: 'shots', at: B(30), to: B(36), lines: ['*200* store screenshots.', 'One command.'] }, + { id: 'decl', at: B(36), to: B(42), lines: ['*764* answers,', 'read from your code.'] }, + { id: 'desk1', at: B(42), to: B(48), lines: ['Every app.', 'Every *studio.*'] }, + { id: 'desk2', at: B(48), to: B(54), lines: ['Both stores.', 'One *timeline.*'] }, + { id: 'desk3', at: B(54), to: B(60), lines: ['Risks turn', '*green.*'], hl: 'green' }, + { id: 'submit', at: B(60.5), to: B(66), lines: ['It never presses *Submit.*', 'You do.'] }, +]; /** - * The desktop scene, in seconds after its start: which captured frame (out/desktop/.jpg, desktop.ts) shows, - * the camera zoom toward a point of the frame (fractions of the 1280 x 800 window), and the step label. - * The frames are the real app in fixture mode; the confirm dialog is drawn on top (the app's is a native OS dialog). + * When each caption is fully readable (every word in, before its exit), as teaser.js animates it: words pop in 0.07 s + * apart over 0.34 s (the hook's two words slam in over 0.2 s at their beats); the exit fades over the last 0.16 s + * (the hook ends on a hard cut instead). */ -export const DESKTOP = [ - { at: 0.0, frame: 'portfolio', focus: [0.42, 0.42], zoom: 1.12, step: 'Every app of every studio' }, - { at: 1.875, frame: 'releases', focus: [0.6, 0.38], zoom: 1.45, step: 'Both stores on one release track' }, - { at: 3.75, frame: 'growth', focus: 'hover', zoom: 1.5, step: 'Growth and health, charted' }, - { at: 5.625, frame: 'palette', focus: [0.25, 0.45], zoom: 1.35, step: '⌘K: jump anywhere' }, - { at: 6.8, frame: 'prices-diff', focus: 'apply', zoom: 1.4, step: 'Every write: dry run first' }, - { at: 7.95, frame: 'prices-diff', focus: 'apply', zoom: 1.4, dialog: true, step: 'Then your Apply, in a system dialog' }, - { at: 9.375, frame: 'releases', focus: [0.58, 0.22], zoom: 1.3, step: 'Submit for review stays in the console' }, -]; -/** Cursor waypoints of the desktop scene: [at, target, click]; targets name a boxes.json entry or a dialog button. */ -export const DESK_CURSOR = [ - [3.95, 'off'], [4.55, 'hover'], [6.9, 'hover'], [7.55, 'apply', true], [8.5, 'dialog-ok'], [8.75, 'dialog-ok', true], - [9.5, 'dialog-ok'], [10.25, 'console'], -]; -export const DESK_HOVER_AT = 4.6; // the chart tooltip shows (growth -> growth-hover) -export const DESK_DIALOG = [7.95, 9.0]; // the dialog is up (after the Apply click, until the Yes click) -export const DESK_LINK_AT = 10.35; // "Submit for review · your click" by the console button - -/** Seconds at which each typed character lands (for key clicks in the music). */ -export function keyTimes() { - const out = []; - for (let i = 0; i < PROMPT.length; i++) out.push(PROMPT_AT + i / PROMPT_CPS); - for (const s of SCENES) for (const l of T[s.id] ?? []) { - if (l.kind !== 'cmd') continue; - for (let i = 0; i < l.text.length; i++) out.push(s.start + l.at + i / CMD_CPS); - } - return out; +export function captionTimes() { + return CAPTIONS.map(c => { + const words = c.lines.join(' ').replace(/\*/g, ''); + const from = c.big ? c.word[c.word.length - 1] + 0.2 : c.at + 0.34 + 0.07 * (words.split(' ').length - 1); + const to = c.big ? c.to : c.to - 0.16; + return { id: c.id, words, count: words.split(' ').length, at: c.at, from, to, hold: to - from }; + }); } -/** Seconds of the scene cuts that get a hit (every scene after the first). */ -export const CUTS = SCENES.slice(1).map(s => s.start); +// ---------- hook: a generic, made-up inbox (no real product, no real names or addresses) ---------- +export const MAIL_SUBJECT = "There's an issue with your Prism Puddle submission"; +export const MAILS = [ + { at: B(0.5), date: 'Mon', guideline: 'Guideline 2.1 · Information Needed' }, + { at: B(1.25), date: 'Wed', guideline: 'Guideline 5.1.1(v) · Data Collection and Storage' }, + { at: B(2), date: '9:41 AM', guideline: 'Guideline 4.8 · Login Services' }, +]; +/** Earlier, unrelated mails under the rejections (generic, fictional). */ +export const OLD_MAILS = [ + { from: 'Team Calendar', subject: 'Sprint review moved to Thursday', preview: 'The demo slot is now 3 pm. Bring the build.', date: 'Sun' }, + { from: 'Build Server', subject: 'Prism Puddle 1.0 (12) uploaded', preview: 'Processing finished. The build is ready to submit.', date: 'Sat' }, + { from: 'Design', subject: 'Final icon + screenshots', preview: 'All sizes exported, see the shared folder.', date: 'Fri' }, +]; + +// ---------- terminal: `storebound scan` ---------- +export const CMD = 'storebound scan'; +export const TYPE_AT = B(7.6); +export const TYPE_CPS = 15; +export const ENTER_AT = B(10); + +/** Real output lines (tests/teaser.test.ts checks each against the scan of the fixture). at = seconds (absolute). */ +export const SCAN_HEAD = [ + { at: B(10.15), text: 'storebound scan · storebound.config.ts', kind: 'head' }, + { at: B(10.4), text: 'stack: iOS (native) · targets: iOS · 11 files', kind: 'dim' }, +]; +export const SDK_AT = B(11); +export const SDKS = [ + { at: B(11.5), name: 'Google AdMob', what: 'ads, tracking-capable', dep: 'CocoaPods Google-Mobile-Ads-SDK 11.10.0', where: 'Podfile.lock:2' }, + { at: B(12.25), name: 'Google Sign-In', what: 'auth', dep: 'CocoaPods GoogleSignIn 7.1.0', where: 'Podfile.lock:3' }, +]; +export const RISKS_AT = B(13.25); +export const RISKS_LINE = 'Rejection risks: 2 blocker, 3 high, 0 medium, 0 low'; +/** The five findings. fix = a verbatim fragment of the real fix (the full text is in the CLI output). */ +export const FINDINGS = [ + { at: B(14), sev: 'BLOCKER', guideline: '2.1(a)', title: 'Sign-in is required but there is no demo account for App Review', + where: 'storebound.config.ts:12', fix: 'Create a demo account that sees every feature', skill: 'review-access', short: 'Demo account for App Review' }, + { at: B(16), sev: 'BLOCKER', guideline: '5.1.1(v)', title: 'Accounts can be created but no in-app account deletion was found', + where: 'Planner/LoginView.swift:11', fix: 'Add "Delete account" in the app', skill: 'account-deletion', short: 'In-app account deletion' }, + { at: B(18), sev: 'HIGH', guideline: '4.8', title: 'Third-party login (Google / Facebook / ...) without Sign in with Apple or another equivalent login option', + where: 'Planner/LoginView.swift:9', fix: 'Offer Sign in with Apple', skill: 'review-rejections', short: 'Sign in with Apple' }, + { at: B(20), sev: 'HIGH', guideline: '3.1.1', title: 'Restorable purchases (non-consumables or subscriptions) but no Restore Purchases path was found', + where: 'storebound.config.ts:16', fix: 'Add a visible "Restore Purchases" button', skill: 'store-iap-setup', short: 'Restore Purchases' }, + { at: B(22), sev: 'HIGH', guideline: '5.1.2(i)', title: 'Tracking-capable code without App Tracking Transparency (Google AdMob, IDFA)', + where: 'Planner/Ads.swift:7', fix: 'add NSUserTrackingUsageDescription and request ATT before the SDKs start', skill: 'ads-mediation-checks', short: 'App Tracking Transparency' }, +]; + +// ---------- fixed: the re-scan of the fixed copy (tests/fixtures/scan/teaser-fixed) ---------- +export const RESCAN_CMD = 'storebound scan'; +export const RESCAN_TYPE_AT = B(24.3); +export const FLIP_AT = [B(25.5), B(26), B(26.5), B(27), B(27.5)]; // each red row turns green +export const RESCAN_LINE = 'Rejection risks: 0 blocker, 0 high, 0 medium, 0 low'; +export const RESCAN_NONE = 'none found in the project files and config'; +export const RESCAN_LINE_AT = B(28); + +// ---------- payoff ---------- +export const SHOTS_TOTAL = 200; // examples/demo-game: 4 languages x 2 sets x 25 store images (+ 8 extra) +export const SHOTS_CMD = 'storebound shots render'; +export const DECL_TOTAL = 764; // Play Data safety CSV rows built from the config (`storebound check`) +/** Real lines of the declarations proposal (scan of the teaser fixture). */ +export const DECL_LINES = [ + { area: 'Data safety', what: 'PSL_DEVICE_ID', value: 'collect: advertising, analytics, fraud', where: 'Podfile.lock:2' }, + { area: 'Data safety', what: 'PSL_APPROX_LOCATION', value: 'collect: advertising, analytics, fraud', where: 'Podfile.lock:2' }, + { area: 'Data safety', what: 'PSL_EMAIL', value: 'collect: account, functionality', where: 'Podfile.lock:3' }, + { area: 'Data safety', what: 'PSL_USER_ACCOUNT', value: 'collect: account, functionality', where: 'Podfile.lock:3' }, +]; +export const DECL_ASK = 'ask owner encryptedInTransit'; +export const DATA_SAFETY_ROWS = [ + 'Device or other IDs', 'Approximate location', 'App interactions', 'Diagnostics', 'Name', 'Email address', 'User IDs', +]; + +// ---------- desktop: real frames (desktop.ts), camera from -> to (focus as fractions of the 1280 x 800 frame) ---------- +export const DESKTOP = { + desk1: { frame: 'portfolio', from: { f: [0.5, 0.5], z: 1.0 }, to: { f: [0.62, 0.52], z: 1.12 }, + cursor: [[0.6, 'off'], [1.25, 'studios']], callout: { at: 1.35, target: 'studios', text: '3 studios · 2 stores' } }, + desk2: { frame: 'releases', empty: 'releases-empty', from: { f: [0.55, 0.5], z: 1.0 }, to: { f: [0.72, 0.62], z: 1.22 }, + cursor: [[0.5, 'off'], [1.15, 'roll']], fill: [1.1, 2.0], callout: { at: 1.3, target: 'roll', text: 'Rollout · 20%' } }, + desk3: { frame: 'checks', clean: 'checks-clean', from: { f: [0.55, 0.55], z: 1.0 }, to: { f: [0.55, 0.6], z: 1.14 }, + cursor: [[0.5, 'off'], [1.0, 'scanAgain']], flip: 1.25, callout: { at: 1.55, target: 'scanClean', text: '0 rejection risks' } }, +}; + +// ---------- end ---------- +export const SUBMIT_HOVER = B(61.5); // the cursor stops on the button, it never clicks +export const URL = 'storebound.dev'; +export const PLATFORMS = 'Open source · macOS · Windows · Linux'; + +// ---------- sound cues (music.js) ---------- +/** Every cut that gets a hit, with the kind of transition (a whoosh leads into whips, masks and zooms). */ +export const CUTS = SCENES.slice(1).map(s => ({ t: s.start, kind: s.in, id: s.id })); +/** Ticks: mails landing, findings landing, green flips, callouts. */ +export const TICKS = [ + ...MAILS.map(m => ({ t: m.at, kind: 'mail' })), + ...SDKS.map(s => ({ t: s.at, kind: 'soft' })), + { t: RISKS_AT, kind: 'soft' }, + ...FINDINGS.map(f => ({ t: f.at, kind: 'bad' })), + ...FLIP_AT.map((t, i) => ({ t, kind: 'good', step: i })), + ...Object.entries(DESKTOP).map(([id, d]) => ({ t: scene(id).start + d.callout.at, kind: 'pop' })), +]; +/** Seconds at which each typed character lands (key clicks). */ +export function keyTimes() { + const out = []; + for (let i = 0; i < CMD.length; i++) out.push(TYPE_AT + i / TYPE_CPS); + for (let i = 0; i < RESCAN_CMD.length; i++) out.push(RESCAN_TYPE_AT + i / 24); + return out; +} diff --git a/media/teaser/teaser.js b/media/teaser/teaser.js index beeca6b2..ab88ba2e 100644 --- a/media/teaser/teaser.js +++ b/media/teaser/teaser.js @@ -1,7 +1,8 @@ // Teaser picture: every element is set from the time t alone (window.teaser.seek(t)), so frames render // deterministically, in any order. URL: ?w=1080&h=1920 (or 1920x1080) · &t=12.5 to hold a frame · &play=1 to preview. -import { BAR, BEAT, BLOCKERS, BLOCKERS_AT, BLOCKER_GAP, CMD_CPS, CUTS, DESK_CURSOR, DESK_DIALOG, DESK_HOVER_AT, DESK_LINK_AT, - DESKTOP, DURATION, FIX_AT, FIX_GAP, FPS, LANGS, PRICES, PROMPT, PROMPT_AT, PROMPT_CPS, SCENES, TERMINAL, scene } from './script.js'; +import { B, BEAT, CAPTIONS, captionTimes, CMD, DATA_SAFETY_ROWS, DECL_ASK, DECL_LINES, DECL_TOTAL, DESKTOP, DURATION, ENTER_AT, FINDINGS, + FLIP_AT, FPS, MAIL_SUBJECT, MAILS, OLD_MAILS, PLATFORMS, RESCAN_CMD, RESCAN_LINE, RESCAN_LINE_AT, RESCAN_NONE, RESCAN_TYPE_AT, + RISKS_AT, RISKS_LINE, SCAN_HEAD, SCENES, SDK_AT, SDKS, SHOTS_TOTAL, SUBMIT_HOVER, TRANS, TYPE_AT, TYPE_CPS, URL, scene } from './script.js'; const q = new URLSearchParams(location.search); const W = Number(q.get('w') ?? 1080), H = Number(q.get('h') ?? 1920); @@ -13,465 +14,574 @@ document.body.classList.add(V ? 'v' : 'h'); // ---------- easing ---------- const clamp = (x, a = 0, b = 1) => Math.min(b, Math.max(a, x)); -const prog = (t, a, d) => clamp((t - a) / d); +const prog = (t, a, d) => (d <= 0 ? (t >= a ? 1 : 0) : clamp((t - a) / d)); const eoc = p => 1 - Math.pow(1 - p, 3); +const eoq = p => 1 - Math.pow(1 - p, 5); const eic = p => p * p * p; +const eio = p => (p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2); const eob = p => { const c1 = 1.70158, c3 = c1 + 1; return 1 + c3 * Math.pow(p - 1, 3) + c1 * Math.pow(p - 1, 2); }; const lerp = (a, b, p) => a + (b - a) * p; -const esc = s => s.replace(/&/g, '&').replace(//g, '>'); -const sceneAt = t => SCENES.find(s => t >= s.start && t < s.end) ?? SCENES[SCENES.length - 1]; +const esc = s => String(s).replace(/&/g, '&').replace(//g, '>'); +const set = (el, k, v) => { if (el.__s?.[k] !== v) { (el.__s ??= {})[k] = v; el.style[k] = v; } }; +const html = (el, v) => { if (el.__h !== v) { el.__h = v; el.innerHTML = v; } }; +const decay = (t, at, d) => (t >= at && t < at + d ? 1 - (t - at) / d : 0); -// ---------- background ---------- -const g1 = $('#bg .g1'), g2 = $('#bg .g2'), g3 = $('#bg .g3'), grid = $('#bg .grid'), flash = $('#flash'); +/** Layout per format: caption band on top, content below; the bottom ~22% of the vertical frame stays calm. */ +const L = V + ? { cy: 1010, top: 520, bottom: 1490, margin: 60 } + : { cy: 675, top: 300, bottom: 1045, margin: 160 }; + +// ---------- scenes and transitions ---------- +const sceneEls = Object.fromEntries(SCENES.map(s => [s.id, $(`#s-${s.id}`)])); +const DIAG = Math.hypot(W, H); +/** Visibility, transform, clip and blur of a scene at t, from its own entry and the next scene's entry. */ +function sceneFx(i, t) { + const s = SCENES[i], next = SCENES[i + 1]; + const enter = s.in, exit = next?.in ?? null; + const lead = k => (k && k.startsWith('whip') ? 0.08 : 0); + const tail = k => (k === 'iris' || k === 'wipe' ? TRANS[k] : k && k.startsWith('whip') ? 0.08 : 0); + if (t < s.start - lead(enter) || t >= s.end + tail(exit)) return null; + let tx = 0, ty = 0, sc = 1, blur = 0, op = 1, clip = 'none', dark = 0; + // entry + if (enter === 'whip-left' || enter === 'whip-up') { + const p = prog(t, s.start - 0.08, 0.34), e = eoq(p); + if (enter === 'whip-left') tx += (1 - e) * W * 1.05; else ty += (1 - e) * H * 1.05; + blur += (1 - eoc(p)) * 26; + } else if (enter === 'iris') { + const p = prog(t, s.start, TRANS.iris); + if (p < 1) clip = `circle(${(eio(p) * DIAG * 0.55).toFixed(1)}px at 50% 50%)`; + } else if (enter === 'wipe') { + const p = prog(t, s.start, TRANS.wipe); + if (p < 1) { const sk = H * 0.35, x = lerp(-sk, W + sk, eio(p)); clip = `polygon(0 0, ${x + sk}px 0, ${x}px 100%, 0 100%)`; } + } else if (enter === 'zoom') { + const p = prog(t, s.start, TRANS.zoom); + sc *= lerp(0.8, 1, eoc(p)); op *= eoc(p); blur += (1 - p) * 12; + } + // exit + if (exit === 'whip-left' || exit === 'whip-up') { + const p = prog(t, s.end - 0.22, 0.3), e = eic(p); + if (exit === 'whip-left') tx -= e * W * 1.05; else ty -= e * H * 1.05; + blur += p * 26; + } else if (exit === 'iris' || exit === 'wipe') { + const p = prog(t, s.end - 0.1, TRANS[exit] + 0.1); + sc *= 1 + 0.07 * eio(p); dark = 0.5 * p; + } else if (exit === 'zoom') { + const p = prog(t, s.end - 0.26, 0.26); + sc *= 1 + 0.8 * eic(p); op *= 1 - eic(p); blur += eic(p) * 16; + } + return { tx, ty, sc, blur, op, clip, dark }; +} +function scenes(t) { + SCENES.forEach((s, i) => { + const el = sceneEls[s.id], fx = sceneFx(i, t); + if (!fx) { set(el, 'opacity', '0'); set(el, 'visibility', 'hidden'); return; } + set(el, 'visibility', 'visible'); + set(el, 'opacity', String(fx.op)); + set(el, 'transform', `translate(${fx.tx.toFixed(1)}px, ${fx.ty.toFixed(1)}px) scale(${fx.sc.toFixed(4)})`); + set(el, 'filter', [fx.blur > 0.3 ? `blur(${fx.blur.toFixed(1)}px)` : '', fx.dark > 0.01 ? `brightness(${(1 - fx.dark).toFixed(3)})` : ''].join(' ').trim() || 'none'); + set(el, 'clipPath', fx.clip); + }); +} +const active = t => SCENES.find(s => t >= s.start && t < s.end) ?? SCENES[SCENES.length - 1]; + +// ---------- background, flash ---------- +const g1 = $('#bg .g1'), g2 = $('#bg .g2'), g3 = $('#bg .g3'), grid = $('#bg .grid'), flash = $('#flash'), bg = $('#bg'); +const HITS = [ + { t: B(3), a: 0.5, c: '#ff3b3b' }, { t: B(4), a: 0.6, c: '#ff3b3b' }, { t: ENTER_AT, a: 0.5, c: '#ffffff' }, + ...SCENES.slice(2).map(s => ({ t: s.start, a: s.id === 'brand' ? 0.55 : 0.28, c: '#ffffff' })), + ...FINDINGS.map(f => ({ t: f.at, a: 0.18, c: '#ff3b3b' })), +]; function background(t) { + set(bg, 'opacity', t >= scene('scan').start ? '1' : '0'); let pulse = 0; - for (const c of CUTS) if (t >= c) pulse = Math.max(pulse, 1 - prog(t, c, 0.6)); - const beat = 1 - prog((t % BEAT), 0, BEAT * 0.6); - g1.style.transform = `translate(${W * 0.15 + Math.sin(t * 0.31) * 140 - 450}px, ${H * 0.28 + Math.cos(t * 0.23) * 120 - 450}px) scale(${1 + pulse * 0.18})`; - g2.style.transform = `translate(${W * 0.85 + Math.cos(t * 0.27) * 160 - 380}px, ${H * 0.72 + Math.sin(t * 0.35) * 140 - 380}px)`; - g3.style.transform = `translate(${W * 0.7 + Math.sin(t * 0.19) * 200 - 320}px, ${H * 0.1 + Math.cos(t * 0.29) * 100 - 320}px)`; - g1.style.opacity = String(0.8 + 0.2 * beat * (t > SCENES[1].start ? 1 : 0.3)); - grid.style.transform = `translate(${(t * 18) % 64}px, ${(t * 26) % 64}px)`; - let f = 0; - for (const c of CUTS) if (t >= c && t < c + 0.14) f = Math.max(f, (c === scene('brand').start || c === scene('submit').start ? 0.45 : 0.2) * (1 - (t - c) / 0.14)); - flash.style.opacity = String(f); + for (const h of HITS) pulse = Math.max(pulse, decay(t, h.t, 0.6) * h.a); + g1.style.transform = `translate(${W * 0.2 + Math.sin(t * 0.33) * 160 - 550}px, ${H * 0.3 + Math.cos(t * 0.25) * 140 - 550}px) scale(${1 + pulse * 0.3})`; + g2.style.transform = `translate(${W * 0.85 + Math.cos(t * 0.29) * 180 - 450}px, ${H * 0.75 + Math.sin(t * 0.37) * 150 - 450}px)`; + const red = t >= scene('scan').start && t < scene('fixed').start + 1.5 ? clamp((t - FINDINGS[0].at) / 1.5) * (1 - prog(t, FLIP_AT[0], 1.5)) : 0; + g3.style.background = `radial-gradient(circle, rgba(255,90,95,${(0.22 * red).toFixed(3)}), rgba(255,90,95,0) 62%)`; + g3.style.transform = `translate(${W * 0.75 - 400}px, ${H * 0.45 - 400}px)`; + grid.style.transform = `translate(${(t * 20) % 96}px, ${(t * 28) % 96}px)`; + let f = 0, c = '#fff'; + for (const h of HITS) { const v = decay(t, h.t, 0.18) * h.a; if (v > f) { f = v; c = h.c; } } + set(flash, 'opacity', f.toFixed(3)); + set(flash, 'background', c); } // ---------- captions ---------- -// lines: array of [text, at] ; words wrapped in *...* are highlighted. at = seconds after the caption start. -const CAPS = [ - { id: 'prompt', lines: [['One prompt.', 0.15], ['Two *stores.*', 1.35]] }, - { id: 'config', lines: [['One *config.*', 0.05]], sub: ['storebound.config.ts + store/*.md', 0.55] }, - { id: 'prices', lines: [['IAP *prices.*', 0.05], ['Every region.', 0.55]] }, - { id: 'languages', lines: [['Listings in', 0.05], ['*14* languages.', 0.45]] }, - { id: 'questionnaires', lines: [['Every', 0.05], ['*questionnaire.*', 0.3]], sub: ['Data safety · age rating · App Privacy', 0.9] }, - { id: 'shots', lines: [['Store art,', 0.05], ['*rendered.*', 0.4]], sub: ['real renders · Prism Puddle demo', 1.0] }, - { id: 'validate', lines: [['Blockers', 0.05], ['#count', 0.3]], sub: ['read-only check · in fix order', 0.8] }, - { id: 'desktop', lines: [['And a', 0.05], ['*desktop* app.', 0.3]], sub: ['macOS · Windows · Linux', 0.9] }, -]; -const capEl = $('#caption'); -let capId = null, capWords = [], capSub = null, capCount = null; +const capEl = $('#cap'); +let capId = null, capWords = []; function buildCaption(c) { - const base = V ? 112 : 108; - capEl.style.fontSize = `${base}px`; - capEl.innerHTML = c.lines.map(([text]) => text === '#count' - ? '7' - : `${text.split(' ').map(w => w.startsWith('*') ? `${esc(w.replace(/\*/g, ''))}` : `${esc(w)}`).join(' ')}`).join('') - + (c.sub ? `${esc(c.sub[0])}` : ''); - // fit: the widest line must fit the caption box - const avail = capEl.clientWidth; + capEl.className = [c.big ? 'big' : '', c.hl ?? ''].join(' '); + capEl.style.fontSize = ''; + const one = !V && !c.big && c.lines.join(' ').length <= 30; + const lines = one ? [c.lines.join(' ')] : c.lines; + capEl.innerHTML = lines.map(l => `${l.split(' ').map(w => `${esc(w.replace(/\*/g, ''))}`).join(' ')}`).join(''); + // fit: the widest line stays inside the centre 80% (safe area) + const avail = capEl.clientWidth, base = parseFloat(getComputedStyle(capEl).fontSize); const widest = Math.max(...[...capEl.querySelectorAll('.line')].map(l => l.scrollWidth)); if (widest > avail) capEl.style.fontSize = `${Math.floor(base * avail / widest)}px`; capWords = []; - [...capEl.querySelectorAll('.line')].forEach((l, i) => { - [...l.querySelectorAll('.w')].forEach((w, j) => capWords.push({ el: w, at: c.lines[i][1] + j * 0.07 })); - }); - capSub = c.sub ? { el: capEl.querySelector('.sub'), at: c.sub[1] } : null; - capCount = capEl.querySelector('[data-count]'); + [...capEl.querySelectorAll('.line')].forEach((l, i) => [...l.querySelectorAll('.w')].forEach((w, j) => { + const at = c.big ? c.word[i] : c.at + capWords.length * 0.07; + capWords.push({ el: w, at }); + })); } function captions(t) { - const s = sceneAt(t); - const c = CAPS.find(x => x.id === s.id); - if (!c) { capEl.style.opacity = '0'; return; } + const c = CAPTIONS.find(x => t >= x.at && t < x.to); + if (!c) { set(capEl, 'opacity', '0'); return; } if (capId !== c.id) { capId = c.id; buildCaption(c); } - const r = t - s.start; - const out = prog(t, s.end - 0.16, 0.16); - capEl.style.opacity = String(1 - out); - capEl.style.transform = `translateY(${-50 * eic(out)}px)`; + const hard = c.id === 'rejected'; // the hook ends on a hard cut + const out = hard ? 0 : prog(t, c.to - 0.16, 0.16); + set(capEl, 'opacity', String(1 - out)); + let shake = 0; for (const w of capWords) { - const p = prog(r, w.at, 0.3); - w.el.style.opacity = String(clamp(p * 4)); - w.el.style.transform = `translateY(${(1 - eob(p)) * 0.45}em) scale(${1 + 0.3 * (1 - eoc(p))})`; - } - if (capSub) { - const p = prog(r, capSub.at, 0.3); - capSub.el.style.opacity = String(p); - capSub.el.style.transform = `translateY(${(1 - eoc(p)) * 20}px)`; - } - if (capCount) { - const n = BLOCKERS.length - fixedCount(r); - capCount.textContent = n === 0 ? '0' : String(n); - capCount.classList.toggle('g', n === 0); - const last = n < BLOCKERS.length ? FIX_AT + (BLOCKERS.length - n - 1) * FIX_GAP : -9; - const pop = 1 - prog(r, last, 0.18); - const base = prog(r, 0.3, 0.3); - capCount.style.transform = `translateY(${(1 - eob(base)) * 0.45}em) scale(${(1 + 0.3 * (1 - eoc(base))) * (1 + (n === 0 ? 0.35 : 0.18) * pop)})`; - capCount.style.opacity = String(clamp(base * 4)); - capCount.style.color = n === 0 ? 'var(--green)' : '#f87171'; + const p = prog(t, w.at, c.big ? 0.2 : 0.34); + if (c.big) { + shake = Math.max(shake, decay(t, w.at + 0.05, 0.3)); + set(w.el, 'opacity', String(clamp(p * 3))); + set(w.el, 'transform', `scale(${lerp(2.4, 1, eoc(p)).toFixed(3)})`); + set(w.el, 'filter', p < 1 ? `blur(${((1 - p) * 14).toFixed(1)}px)` : 'none'); + } else { + set(w.el, 'opacity', String(clamp(p * 3))); + set(w.el, 'transform', `translateY(${((1 - eob(p)) * 0.42).toFixed(3)}em) scale(${(1 + 0.25 * (1 - eoc(p))).toFixed(3)})`); + set(w.el, 'filter', p < 1 ? `blur(${((1 - eoc(p)) * 10).toFixed(1)}px)` : 'none'); + } } + const sx = c.big ? Math.sin(t * 97) * 14 * shake : 0, sy = c.big ? Math.cos(t * 83) * 10 * shake : 0; + set(capEl, 'transform', c.big ? `translate(${sx.toFixed(1)}px, calc(-50% + ${sy.toFixed(1)}px))` : `translateY(${(-40 * eic(out)).toFixed(1)}px)`); } -const fixedCount = r => r < FIX_AT ? 0 : Math.min(BLOCKERS.length, Math.floor((r - FIX_AT) / FIX_GAP) + 1); -// ---------- terminal ---------- -const term = $('#term'), pin = $('#term .pin'), linesEl = $('#term .lines'); -const TERM_SCENES = ['prompt', 'config', 'prices', 'languages', 'questionnaires', 'shots', 'validate']; -const PANEL_FOR = { prices: '#prices', languages: '#langs', questionnaires: '#quest' }; -const cursor = ''; -const fmtOut = text => { - const m = text.match(/^\[(\w+)\](.*)$/s); - if (!m) return esc(text); - let rest = esc(m[2]).replace(/\(dry\)/g, '(dry)'); - return `[${m[1]}]${rest}`; +// ---------- hook: inbox ---------- +const list = $('#inbox .list'), hookCam = $('#s-hook .cam'), hookDim = $('#s-hook .dim'), unread = $('#inbox .cnt'); +const ROW_H = V ? 236 : 168; +const mailRow = (m, rej) => { + const el = document.createElement('div'); + el.className = `mrow${rej ? '' : ' old'}`; + el.innerHTML = rej + ? `App Store Connect${esc(m.date)} + ${esc(MAIL_SUBJECT)}Hello, Thank you for submitting… ${esc(m.guideline)}` + : `${esc(m.from)}${esc(m.date)} + ${esc(m.subject)}${esc(m.preview)}`; + list.appendChild(el); + return el; }; -let lastLines = '', lastPin = '', panelTopCache = null; -function terminal(t) { - const s = sceneAt(t); - const on = TERM_SCENES.includes(s.id); - if (!on) { term.style.opacity = '0'; return; } - const r = t - s.start; - // enter + punch on every cut - const enter = s.id === 'prompt' ? eoc(prog(t, 0, 0.35)) : 1; - const punch = s.id === 'prompt' ? 0 : 1 - eoc(prog(r, 0, 0.28)); - const dim = s.id === 'shots' ? 0.72 * eoc(prog(r, 0.35, 0.35)) : 0; - term.style.opacity = String(enter * (1 - dim)); - term.style.transform = `translateY(${(1 - enter) * 60}px) scale(${(0.94 + 0.06 * enter) * (1 + 0.035 * punch)})`; - - // pinned user prompt - const n = clamp(Math.floor((t - PROMPT_AT) * PROMPT_CPS), 0, PROMPT.length); - const typing = n < PROMPT.length; - const blink = Math.floor(t * 2.6) % 2 === 0; - const pinHtml = `> ${esc(PROMPT.slice(0, n))}${s.id === 'prompt' && (typing || blink) ? cursor : ''}`; - if (pinHtml !== lastPin) { pin.innerHTML = pinHtml; lastPin = pinHtml; } - - // scene lines - const out = []; - let busy = false; - for (const l of TERMINAL[s.id] ?? []) { - if (r < l.at) break; - if (l.kind === 'cmd') { - const k = Math.min(l.text.length, Math.floor((r - l.at) * CMD_CPS) + 1); - busy = k < l.text.length; - out.push(`
$ ${esc(l.text.slice(0, k))}${busy ? cursor : ''}
`); - } else if (l.kind === 'note') out.push(`
${fmtOut(l.text)}
`); - else out.push(`
${fmtOut(l.text)}
`); +const oldRows = OLD_MAILS.map(m => ({ el: mailRow(m, false), at: -1 })); +const newRows = MAILS.map(m => ({ el: mailRow(m, true), at: m.at })); +function hook(t) { + if (t >= scene('hook').end) return; + const slots = r => MAILS.filter(m => m.at > r.at).reduce((n, m) => n + eoc(prog(t, m.at, 0.3)), 0); + for (const r of [...oldRows.map((r, i) => ({ ...r, base: i })), ...newRows.map(r => ({ ...r, base: 0 }))]) { + const y = (r.base + slots(r)) * ROW_H; + if (r.at < 0) { set(r.el, 'transform', `translateY(${y.toFixed(1)}px)`); continue; } + const p = prog(t, r.at, 0.3); + set(r.el, 'opacity', String(clamp(p * 2.5))); + set(r.el, 'transform', `translateY(${(y - (1 - eoc(p)) * ROW_H * 0.7).toFixed(1)}px)`); + set(r.el, 'zIndex', String(10 + MAILS.findIndex(m => m.at === r.at))); + set(r.el.querySelector('.hi'), 'opacity', (0.95 * (1 - prog(t, r.at + 0.2, 1.0))).toFixed(3)); } - if (s.id === 'validate') { - const fixed = fixedCount(r); - BLOCKERS.forEach(([store, msg], i) => { - if (r < BLOCKERS_AT + i * BLOCKER_GAP) return; - const ok = i < fixed; - out.push(`
${String(i + 1).padStart(2)}. ${ok ? 'ok ' : 'BLOCKER'} [${store}] ${esc(msg)}
`); - }); - const winAt = FIX_AT + BLOCKERS.length * FIX_GAP + 0.05; - if (r >= winAt) out.push('
[validate] no blockers
'); - if (r >= winAt + 0.2) out.push('
(UI-only steps are not visible to the API: App Privacy, Play App content)
'); - } - const last = out.length ? out[out.length - 1] : ''; - const idle = !busy && s.id !== 'prompt' && (blink || r < 0.05); - const html = out.join('') + (idle && !last.includes('cur') ? `
${cursor}
` : ''); - // visible height: up to the panel when one is shown - const panel = PANEL_FOR[s.id]; - const body = linesEl.parentElement; - const top = term.offsetTop + body.offsetTop + linesEl.offsetTop; - const bottom = panel && r > 0.4 ? panelTop(panel) - 14 : term.offsetTop + term.offsetHeight - 22; - const lh = parseFloat(getComputedStyle(linesEl).lineHeight) || 40; - linesEl.style.height = `${Math.max(lh, Math.floor((bottom - top) / lh) * lh)}px`; - if (html !== lastLines) { linesEl.innerHTML = html; lastLines = html; } - linesEl.scrollTop = linesEl.scrollHeight; -} -function panelTop(sel) { - panelTopCache ??= {}; - if (panelTopCache[sel] === undefined) { - const el = $(sel); - panelTopCache[sel] = parseFloat(getComputedStyle(el).top); - } - return panelTopCache[sel]; + const n = MAILS.filter(m => t >= m.at).length; + html(unread, `${n} new`); + let shake = 0; + for (const m of MAILS) shake = Math.max(shake, decay(t, m.at + 0.1, 0.22)); + const slam = eoc(prog(t, B(3), 0.2)); + const z = 1 + 0.035 * t + 0.06 * slam; + set(hookCam, 'transform', `translate(${(Math.sin(t * 90) * 7 * shake).toFixed(1)}px, ${(Math.cos(t * 70) * 5 * shake).toFixed(1)}px) scale(${z.toFixed(4)})`); + set(hookCam, 'filter', slam > 0 ? `blur(${(slam * 7).toFixed(1)}px)` : 'none'); + set(hookDim, 'opacity', (0.74 * slam).toFixed(3)); } -// ---------- panels ---------- -const pricesEl = $('#prices'), langsEl = $('#langs'), questEl = $('#quest'); -langsEl.querySelector('.chips').innerHTML = LANGS.map(l => `${l}`).join(''); -const chips = [...langsEl.querySelectorAll('.chip')]; -const QUEST = [ - ['Play Data safety', 'the whole form, from the config', 'api'], - ['App Store age rating', 'categories, content rights too', 'api'], - ['Export compliance', 'your answer, set once in the config', 'api'], - ['Play content rating (IARC)', 'the skill walks your agent through it', 'ui'], - ['App Privacy labels + Publish', 'the skill walks your agent through it', 'ui'], - ['The answers themselves', 'your statements · the agent asks', 'you'], +// ---------- scan: the terminal ---------- +const term = $('#term'), scanCam = $('#s-scan .cam'); +const CW = V ? 840 : 1560; +term.innerHTML = [ + '', + ' ', + ...SCAN_HEAD.map((l, i) => `${esc(l.text)}`), + ' ', + `SDKs`, + ...SDKS.map((s, i) => ` ${esc(s.name)} · ${esc(s.what)}\n ${esc(s.where)} ${esc(s.dep)}`), + ' ', + `${esc(RISKS_LINE).replace(/(2 blocker, 3 high)/, '$1')}`, + ...FINDINGS.map((f, i) => `` + + `${i + 1}. ${f.sev}${esc(f.guideline)} · App Store` + + `${esc(f.title)}` + + `at ${esc(f.where)}` + + `fix: ${f.fix.match(/^[a-z]/) ? '… ' : ''}${esc(f.fix)} …`), +].join(''); +const tl = Object.fromEntries([...term.querySelectorAll('[data-k]')].map(e => [e.dataset.k, e])); +const timed = [...term.querySelectorAll('[data-at]')].map(e => ({ el: e, at: Number(e.dataset.at), fd: e.classList.contains('fd') })); +const box = el => ({ y: el.offsetTop, h: el.offsetHeight }); +/** Camera keys: [time, element key, zoom]. The camera eases to each key over 0.42 s, starting a little before. */ +const ZF = V ? 1.14 : 1.1; +const SCAN_CAM = [ + [scene('scan').start, 'prompt', V ? 1.9 : 1.7], + [ENTER_AT, 'head0', ZF + 0.04], + [SDK_AT, 'sdk0', ZF], + [RISKS_AT, 'risks', ZF], + ...FINDINGS.map((f, i) => [f.at, `f${i}`, ZF]), ]; -// Phosphor icons (icons/, copied unchanged by tools/site-icons.ts), shown as CSS masks in the pill colour -const ICON = { - api: '', - ui: '', - you: '', -}; -const BG = { api: 'var(--api-bg)', ui: 'var(--ui-bg)', you: 'var(--you-bg)' }; -questEl.querySelector('.rows').innerHTML = QUEST.map(([nm, ds, k]) => - `
${ICON[k]}
${esc(nm)}
${esc(ds)}
${k.toUpperCase()}
`).join(''); -const qrows = [...questEl.querySelectorAll('.row')]; -const tbody = pricesEl.querySelector('tbody'), psum = pricesEl.querySelector('.sum'); -let lastPrices = ''; - -function panelIn(el, r, at) { - const p = prog(r, at, 0.32); - el.style.opacity = String(clamp(p * 2)); - el.style.transform = `translateY(${(1 - eob(p)) * 90}px) scale(${0.96 + 0.04 * eoc(p)})`; -} -function panels(t) { - const s = sceneAt(t), r = t - s.start; - for (const el of [pricesEl, langsEl, questEl]) el.style.opacity = '0'; - if (s.id === 'prices') { - panelIn(pricesEl, r, 0.45); - const flick = r < 3.05; - const k = flick ? Math.max(0, Math.floor((r - 0.7) / 0.085)) : 0; - const rows = Array.from({ length: 5 }, (_, i) => PRICES[(k + i) % PRICES.length]); - const html = rows.map(([reg, cur, a, b], i) => - `${reg}${reg === 'TR' ? 'OVERRIDE' : ''}${cur}${a}${b}`).join(''); - if (html !== lastPrices) { tbody.innerHTML = html; lastPrices = html; } - psum.textContent = flick ? `${String(Math.min(173, Math.max(1, Math.floor((r - 0.7) * 72)))).padStart(3)} / 173 regions` : 'Play: 173 regions · App Store: equalized from the USA'; - } else if (s.id === 'languages') { - panelIn(langsEl, r, 0.45); - let n = 0; - chips.forEach((c, i) => { - const at = 0.8 + i * 0.13; - const on = r >= at; - if (on) n++; - c.classList.toggle('on', on); - const p = prog(r, at, 0.2); - c.style.transform = `scale(${on ? 1 + 0.25 * (1 - eoc(p)) : 1})`; - }); - langsEl.querySelector('.count').textContent = `${n}/14`; - } else if (s.id === 'questionnaires') { - panelIn(questEl, r, 0.3); - qrows.forEach((row, i) => { - const p = prog(r, 0.55 + i * 0.36, 0.28); - row.style.opacity = String(p); - row.style.transform = `translateX(${(1 - eob(p)) * 60}px)`; - const ico = row.querySelector('.ico'); - ico.style.transform = `scale(${p >= 1 ? 1 + 0.3 * (1 - eoc(prog(r, 0.55 + i * 0.36 + 0.28, 0.2))) : eob(p)})`; - }); +let camBoxes = null; +function scanCamAt(t) { + camBoxes ??= Object.fromEntries(SCAN_CAM.map(([, k]) => [k, box(tl[k])])); + const pos = k => { const b = camBoxes[k]; return b.y + b.h / 2; }; + let y = pos(SCAN_CAM[0][1]), z = SCAN_CAM[0][2], typing = 1; + for (let i = 1; i < SCAN_CAM.length; i++) { + const [at, k, zz] = SCAN_CAM[i]; + const p = eio(prog(t, at - 0.12, 0.42)); + y = lerp(y, pos(k), p); z = lerp(z, zz, p); + if (i === 1) typing = 1 - p; } + // while typing the command sits centred; afterwards the column is centred + const cmdW = (CMD.length + 2) * (V ? 31 : 30) * 0.6; + const sx = lerp(W / 2, (W - cmdW * z) / 2, typing), ax = lerp(CW / 2, 0, typing); + return { tx: sx - ax * z, ty: L.cy - y * z, z }; +} +function scan(t) { + const s = scene('scan'); + if (t < s.start - 0.1 || t > s.end + 0.2) return; + const n = clamp(Math.floor((t - TYPE_AT) * TYPE_CPS), 0, CMD.length); + const caret = t < ENTER_AT ? (n < CMD.length || Math.floor(t * 2.4) % 2 === 0) : false; + html(tl.prompt, `$ ${esc(CMD.slice(0, n))}${caret ? '' : ''}`); + set(tl.prompt, 'opacity', '1'); + let focus = -1; + FINDINGS.forEach((f, i) => { if (t >= f.at - 0.1) focus = i; }); + for (const l of timed) { + const p = prog(t, l.at, l.fd ? 0.28 : 0.2); + set(l.el, 'opacity', String(clamp(p * 2))); + set(l.el, 'transform', `translateX(${((1 - eoc(p)) * (l.fd ? 60 : 30)).toFixed(1)}px)`); + if (l.fd) { + const i = Number(l.el.dataset.k.slice(1)); + const g = l.el.querySelector('.glow'); + set(g, 'opacity', (i === focus ? 1 - 0.4 * prog(t, l.at + 0.3, 0.4) : 0.18 * p).toFixed(3)); + set(l.el, 'filter', i === focus || focus < 0 ? 'none' : 'brightness(.62)'); + } + } + const c = scanCamAt(t); + // a small push-in on every finding as it lands (about the focus line) + let punch = 0; + for (const f of FINDINGS) punch = Math.max(punch, Math.sin(Math.PI * prog(t, f.at - 0.05, 0.9)) * 0.035); + const k = 1 + punch; + set(scanCam, 'transform', `translate(${(c.tx * k - (W / 2) * (k - 1)).toFixed(1)}px, ${(c.ty * k - L.cy * (k - 1)).toFixed(1)}px) scale(${(c.z * k).toFixed(4)})`); } -// ---------- store art ---------- -const shotsEl = $('#shots'), sizesEl = $('#sizes'); -const FAN = ['en-01', 'en-02', 'en-03', 'en-04']; -const BIG = [['en-01', 'English'], ['tr-01', 'Türkçe'], ['ja-01', '日本語'], ['ar-01', 'العربية']]; -const SIZES = ['Play phone', '7" tablet', '10" tablet', 'iPhone 6.9"', 'iPhone 6.5"', 'iPad 13"', 'feature graphic']; -const L = V - ? { cx: 540, cy: 1040, w: 300, off: [-330, -110, 110, 330], rot: [-9, -3, 3, 9], dy: [36, 0, 0, 36], bw: 390, bcy: 1000, ly: 1318 } - : { cx: 1360, cy: 540, w: 290, off: [-330, -110, 110, 330], rot: [-9, -3, 3, 9], dy: [30, 0, 0, 30], bw: 330, bcy: 515, ly: 790 }; -const RATIO = 1920 / 1080; -shotsEl.innerHTML = FAN.map(f => `
`).join('') - + `
${BIG.map(([f]) => ``).join('')}
` - + '
'; -sizesEl.innerHTML = SIZES.map(s => `${esc(s)}`).join(''); -const fanEls = [...shotsEl.querySelectorAll('.card.fan')], bigEl = shotsEl.querySelector('.card.big'), bigImgs = [...bigEl.querySelectorAll('img')]; -const langEl = shotsEl.querySelector('.lang'), sizeEls = [...sizesEl.querySelectorAll('.sz')]; -for (const c of fanEls) { c.style.width = `${L.w}px`; c.style.height = `${L.w * RATIO}px`; } -bigEl.style.width = `${L.bw}px`; bigEl.style.height = `${L.bw * RATIO}px`; - -function place(el, cx, cy, w, h, rot, sc, op) { - el.style.transform = `translate(${cx - w / 2}px, ${cy - h / 2}px) rotate(${rot}deg) scale(${sc})`; - el.style.opacity = String(op); +// ---------- fixed: re-scan, reds flip green ---------- +const frows = $('#frows'), rescan = $('#rescan'), counter = $('#counter'), cN = $('#counter .n'), cLab = $('#counter .lab'); +const FR = V ? { x: 60, w: 960, top: 690, h: 112, gap: 18 } : { x: 150, w: 920, top: 330, h: 118, gap: 22 }; +frows.innerHTML = FINDINGS.map((f, i) => `
+ + + ${esc(f.short)}${esc(f.guideline)} · ${esc(f.where)} + ${f.sev}FIXED
`).join(''); +const frowEls = [...frows.querySelectorAll('.frow')]; +if (V) Object.assign(rescan.style, { left: '60px', top: '560px', width: '960px', fontSize: '29px' }); +else Object.assign(rescan.style, { left: '1150px', top: '340px', width: '660px', fontSize: '25px' }); +rescan.innerHTML = `${esc(RESCAN_LINE)}` + + (V ? '' : ` ${esc(RESCAN_NONE)}`); +if (V) Object.assign(counter.style, { left: '0', width: '100%', top: '1340px' }); +else Object.assign(counter.style, { left: '1150px', width: '660px', top: '560px' }); +cN.style.fontSize = V ? '120px' : '230px'; cLab.style.fontSize = V ? '40px' : '50px'; +if (V) { counter.style.display = 'flex'; counter.style.justifyContent = 'center'; counter.style.alignItems = 'baseline'; counter.style.gap = '24px'; } +function fixed(t) { + const s = scene('fixed'); + if (t < s.start - 0.3 || t > s.end + 0.5) return; + const n = clamp(Math.floor((t - RESCAN_TYPE_AT) * 24), 0, RESCAN_CMD.length); + const p = rescan.querySelector('[data-k="p"]'), r = rescan.querySelector('[data-k="r"]'), none = rescan.querySelector('[data-k="n"]'); + html(p, `$ ${esc(RESCAN_CMD.slice(0, n))}${n < RESCAN_CMD.length || t < FLIP_AT[0] - 0.2 ? '' : ''}`); + set(p, 'opacity', '1'); + const rp = prog(t, RESCAN_LINE_AT, 0.25); + set(r, 'opacity', String(rp)); set(r, 'transform', `translateX(${((1 - eoc(rp)) * 30).toFixed(1)}px)`); + if (none) { const np = prog(t, RESCAN_LINE_AT + 0.15, 0.25); set(none, 'opacity', String(np)); } + let left = FINDINGS.length; + frowEls.forEach((el, i) => { + const enter = prog(t, s.start + 0.05 + i * 0.06, 0.3); + const f = prog(t, FLIP_AT[i], 0.32); + if (t >= FLIP_AT[i]) left--; + const pop = decay(t, FLIP_AT[i], 0.3); + set(el, 'opacity', String(enter)); + set(el, 'transform', `translateY(${((1 - eoc(enter)) * 40).toFixed(1)}px) scale(${(1 + 0.035 * pop).toFixed(4)})`); + set(el, 'borderColor', f > 0.5 ? 'rgba(61,220,132,.55)' : 'rgba(255,90,95,.4)'); + set(el.querySelector('.t-good'), 'opacity', String(eoc(f))); + set(el.querySelector('.t-bad'), 'opacity', String(1 - eoc(f))); + set(el.querySelector('.bad'), 'transform', `scale(${(1 - eic(f)).toFixed(3)}) rotate(${(-90 * f).toFixed(1)}deg)`); + set(el.querySelector('.good'), 'transform', `scale(${eob(f).toFixed(3)})`); + set(el.querySelector('.good'), 'opacity', String(clamp(f * 3))); + const c2 = el.querySelector('.c2'); + set(c2, 'clipPath', `inset(0 ${((1 - eoc(f)) * 100).toFixed(1)}% 0 0)`); + }); + const zero = left === 0; + html(cN, String(left)); + html(cLab, zero ? 'blockers' : 'rejection risks'); + set(cN, 'color', zero ? 'var(--green)' : 'var(--red)'); + let pop = 0; + FLIP_AT.forEach((a, i) => { pop = Math.max(pop, decay(t, a, 0.25) * (i === 4 ? 1.6 : 1)); }); + const ce = prog(t, s.start + 0.25, 0.35); + set(counter, 'opacity', String(ce)); + set(cN, 'transform', `scale(${(1 + 0.22 * pop).toFixed(3)})`); + set(cN, 'display', 'inline-block'); + set(cN, 'textShadow', zero ? `0 0 ${(40 + 60 * pop).toFixed(0)}px rgba(61,220,132,.6)` : '0 0 40px rgba(255,90,95,.4)'); } + +// ---------- shots: the screenshot wall ---------- +const wall = $('#wall'), shotNum = $('#shotcount .num'), shotCount = $('#shotcount'), shotCmd = $('#shotcmd'); +const GRID = await fetch('out/assets/grid.json').then(r => { if (!r.ok) throw new Error('out/assets/grid.json missing (bun media/teaser/render.ts prepares it)'); return r.json(); }); +const WALL = V ? { cols: 7, rows: 7, tw: 210, th: 373, gap: 22 } : { cols: 11, rows: 4, tw: 200, th: 356, gap: 22 }; +const tiles = []; +{ + const ww = WALL.cols * (WALL.tw + WALL.gap), wh = WALL.rows * (WALL.th + WALL.gap); + let k = 0; + for (let r = 0; r < WALL.rows; r++) for (let c = 0; c < WALL.cols; c++) { + const el = document.createElement('div'); + el.className = 'tile'; + const x = c * (WALL.tw + WALL.gap) - ww / 2 + (r % 2 ? WALL.tw * 0.25 : 0), y = r * (WALL.th + WALL.gap) - wh / 2; + Object.assign(el.style, { left: `${x}px`, top: `${y}px`, width: `${WALL.tw}px`, height: `${WALL.th}px`, backgroundImage: `url(out/assets/grid/${GRID[(k * 7) % GRID.length]})` }); + wall.appendChild(el); + const d = Math.hypot(x + WALL.tw / 2, (y + WALL.th / 2) * 0.8); + tiles.push({ el, d: d + ((k * 37) % 11) * 18 }); + k++; + } + const order = [...tiles].sort((a, b) => a.d - b.d); + order.forEach((tl2, i) => { tl2.at = 0.12 + (i / order.length) * 1.45; }); +} +if (V) { Object.assign(shotCmd.style, { left: '50%', top: '500px' }); Object.assign(shotCount.style, { left: '50%', top: '1300px', fontSize: '58px' }); } +else { Object.assign(shotCmd.style, { left: '50%', top: '290px' }); Object.assign(shotCount.style, { left: '50%', top: '880px', fontSize: '56px' }); } function shots(t) { - const s = sceneAt(t), r = t - s.start; - const on = s.id === 'shots'; - shotsEl.style.display = on ? '' : 'none'; - sizesEl.style.display = on ? '' : 'none'; - if (!on) return; - const h = L.w * RATIO; - const spread = eoc(prog(r, 1.95, 0.35)); - fanEls.forEach((el, i) => { - const p = prog(r, 0.3 + i * 0.2, 0.5); - const e = eob(p); - const dir = i < 2 ? -1 : 1; - const x0 = L.cx + dir * (V ? 700 : 900), y0 = L.cy + (V ? 1100 : 800); - const fx = L.cx + L.off[i] + dir * 70 * spread, fy = L.cy + L.dy[i] + Math.sin(t * 2 + i) * 6; - place(el, lerp(x0, fx, e), lerp(y0, fy, e), L.w, h, lerp(dir * 40, L.rot[i] + dir * 4 * spread, e), 1 - 0.12 * spread, clamp(p * 3) * (1 - 0.45 * spread)); - }); - // big card cycling the hero screenshot through four languages - const bp = prog(r, 1.95, 0.42); - const bh = L.bw * RATIO; - const idx = r < 2.5 ? 0 : r < 2.95 ? 1 : r < 3.4 ? 2 : 3; - const sw = [2.5, 2.95, 3.4].map(a => 1 - Math.min(1, Math.abs(r - a) / 0.09)).reduce((a, b) => Math.max(a, b), 0); - place(bigEl, L.cx, L.bcy + (1 - eob(bp)) * 500 + Math.sin(t * 1.6) * 5, L.bw, bh, (1 - eoc(bp)) * 12, (0.7 + 0.3 * eob(bp)), clamp(bp * 3)); - bigEl.style.transform += ` scaleX(${1 - 0.18 * sw})`; - bigImgs.forEach((im, i) => { im.style.opacity = i === idx ? '1' : '0'; }); - langEl.textContent = BIG[idx][1]; - const lp = prog(r, 2.2, 0.25); - langEl.style.opacity = String(lp); - langEl.style.left = `${L.cx}px`; langEl.style.top = `${L.ly}px`; - langEl.style.transform = `translateX(-50%) scale(${(1 + 0.2 * sw) * (0.6 + 0.4 * eob(lp))})`; - // sizes - sizeEls.forEach((el, i) => { - const at = 3.75 + i * 0.16; - const p = prog(r, at, 0.22); - el.style.opacity = String(clamp(p * 3)); - el.style.transform = `translateY(${(1 - eob(p)) * 30}px) scale(${1 + 0.2 * (1 - eoc(p))})`; - el.classList.toggle('on', r >= at); - }); + const s = scene('shots'); + if (t < s.start - 0.1 || t > s.end + 0.6) return; + const r = t - s.start; + let shown = 0; + for (const tile of tiles) { + const p = prog(r, tile.at, 0.26); + if (p > 0) shown++; + set(tile.el, 'opacity', String(clamp(p * 2))); + set(tile.el, 'transform', `translateZ(${((1 - eoc(p)) * 260).toFixed(1)}px) scale(${lerp(0.72, 1, eob(p)).toFixed(3)})`); + } + const z = lerp(1.12, 0.98, eio(prog(r, 0, s.end - s.start + 0.4))); + set(wall, 'transform', `translate(-50%, -50%) translateY(${(-60 * r).toFixed(1)}px) perspective(2200px) rotateX(20deg) rotateZ(-11deg) scale(${z.toFixed(4)})`); + const frac = shown / tiles.length; + html(shotNum, String(Math.round(SHOTS_TOTAL * eoc(clamp(r / 1.65)) * (frac > 0 ? 1 : 0)))); + const cp = prog(r, 0.1, 0.35), np = prog(r, 0.35, 0.35); + set(shotCmd, 'opacity', String(cp)); set(shotCmd, 'transform', `translate(-50%, ${((1 - eoc(cp)) * 20).toFixed(1)}px)`); + const pop = decay(r, 1.65, 0.3); + set(shotCount, 'opacity', String(np)); set(shotCount, 'transform', `translate(-50%, ${((1 - eoc(np)) * 30).toFixed(1)}px) scale(${(1 + 0.12 * pop).toFixed(3)})`); } -// ---------- desktop app ---------- -// Real frames of apps/desktop in fixture mode (out/desktop/*.jpg, 1280 x 800 at 2x, desktop.ts) in a CSS window, with -// a camera that zooms toward the step's point, the Phosphor cursor, and the confirm dialog drawn on top. +// ---------- declarations ---------- +const prop = $('#prop'), form = $('#form'), declNum = $('#declcount .num'), declCount = $('#declcount'); +const PROP_LINES = [...DECL_LINES.map(d => ({ k: 'detected', w: d.what, v: d.value, loc: d.where })), { k: 'ask owner', w: DECL_ASK.replace('ask owner ', ''), v: '?', loc: '', ask: true }]; +prop.querySelector('.body').innerHTML = PROP_LINES.map(l => `${esc(l.k)} ${esc(l.w)}${l.loc ? ` ${esc(l.loc)}` : ` ${esc(l.v)}`}`).join(''); +const ROW = V ? 54 : 62; +form.querySelector('.body').innerHTML = DATA_SAFETY_ROWS.map(r => `
${esc(r)}detected
`).join(''); +if (V) { + Object.assign(prop.style, { left: '60px', width: '960px', top: '540px' }); + Object.assign(form.style, { left: '60px', width: '960px', top: '890px' }); + Object.assign(declCount.style, { left: '50%', top: '1372px', fontSize: '50px' }); +} else { + Object.assign(prop.style, { left: '130px', width: '860px', top: '320px' }); + Object.assign(form.style, { left: '1040px', width: '750px', top: '300px' }); + Object.assign(declCount.style, { left: '560px', top: '820px', fontSize: '56px' }); +} +const propLns = [...prop.querySelectorAll('.ln')], formRows = [...form.querySelectorAll('.row')]; +function decl(t) { + const s = scene('decl'); + if (t < s.start - 0.4 || t > s.end + 0.5) return; + const r = t - s.start; + const ce = eoc(prog(r, 0, 0.4)); + set(prop, 'transform', `translateY(${((1 - ce) * 40).toFixed(1)}px)`); set(prop, 'opacity', String(ce)); + const fe = eoc(prog(r, 0.35, 0.4)); + set(form, 'transform', `translateY(${((1 - fe) * 40).toFixed(1)}px)`); set(form, 'opacity', String(fe)); + propLns.forEach((el, i) => { const p = prog(r, 0.2 + i * 0.16, 0.22); set(el, 'opacity', String(p)); set(el, 'transform', `translateX(${((1 - eoc(p)) * 30).toFixed(1)}px)`); }); + formRows.forEach((el, i) => { + const p = prog(r, 0.95 + i * 0.16, 0.24); + set(el.querySelector('.fill'), 'opacity', String(eoc(p))); + set(el.querySelector('.pi'), 'transform', `scale(${eob(p).toFixed(3)})`); + set(el.querySelector('.box'), 'borderColor', p > 0 ? 'var(--green)' : 'var(--line-2)'); + set(el.querySelector('.tag'), 'opacity', String(p)); + set(el, 'color', p > 0.5 ? '#fff' : 'var(--ink-2)'); + }); + const np = prog(r, 0.95, 1.3); + html(declNum, String(Math.round(DECL_TOTAL * eoc(np)))); + const dp = prog(r, 0.8, 0.3), pop = decay(r, 2.25, 0.3); + set(declCount, 'opacity', String(dp)); + set(declCount, 'transform', `translate(${V ? '-50%' : '0'}, ${((1 - eoc(dp)) * 30).toFixed(1)}px) scale(${(1 + 0.12 * pop).toFixed(3)})`); +} + +// ---------- desktop: real frames in a window, slow camera, one callout ---------- 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 FW = 1280, FH = 800; -const DW = V ? { x: 40, y: 640, w: 1000 } : { x: 880, y: 226, w: 940 }; -const TB = 40, VW = DW.w, VH = DW.w * FH / FW; -const deskEl = $('#desk'), win = $('#desk .win'), viewEl = $('#desk .view'), cam = $('#desk .cam'), shade = $('#desk .shade'), - dlg = $('#desk .dlg'), stepEl = $('#desk .step'), linkEl = $('#desk .link'), dcur = $('#dcur'); -win.style.left = `${DW.x}px`; win.style.top = `${DW.y}px`; win.style.width = `${VW}px`; -viewEl.style.width = `${VW}px`; viewEl.style.height = `${VH}px`; -const FRAMES = ['portfolio', 'releases', 'growth', 'growth-hover', 'palette', 'prices-diff']; -cam.innerHTML = FRAMES.map(f => ``).join(''); -const frameEls = Object.fromEntries([...cam.querySelectorAll('img')].map(im => [im.dataset.f, im])); -// the dialog's dry run restates the diff rows of the prices-diff frame (fixture data) -dlg.querySelector('pre').textContent = [ - 'Dry run (storebound prices import --dry):', - 'coins_small Google Play TR TRY 21.99 -> 24.99', - 'coins_small Google Play BR R$3.99 -> R$4.49', - 'coins_small App Store TR TRY 29.99 -> 24.99', - 'no_ads App Store BR R$14.90 -> R$12.90', -].join('\n'); -if (V) { stepEl.style.left = '0'; stepEl.style.right = '0'; stepEl.style.textAlign = 'center'; stepEl.style.top = `${DW.y + TB + VH + 56}px`; } -else { stepEl.style.left = '120px'; stepEl.style.top = '790px'; } -const focusOf = f => (typeof f === 'string' ? (b => [b.x + b.w / 2, b.y + b.h / 2])(BOXES[f]) : f); -/** Camera for a step: scale and offset of the frame inside the view, the focus kept on screen, no empty edge. */ -function camFor(st, p) { - const z = lerp(1, st.zoom, p), S = (VW / FW) * z; - const [fx, fy] = focusOf(st.focus); - const ox = clamp(VW / 2 - fx * FW * S, VW - FW * S, 0), oy = clamp(VH / 2 - fy * FH * S, VH - FH * S, 0); +const WIN = V ? { x: 40, y: 520, w: 1000, h: 950 } : { x: 210, y: 285, w: 1500, h: 760 }; +const VIEW = { w: WIN.w, h: WIN.h - 44 }; +const S0 = Math.max(VIEW.w / 1280, VIEW.h / 800); +const desk = {}; +for (const [id, d] of Object.entries(DESKTOP)) { + const el = $(`#s-${id}`); + const img = f => ``; + el.innerHTML = `
+
storebound
+
+ ${img(d.empty ?? d.frame)} + ${d.empty ? `
${img(d.frame)}
${img(d.frame)}
` : ''} + ${d.clean ? `
${img(d.clean)}
` : ''} +
+
${esc(d.callout.text)}
`; + desk[id] = { el, d, win: el.querySelector('.win'), cam: el.querySelector('.cam'), c1: el.querySelector('.c1'), c2: el.querySelector('.c2'), + cl: el.querySelector('.cl'), line: el.querySelector('.scanline'), ring: el.querySelector('.ring'), callout: el.querySelector('.callout') }; +} +const pct = v => `${(v * 100).toFixed(3)}%`; +/** Camera of a desktop scene at r seconds: image scale and offset inside the window view. */ +function deskCam(d, r, len) { + const p = eio(clamp(r / len)); + // the vertical window shows a portrait crop of the landscape app: a gentler push, and the Checks card kept whole-ish + const zk = V ? 0.45 : 1, fxv = V && d.clean ? 0.6 : null; + const z = 1 + (lerp(d.from.z, d.to.z, p) - 1) * zk, fx = fxv ?? lerp(d.from.f[0], d.to.f[0], p), fy = lerp(d.from.f[1], d.to.f[1], p); + const S = S0 * z; + 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 }; } -let deskCam = { S: VW / FW, ox: 0, oy: 0 }; -/** A point of the frame (fractions) in stage pixels, through the current camera. */ -const framePt = (fx, fy) => [DW.x + deskCam.ox + fx * FW * deskCam.S, DW.y + TB + deskCam.oy + fy * FH * deskCam.S]; -function deskTarget(name) { - if (name === 'off') return [DW.x + VW + 120, DW.y + TB + VH + 160]; - if (name === 'dialog-ok') { const b = dlg.querySelector('.ok').getBoundingClientRect(); return [b.left + b.width * 0.9, b.top + b.height * 0.7]; } - const b = BOXES[name]; - return framePt(b.x + b.w * (b.w ? 0.9 : 1), b.y + b.h * (b.h ? 0.75 : 1)); +/** A boxes.json entry in stage pixels for the current camera (plus the window's own transform, applied by the caller). */ +const stageBox = (b, c) => ({ x: WIN.x + c.ox + b.x * 1280 * c.S, y: WIN.y + 44 + c.oy + b.y * 800 * c.S, w: b.w * 1280 * c.S, h: b.h * 800 * c.S }); +const cursorEl = $('#cursor'), clickEl = $('#click'); +let cursorShown = false; +function cursorAt(x, y, op, press = 0) { + cursorShown = op > 0; + set(cursorEl, 'opacity', String(op)); + set(cursorEl, 'transform', `translate(${(x - 10).toFixed(1)}px, ${(y - 10).toFixed(1)}px) scale(${(1 - 0.14 * press).toFixed(3)})`); } function desktop(t) { - const s = sceneAt(t), r = t - s.start; - if (s.id !== 'desktop') { deskEl.style.opacity = '0'; deskEl.style.display = 'none'; return; } - deskEl.style.display = ''; deskEl.style.opacity = '1'; - // window in, a punch on every step - const ip = prog(r, 0.0, 0.45); - const si = DESKTOP.findLastIndex(x => r >= x.at), st = DESKTOP[Math.max(0, si)]; - const punch = si > 0 && !st.dialog ? 1 - eoc(prog(r, st.at, 0.25)) : 0; - win.style.opacity = String(clamp(ip * 2.5)); - win.style.transform = `translateY(${(1 - eob(ip)) * 120}px) scale(${(0.9 + 0.1 * eoc(ip)) * (1 + 0.02 * punch)})`; - // frames: a quick crossfade on each cut; the chart tooltip fades in when the cursor gets there - const prev = DESKTOP[si - 1]; - const fade = prev && prev.frame !== st.frame ? prog(r, st.at, 0.16) : 1; - const frameName = x => (x.frame === 'growth' && r >= DESK_HOVER_AT ? 'growth-hover' : x.frame); - for (const [f, im] of Object.entries(frameEls)) { - im.style.opacity = f === frameName(st) ? '1' : prev && f === frameName(prev) && fade < 1 ? '1' : '0'; - im.style.zIndex = f === frameName(st) ? '2' : '1'; + for (const [id, k] of Object.entries(desk)) { + const s = scene(id), d = k.d, r = t - s.start, len = s.end - s.start; + if (t < s.start - 0.2 || t > s.end + 0.5) continue; + const c = deskCam(d, r, len + 0.3); + set(k.cam, 'transform', `translate(${c.ox.toFixed(2)}px, ${c.oy.toFixed(2)}px) scale(${(c.S).toFixed(5)})`); + if (k.c1) { + const p = eio(prog(r, d.fill[0], d.fill[1] - d.fill[0])); + for (const [el, b] of [[k.c1, BOXES.roll], [k.c2, BOXES.roll2]]) { + set(el, 'clipPath', `inset(${pct(b.y)} ${pct(1 - b.x - b.w * p)} ${pct(1 - b.y - b.h)} ${pct(b.x)})`); + } + } + if (k.cl) { + const p = eio(prog(r, d.flip, 0.5)); + set(k.cl, 'clipPath', `inset(0 0 ${pct(1 - p)} 0)`); + set(k.line, 'opacity', String(p > 0 && p < 1 ? 1 : 0)); + set(k.line, 'top', `${(p * 800 - 3).toFixed(1)}px`); + } + // the window itself: a gentle settle + const we = eoc(prog(r, 0, 0.6)); + set(k.win, 'transform', `scale(${lerp(0.97, 1, we).toFixed(4)})`); + // callout + ring on the target + const b = BOXES[d.callout.target]; + const sb = stageBox(b, c); + const cp = prog(r, d.callout.at, 0.34); + const ring = k.ring; + set(ring, 'opacity', String(clamp(cp * 2))); + // the ring stays inside the window + const rx0 = Math.max(sb.x - 10, WIN.x + 8), ry0 = Math.max(sb.y - 10, WIN.y + 52); + const rx1 = Math.min(sb.x + sb.w + 10, WIN.x + WIN.w - 8), ry1 = Math.min(sb.y + sb.h + 10, WIN.y + WIN.h - 8); + set(ring, 'left', `${rx0.toFixed(1)}px`); set(ring, 'top', `${ry0.toFixed(1)}px`); + set(ring, 'width', `${(rx1 - rx0).toFixed(1)}px`); set(ring, 'height', `${(ry1 - ry0).toFixed(1)}px`); + set(ring, 'transform', `scale(${lerp(1.15, 1, eoc(cp)).toFixed(3)})`); + let text = d.callout.text; + if (d.fill) text = `Rollout · ${Math.round(20 * eio(prog(r, d.fill[0], d.fill[1] - d.fill[0])))}%`; + html(k.callout, esc(text)); + const cw = k.callout.offsetWidth; + const cx = clamp(sb.x + sb.w / 2, W * 0.1 + cw / 2, W * 0.9 - cw / 2); + const above = sb.y - 30 > WIN.y + 90; + const cy = above ? sb.y - 26 : sb.y + sb.h + 26 + 70; + set(k.callout, 'opacity', String(clamp(cp * 2.5))); + set(k.callout, 'left', `${cx.toFixed(1)}px`); set(k.callout, 'top', `${cy.toFixed(1)}px`); + set(k.callout, 'transform', `translate(-50%, -100%) scale(${lerp(0.5, 1, eob(cp)).toFixed(3)})`); } - if (frameEls[frameName(st)]) frameEls[frameName(st)].style.opacity = String(fade); - const growthTip = st.frame === 'growth' ? prog(r, DESK_HOVER_AT, 0.15) : 0; - if (st.frame === 'growth' && r >= DESK_HOVER_AT) { frameEls.growth.style.opacity = '1'; frameEls['growth-hover'].style.opacity = String(growthTip); } - // camera: ease into the step's zoom (a fresh frame starts from the whole window) - const keep = prev && prev.frame === st.frame; - const from = keep ? camFor(prev, 1) : camFor(st, 0), to = camFor(st, 1); - const cp = eoc(prog(r, st.at + 0.1, 0.9)); - deskCam = { S: lerp(from.S, to.S, cp), ox: lerp(from.ox, to.ox, cp), oy: lerp(from.oy, to.oy, cp) }; - cam.style.transform = `translate(${deskCam.ox}px, ${deskCam.oy}px) scale(${deskCam.S})`; - // the confirm dialog - const dIn = prog(r, DESK_DIALOG[0], 0.3), dOut = prog(r, DESK_DIALOG[1] + 0.12, 0.2); - const dv = clamp(dIn * 3) * (1 - dOut); - shade.style.opacity = String(dv); - dlg.style.opacity = String(dv); - dlg.style.transform = `translate(-50%, -50%) scale(${(V ? 1.25 : 1.05) * (0.85 + 0.15 * eob(dIn)) * (1 - 0.06 * dOut)})`; - // step label - const sp = prog(r, st.at + 0.05, 0.3); - stepEl.innerHTML = `${String(si + 1).padStart(2, '0')}${esc(st.step)}`; - stepEl.style.opacity = String(clamp(sp * 2) * (1 - prog(t, s.end - 0.16, 0.16))); - stepEl.style.transform = `translateY(${(1 - eoc(sp)) * 24}px)`; - // cursor - const k = DESK_CURSOR.findLastIndex(([a]) => r >= a); - if (k < 0) dcur.style.opacity = '0'; - else { - const [a0, n0] = DESK_CURSOR[k], nx = DESK_CURSOR[k + 1]; - const p0 = deskTarget(n0); - let [x, y] = p0; - if (nx) { const p1 = deskTarget(nx[1]); const mp = eoc(clamp((r - a0) / (nx[0] - a0))); x = lerp(p0[0], p1[0], mp); y = lerp(p0[1], p1[1], mp); } - const click = DESK_CURSOR.filter(c => c[2]).reduce((m, c) => Math.max(m, 1 - Math.min(1, Math.abs(r - c[0]) / 0.12)), 0); - dcur.style.opacity = String(clamp((r - DESK_CURSOR[0][0]) * 5)); - dcur.style.transform = `translate(${x - 10}px, ${y - 10}px) scale(${1 - 0.18 * click})`; +} +/** The cursor: in the desktop scenes and over the Submit button. */ +function cursor(t) { + const s = active(t); + set(clickEl, 'opacity', '0'); + if (desk[s.id]) { + const k = desk[s.id], d = k.d, r = t - s.start; + const c = deskCam(d, r, s.end - s.start + 0.3); + const [[a0], [a1, target]] = d.cursor; + const b = stageBox(BOXES[target], c); + const tx = b.x + b.w * (target === 'roll' ? 0.35 : 0.5), ty = b.y + b.h * 0.6; + const sx = W * 0.92, sy = WIN.y + WIN.h * 0.95; + const p = eio(prog(r, a0, a1 - a0)); + const arc = Math.sin(Math.PI * p) * 70; + const x = lerp(sx, tx, p) + arc * 0.4, y = lerp(sy, ty, p) - arc; + const op = prog(r, a0 - 0.15, 0.15) * (1 - prog(t, s.end - 0.12, 0.12)); + let press = 0; + if (id3(s.id)) { + press = decay(r, a1 + 0.02, 0.22); + const cp = prog(r, a1 + 0.02, 0.4); + if (cp > 0 && cp < 1) { + set(clickEl, 'opacity', String(0.9 * (1 - cp))); + set(clickEl, 'transform', `translate(${tx.toFixed(1)}px, ${ty.toFixed(1)}px) scale(${lerp(0.3, 1.4, eoc(cp)).toFixed(3)})`); + } + } + cursorAt(x, y, op, press); + return; } - // "Submit for review · your click" by the console button - const lp = prog(r, DESK_LINK_AT, 0.35); - const cb = BOXES.console, [bx, by] = framePt(cb.x + cb.w, cb.y + cb.h); - linkEl.style.opacity = String(clamp(lp * 3)); - linkEl.style.left = `${Math.min(bx, DW.x + VW - 12)}px`; linkEl.style.top = `${by + 26}px`; - linkEl.style.transform = `translateX(-100%) scale(${0.6 + 0.4 * eob(lp)})`; -} - -// ---------- end cards ---------- -const submitEl = $('#submit'), btn = $('#submit .btn'), ring = $('#submit .ring'), kick = $('#submit .kick'), - yours = $('#submit .yours'), fine = $('#submit .fine'), cur = $('#cursor'); -const brandEl = $('#brand'); -const brandParts = [...brandEl.children]; -function pop(el, r, at, dist = 50, d = 0.35) { - const p = prog(r, at, d); - el.style.opacity = String(clamp(p * 2.5)); - el.style.transform = `translateY(${(1 - eob(p)) * dist}px) scale(${0.85 + 0.15 * eob(p)})`; -} -function endCards(t) { - const s = sceneAt(t), r = t - s.start; - submitEl.style.opacity = s.id === 'submit' ? '1' : '0'; - brandEl.style.opacity = s.id === 'brand' ? '1' : '0'; - cur.style.opacity = '0'; if (s.id === 'submit') { - pop(kick, r, 0.0, 30); - const bp = prog(r, 0.08, 0.42); - btn.style.opacity = String(clamp(bp * 3)); - const hover = eoc(prog(r, 1.25, 0.2)); - btn.style.transform = `scale(${(0.4 + 0.6 * eob(bp)) * (1 + 0.04 * hover)})`; - btn.style.filter = `brightness(${1 + 0.18 * hover})`; - const rp = ((r - 0.5) % BEAT) / BEAT; - ring.style.opacity = r > 0.5 ? String(0.7 * (1 - rp)) : '0'; - ring.style.transform = `scale(${1 + 0.12 * eoc(rp)})`; - pop(yours, r, 0.95, 70, 0.4); - pop(fine, r, 1.55, 30); - // the cursor comes close and waits: the click stays yours - const b = btn.getBoundingClientRect(); - const tx = b.left + b.width * 0.78, ty = b.top + b.height * 0.72; - const cp = eoc(prog(r, 0.55, 0.8)); - const wob = Math.sin(r * 5) * 4 * prog(r, 1.35, 0.3); - cur.style.opacity = String(clamp((r - 0.55) * 4)); - cur.style.transform = `translate(${lerp(tx + 380, tx, cp) + wob}px, ${lerp(ty + 420, ty, cp) + wob * 0.6}px)`; - } else if (s.id === 'brand') { - const [mark, word, tag, url, meta, desk, inst] = brandParts; - const mp = prog(r, 0.0, 0.45); - mark.style.opacity = String(clamp(mp * 3)); - mark.style.transform = `scale(${eob(mp)}) rotate(${(1 - eoc(mp)) * -25}deg)`; - pop(word, r, 0.15, 60); - pop(tag, r, 0.5, 40); - pop(url, r, 0.85, 40); - pop(meta, r, 1.05, 30); - pop(desk, r, 1.2, 30); - pop(inst, r, 1.4, 30); - const beat = 1 - prog(((r + 1e-6) % BEAT), 0, BEAT * 0.5); - url.style.textShadow = `0 0 ${20 + 30 * beat * (r > 0.85 ? 1 : 0)}px rgba(129,140,248,${0.35 + 0.35 * beat})`; + const btn = $('#sbtn').getBoundingClientRect(); + const tx = btn.left + btn.width * 0.62, ty = btn.top + btn.height * 0.62; + const a0 = s.start + 0.35; + const p = eio(prog(t, a0, SUBMIT_HOVER - a0)); + const arc = Math.sin(Math.PI * p) * 80; + // it stops on the button and waits: no click + const hes = Math.sin(Math.max(0, t - SUBMIT_HOVER) * 3.2) * 6 * prog(t, SUBMIT_HOVER, 0.4); + cursorAt(lerp(W * 0.9, tx, p) + arc * 0.3 + hes, lerp(H * 0.95, ty, p) - arc, prog(t, a0, 0.15) * (1 - prog(t, s.end - 0.15, 0.15))); + return; + } + if (cursorShown) cursorAt(0, 0, 0); +} +const id3 = id => id === 'desk3'; + +// ---------- submit + brand ---------- +const sbtn = $('#sbtn'), shov = $('#sbtn .hov'); +if (V) sbtn.style.top = '980px'; else sbtn.style.top = '560px'; +const brandWrap = $('#s-brand .wrap'); +brandWrap.querySelector('.url').textContent = URL; +brandWrap.querySelector('.plat').textContent = PLATFORMS; +if (!V) { brandWrap.querySelector('.mark').style.width = brandWrap.querySelector('.mark').style.height = '200px'; brandWrap.querySelector('.word').style.fontSize = '130px'; } +function endCards(t) { + const s = scene('submit'); + if (t >= s.start - 0.1 && t < s.end + 0.5) { + const r = t - s.start, e = eob(prog(r, 0.05, 0.45)); + const hov = prog(t, SUBMIT_HOVER, 0.15); + set(sbtn, 'transform', `translate(-50%, 0) scale(${(lerp(0.7, 1, e) * (1 + 0.03 * hov)).toFixed(4)})`); + set(sbtn, 'opacity', String(clamp(prog(r, 0.05, 0.2)))); + set(shov, 'opacity', String(hov)); + } + const b = scene('brand'); + if (t >= b.start - 0.1) { + const r = t - b.start; + set(brandWrap, 'transform', `translateY(-50%) scale(${lerp(1.0, 1.04, clamp(r / 4)).toFixed(4)})`); + [...brandWrap.children].forEach((el, i) => { + const p = prog(r, 0.08 + i * 0.16, i === 0 ? 0.5 : 0.36); + set(el, 'opacity', String(clamp(p * 2))); + set(el, 'transform', i === 0 ? `scale(${lerp(0.4, 1, eob(p)).toFixed(3)}) rotate(${((1 - eoc(p)) * -12).toFixed(2)}deg)` : `translateY(${((1 - eoc(p)) * 40).toFixed(1)}px)`); + set(el, 'filter', p < 1 ? `blur(${((1 - eoc(p)) * 12).toFixed(1)}px)` : 'none'); + }); } } -// ---------- seek ---------- function seek(t) { - t = clamp(t, 0, DURATION - 1e-6); + scenes(t); background(t); - captions(t); - terminal(t); - panels(t); + hook(t); + scan(t); + fixed(t); shots(t); + decl(t); desktop(t); endCards(t); + cursor(t); + captions(t); } const ready = (async () => { await document.fonts.ready; - await Promise.all([...document.images].map(im => im.decode().catch(() => { throw new Error(`image failed: ${im.src}`); }))); + const imgs = [...document.images, ...GRID.map(f => Object.assign(new Image(), { src: `out/assets/grid/${f}` }))]; + await Promise.all(imgs.map(im => im.decode().catch(() => { throw new Error(`image failed: ${im.src}`); }))); seek(0); })(); -window.teaser = { ready, seek, DURATION, FPS, BAR, W, H }; +window.teaser = { ready, seek, DURATION, FPS, W, H, BEAT, captionTimes }; if (q.has('t')) ready.then(() => seek(Number(q.get('t')))); if (q.has('play')) ready.then(() => { diff --git a/tests/fixtures/scan/teaser-fixed/Planner.xcodeproj/project.pbxproj b/tests/fixtures/scan/teaser-fixed/Planner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..5343a49f --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Planner.xcodeproj/project.pbxproj @@ -0,0 +1,13 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + objects = { + C1B2C3D4E5F6000000000002 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = Planner/Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.example.planner; + }; + }; + }; +} diff --git a/tests/fixtures/scan/teaser-fixed/Planner/Ads.swift b/tests/fixtures/scan/teaser-fixed/Planner/Ads.swift new file mode 100644 index 00000000..1fedbf7a --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Planner/Ads.swift @@ -0,0 +1,11 @@ +import AdSupport +import AppTrackingTransparency +import GoogleMobileAds + +enum Ads { + static func start() { + ATTrackingManager.requestTrackingAuthorization { _ in + GADMobileAds.sharedInstance().start(completionHandler: nil) + } + } +} diff --git a/tests/fixtures/scan/teaser-fixed/Planner/Info.plist b/tests/fixtures/scan/teaser-fixed/Planner/Info.plist new file mode 100644 index 00000000..5ef109e7 --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Planner/Info.plist @@ -0,0 +1,12 @@ + + + + + CFBundleDisplayName + Planner + NSUserTrackingUsageDescription + Your data is used to show ads that fit your interests. + ITSAppUsesNonExemptEncryption + + + diff --git a/tests/fixtures/scan/teaser-fixed/Planner/LoginView.swift b/tests/fixtures/scan/teaser-fixed/Planner/LoginView.swift new file mode 100644 index 00000000..a5bb6d8b --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Planner/LoginView.swift @@ -0,0 +1,25 @@ +import AuthenticationServices +import FirebaseAuth +import GoogleSignIn +import SwiftUI + +struct LoginView: View { + var body: some View { + VStack { + SignInWithAppleButton(.signIn) { _ in } onCompletion: { _ in } + Button("Continue with Google") { + GIDSignIn.sharedInstance.signIn(withPresenting: rootViewController()) { _, _ in } + } + Button("Create account") { Task { try await AccountApi.signUp() } } + } + } +} + +enum AccountApi { + static func signUp() async throws { + _ = try await Auth.auth().createUser(withEmail: "planner@example.com", password: "example") + } + static func deleteAccount() async throws { + try await Auth.auth().currentUser?.delete() + } +} diff --git a/tests/fixtures/scan/teaser-fixed/Planner/PrivacyInfo.xcprivacy b/tests/fixtures/scan/teaser-fixed/Planner/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..0e3bf796 --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Planner/PrivacyInfo.xcprivacy @@ -0,0 +1,19 @@ + + + + + NSPrivacyTracking + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + + diff --git a/tests/fixtures/scan/teaser-fixed/Planner/ProStore.swift b/tests/fixtures/scan/teaser-fixed/Planner/ProStore.swift new file mode 100644 index 00000000..814cba95 --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Planner/ProStore.swift @@ -0,0 +1,10 @@ +import StoreKit + +enum ProStore { + static func buy(_ product: Product) async throws { + _ = try await product.purchase() + } + static func restore() async throws { + try await AppStore.sync() + } +} diff --git a/tests/fixtures/scan/teaser-fixed/Planner/SettingsView.swift b/tests/fixtures/scan/teaser-fixed/Planner/SettingsView.swift new file mode 100644 index 00000000..13bcf2a9 --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Planner/SettingsView.swift @@ -0,0 +1,10 @@ +import SwiftUI + +struct SettingsView: View { + var body: some View { + List { + Link("Privacy policy", destination: URL(string: "https://example.com/privacy")!) + Text("Last opened: \(UserDefaults.standard.string(forKey: "lastOpen") ?? "-")") + } + } +} diff --git a/tests/fixtures/scan/teaser-fixed/Podfile.lock b/tests/fixtures/scan/teaser-fixed/Podfile.lock new file mode 100644 index 00000000..a21b254c --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/Podfile.lock @@ -0,0 +1,9 @@ +PODS: + - Google-Mobile-Ads-SDK (11.10.0) + - GoogleSignIn (7.1.0) + +DEPENDENCIES: + - Google-Mobile-Ads-SDK + - GoogleSignIn + +COCOAPODS: 1.15.2 diff --git a/tests/fixtures/scan/teaser-fixed/README.md b/tests/fixtures/scan/teaser-fixed/README.md new file mode 100644 index 00000000..aa8961c9 --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/README.md @@ -0,0 +1,8 @@ +# teaser-fixed fixture + +The teaser fixture after the five fixes the teaser video shows: an App Review demo account (kept outside the repo: in +`.storebound/credentials.json` or `REVIEW_DEMO_USER` / `REVIEW_DEMO_PASSWORD`), in-app account deletion +(`accounts.inApp`, `deleteAccount()`), Sign in with Apple next to Google Sign-In, a Restore Purchases path +(`AppStore.sync()`) and App Tracking Transparency (`requestTrackingAuthorization` plus +`NSUserTrackingUsageDescription`). With the demo account set, `storebound scan` finds no rejection risk; that re-scan +is the one the teaser video shows. Not a buildable project. diff --git a/tests/fixtures/scan/teaser-fixed/store/appstore.md b/tests/fixtures/scan/teaser-fixed/store/appstore.md new file mode 100644 index 00000000..77033ff0 --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/store/appstore.md @@ -0,0 +1,23 @@ +# Planner · App Store listing copy + +## en-US · English (U.S.) + +### subtitle +``` +Plan your week in a minute +``` + +### promotionalText +``` +Weekly planning without the clutter. +``` + +### keywords +``` +planner,week,calendar,tasks,agenda +``` + +### description +``` +Planner lays out your week in one screen. Planner Pro adds themes and widgets. +``` diff --git a/tests/fixtures/scan/teaser-fixed/storebound.config.ts b/tests/fixtures/scan/teaser-fixed/storebound.config.ts new file mode 100644 index 00000000..19ab4a8c --- /dev/null +++ b/tests/fixtures/scan/teaser-fixed/storebound.config.ts @@ -0,0 +1,18 @@ +// Fixture config (made up, example.com placeholders only). +export default { + app: { + name: 'Planner', + profile: 'app', + privacyPolicyUrl: 'https://example.com/privacy', + supportUrl: 'https://example.com/support', + website: 'https://example.com', + contactEmail: 'support@example.com', + }, + accounts: { enabled: true, inApp: 'Settings > Account > Delete account' }, + reviewAccess: { signInRequired: true, instructions: 'Sign in with the demo account.' }, + languages: [{ id: 'en', apple: 'en-US' }], + apple: { bundleId: 'com.example.planner', usesNonExemptEncryption: false }, + products: [ + { id: 'com.example.planner.pro', type: 'non_consumable', usd: 4.99, listings: { en: { title: 'Planner Pro', description: 'Themes and widgets' } } }, + ], +}; diff --git a/tests/teaser.test.ts b/tests/teaser.test.ts new file mode 100644 index 00000000..7a4004c3 --- /dev/null +++ b/tests/teaser.test.ts @@ -0,0 +1,84 @@ +// The teaser video (media/teaser): the scan text it shows is the real `storebound scan` output of the teaser fixtures, +// every cut sits on the beat grid, every caption is short and stays readable, every scene holds long enough. +import { beforeAll, describe, expect, test } from 'bun:test'; +import { join } from 'node:path'; + +const ROOT = join(import.meta.dir, '..'); +const CLI = join(ROOT, 'cli', 'index.ts'); +const FX = join(import.meta.dir, 'fixtures', 'scan'); + +interface Scene { id: string; from: number; to: number; start: number; end: number; in: string | null } +interface Finding { sev: string; guideline: string; title: string; where: string; fix: string; skill: string } +interface Teaser { + BEAT: number; DURATION: number; SCENES: Scene[]; + CAPTIONS: { id: string; lines: string[] }[]; + captionTimes(): { id: string; words: string; count: number; at: number; from: number; to: number; hold: number }[]; + SCAN_HEAD: { text: string }[]; SDKS: { name: string; what: string; dep: string; where: string }[]; + RISKS_LINE: string; FINDINGS: Finding[]; RESCAN_LINE: string; RESCAN_NONE: string; + DECL_LINES: { what: string; value: string; where: string }[]; DECL_ASK: string; CMD: string; +} +const path: string = join(ROOT, 'media/teaser/script.js'); +const T = (await import(path)) as Teaser; + +const scanText = (dir: string, demo: boolean): string => { + const env = { ...process.env, NO_COLOR: '1', REVIEW_DEMO_USER: demo ? 'demo@example.com' : '', REVIEW_DEMO_PASSWORD: demo ? 'example' : '' }; + const r = Bun.spawnSync(['bun', CLI, 'scan', '--dir', join(FX, dir)], { env, stdout: 'pipe', stderr: 'pipe' }); + // exit code 1 when blockers are found (the fixture before the fixes), 0 after + expect(r.exitCode).toBe(demo ? 0 : 1); + return r.stdout.toString() + r.stderr.toString(); +}; +let before = '', after = ''; +beforeAll(() => { before = scanText('teaser', false); after = scanText('teaser-fixed', true); }); + +describe('teaser: the scan text is real', () => { + test('command, header, SDKs and the risks line come from `storebound scan` of tests/fixtures/scan/teaser', () => { + expect(T.CMD).toBe('storebound scan'); + for (const l of T.SCAN_HEAD) expect(before).toContain(l.text); + for (const s of T.SDKS) expect(before).toMatch(new RegExp(`${s.name}\\s+${s.what.replace(/[()]/g, '\\$&')} · ${s.dep} \\(${s.where}\\)`)); + expect(before).toContain(T.RISKS_LINE); + }); + test('the five findings: severity, guideline, title, file:line, a verbatim piece of the fix, the skill', () => { + expect(T.FINDINGS).toHaveLength(5); + const blocks = before.split(/\n\s+\d\. /).slice(1); + T.FINDINGS.forEach((f, i) => { + const b = blocks[i]!; + expect(b.startsWith(`${f.sev.padEnd(7)} ${f.guideline} · App Store · ${f.title}`)).toBe(true); + expect(b).toContain(`at ${f.where}`); + expect(b).toContain(`skill: ${f.skill}`); + expect(b.match(/fix: (.*)/)![1]).toContain(f.fix); + }); + }); + test('declarations proposal lines', () => { + for (const d of T.DECL_LINES) expect(before).toContain(`detected ${d.what}: ${d.value}`); + for (const d of T.DECL_LINES) expect(before).toContain(`(${d.where})`); + expect(before).toContain(T.DECL_ASK); + }); + test('the re-scan after the fixes (tests/fixtures/scan/teaser-fixed, demo account in the environment) is clean', () => { + expect(after).toContain(T.RESCAN_LINE); + expect(after).toContain(T.RESCAN_NONE); + }); +}); + +describe('teaser: timing', () => { + const near = (x: number): boolean => Math.abs(x / T.BEAT - Math.round(x / T.BEAT)) < 1e-9; + test('scenes are contiguous, cover the video and cut on the beat', () => { + 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); + expect(T.SCENES.at(-1)!.end).toBeCloseTo(T.DURATION, 9); + for (const s of T.SCENES) expect(near(s.start), s.id).toBe(true); + expect(T.DURATION).toBeGreaterThan(29); + expect(T.DURATION).toBeLessThan(35); + }); + test('every scene holds at least 2.5 s', () => { + for (const s of T.SCENES) expect(s.end - s.start, s.id).toBeGreaterThanOrEqual(2.5); + }); + test('captions: at most 7 words, fully on screen for at least 1.2 s, never overlapping', () => { + const c = T.captionTimes(); + expect(c).toHaveLength(T.CAPTIONS.length); + for (const x of c) { + expect(x.count, x.words).toBeLessThanOrEqual(7); + expect(x.hold, x.words).toBeGreaterThanOrEqual(1.2); + } + for (let i = 1; i < c.length; i++) expect(c[i]!.at).toBeGreaterThanOrEqual(c[i - 1]!.to); + }); +}); diff --git a/tools/site-icons.ts b/tools/site-icons.ts index b4943399..4babd615 100644 --- a/tools/site-icons.ts +++ b/tools/site-icons.ts @@ -4,7 +4,7 @@ // App Store / Google Play marks from simple-icons (CC0 data) // apps/desktop/src/ui/store-marks the same two store marks for the desktop app (the other desktop icons come from // @phosphor-icons/react) -// media/teaser/icons Phosphor icons for the teaser video (the mouse cursor, the blocker-list icons) +// media/teaser/icons Phosphor icons for the teaser video (the mouse cursor, the inbox, finding and fix icons) // Both show them as CSS masks (site/style.css .ic-*, desktop styles.css .store-mark), so they take the text colour in // both themes and nothing is loaded from outside. The store marks only name the store next to its name; they are // trademarks of Apple Inc. and Google LLC (docs/desktop.md, the site footer). @@ -16,7 +16,8 @@ import { join } from 'node:path'; export const SITE_ICONS = ['caret-right', 'play', 'user', 'squares-four', 'briefcase'] as const; export const STORE_MARKS = ['appstore', 'googleplay'] as const; /** Teaser icons: [Phosphor weight, icon name], vendored as -.svg (the package's own file name). */ -export const TEASER_ICONS = [['fill', 'navigation-arrow'], ['bold', 'check'], ['bold', 'arrow-right'], ['bold', 'user']] as const; +export const TEASER_ICONS = [['fill', 'navigation-arrow'], ['bold', 'check'], ['fill', 'x-circle'], ['fill', 'check-circle'], ['bold', 'tray'], + ['bold', 'magnifying-glass'], ['bold', 'pencil-simple'], ['fill', 'warning-octagon'], ['fill', 'paper-plane-tilt'], ['bold', 'terminal-window']] as const; const root = new URL('..', import.meta.url).pathname; const phosphor = join(root, 'node_modules/@phosphor-icons/core');