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.
591 lines
34 KiB
JavaScript
591 lines
34 KiB
JavaScript
// 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 { 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);
|
|
const V = H > W;
|
|
const $ = s => document.querySelector(s);
|
|
const stage = $('#stage');
|
|
stage.style.width = `${W}px`; stage.style.height = `${H}px`;
|
|
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) => (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 => String(s).replace(/&/g, '&').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);
|
|
|
|
/** 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 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 ----------
|
|
const capEl = $('#cap');
|
|
let capId = null, capWords = [];
|
|
function buildCaption(c) {
|
|
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 => `<span class="line">${l.split(' ').map(w => `<span class="w${w.startsWith('*') ? ' hl' : ''}">${esc(w.replace(/\*/g, ''))}</span>`).join(' ')}</span>`).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) => {
|
|
const at = c.big ? c.word[i] : c.at + capWords.length * 0.07;
|
|
capWords.push({ el: w, at });
|
|
}));
|
|
}
|
|
function captions(t) {
|
|
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 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(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)`);
|
|
}
|
|
|
|
// ---------- 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
|
|
? `<span class="hi"></span><span class="dot"></span><span class="from">App Store Connect</span><span class="date">${esc(m.date)}</span>
|
|
<span class="subj">${esc(MAIL_SUBJECT)}</span><span class="prev">Hello, Thank you for submitting… <b>${esc(m.guideline)}</b></span>`
|
|
: `<span class="hi"></span><span class="dot"></span><span class="from">${esc(m.from)}</span><span class="date">${esc(m.date)}</span>
|
|
<span class="subj">${esc(m.subject)}</span><span class="prev">${esc(m.preview)}</span>`;
|
|
list.appendChild(el);
|
|
return el;
|
|
};
|
|
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));
|
|
}
|
|
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));
|
|
}
|
|
|
|
// ---------- scan: the terminal ----------
|
|
const term = $('#term'), scanCam = $('#s-scan .cam');
|
|
const CW = V ? 840 : 1560;
|
|
term.innerHTML = [
|
|
'<span class="ln" data-k="prompt"></span>',
|
|
'<span class="ln"> </span>',
|
|
...SCAN_HEAD.map((l, i) => `<span class="ln ${l.kind === 'head' ? 'head' : 'dimt'}" data-at="${l.at}" data-k="head${i}">${esc(l.text)}</span>`),
|
|
'<span class="ln"> </span>',
|
|
`<span class="ln sec" data-at="${SDK_AT}" data-k="sdks">SDKs</span>`,
|
|
...SDKS.map((s, i) => `<span class="ln sdk" data-at="${s.at}" data-k="sdk${i}"> <b>${esc(s.name)}</b> · ${esc(s.what)}\n <span class="loc">${esc(s.where)}</span> <span class="dimt">${esc(s.dep)}</span></span>`),
|
|
'<span class="ln"> </span>',
|
|
`<span class="ln risk" data-at="${RISKS_AT}" data-k="risks">${esc(RISKS_LINE).replace(/(2 blocker, 3 high)/, '<span class="r">$1</span>')}</span>`,
|
|
...FINDINGS.map((f, i) => `<span class="fd" data-at="${f.at}" data-k="f${i}"><span class="glow"></span>`
|
|
+ `<span>${i + 1}. <span class="sev${f.sev === 'HIGH' ? ' high' : ''}">${f.sev}</span><span class="gl">${esc(f.guideline)}</span> <span class="dimt">· App Store</span></span>`
|
|
+ `<span class="ttl">${esc(f.title)}</span>`
|
|
+ `<span class="loc">at ${esc(f.where)}</span>`
|
|
+ `<span class="fx">fix: ${f.fix.match(/^[a-z]/) ? '<i>…</i> ' : ''}${esc(f.fix)} <i>…</i></span></span>`),
|
|
].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]),
|
|
];
|
|
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, `<span class="ps">$</span> <span class="cmd">${esc(CMD.slice(0, n))}</span>${caret ? '<span class="caret"></span>' : ''}`);
|
|
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)})`);
|
|
}
|
|
|
|
// ---------- 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) => `<div class="frow" style="left:${FR.x}px;width:${FR.w}px;top:${FR.top + i * (FR.h + FR.gap)}px;height:${FR.h}px">
|
|
<span class="tint t-bad" style="background:var(--red-bg)"></span><span class="tint t-good" style="background:var(--green-bg);opacity:0"></span>
|
|
<span class="ic"><span class="pi i-x bad"></span><span class="pi i-ok good"></span></span>
|
|
<span><span class="t1">${esc(f.short)}</span><span class="t2" style="display:block">${esc(f.guideline)} · ${esc(f.where)}</span></span>
|
|
<span class="chip" style="background:${f.sev === 'HIGH' ? '#c2410c' : 'var(--red-2)'}"><span class="c1">${f.sev}</span><span class="c2">FIXED</span></span></div>`).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 = `<span class="ln" data-k="p"></span><span class="ln" data-k="r" style="color:var(--green);font-weight:700">${esc(RESCAN_LINE)}</span>`
|
|
+ (V ? '' : `<span class="ln" data-k="n" style="color:var(--muted)"> ${esc(RESCAN_NONE)}</span>`);
|
|
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, `<span class="ps">$</span> <span class="cmd">${esc(RESCAN_CMD.slice(0, n))}</span>${n < RESCAN_CMD.length || t < FLIP_AT[0] - 0.2 ? '<span class="caret"></span>' : ''}`);
|
|
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 = 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)})`);
|
|
}
|
|
|
|
// ---------- 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 => `<span class="ln${l.ask ? ' ask' : ''}"><span class="k">${esc(l.k)}</span> <span class="w">${esc(l.w)}</span>${l.loc ? ` <span class="loc">${esc(l.loc)}</span>` : ` ${esc(l.v)}`}</span>`).join('');
|
|
const ROW = V ? 54 : 62;
|
|
form.querySelector('.body').innerHTML = DATA_SAFETY_ROWS.map(r => `<div class="row" style="height:${ROW}px"><span class="box"><span class="fill"></span><span class="pi i-check"></span></span>${esc(r)}<span class="tag">detected</span></div>`).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 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 => `<img src="out/desktop/${f}.jpg" alt="">`;
|
|
el.innerHTML = `<div class="win" style="left:${WIN.x}px;top:${WIN.y}px;width:${WIN.w}px;height:${WIN.h}px">
|
|
<div class="bar"><i></i><i></i><i></i><span class="tt">storebound</span></div>
|
|
<div class="view"><div class="cam" style="position:absolute;left:0;top:0;width:1280px;height:800px;transform-origin:0 0">
|
|
${img(d.empty ?? d.frame)}
|
|
${d.empty ? `<div class="clip c1">${img(d.frame)}</div><div class="clip c2">${img(d.frame)}</div>` : ''}
|
|
${d.clean ? `<div class="clip cl">${img(d.clean)}</div><div class="scanline" style="width:1280px"></div>` : ''}
|
|
</div></div></div>
|
|
<div class="ring${d.clean ? ' green' : ''}"></div><div class="callout${d.clean ? ' green' : ''}">${esc(d.callout.text)}</div>`;
|
|
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 };
|
|
}
|
|
/** 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) {
|
|
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)})`);
|
|
}
|
|
}
|
|
/** 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;
|
|
}
|
|
if (s.id === 'submit') {
|
|
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');
|
|
});
|
|
}
|
|
}
|
|
|
|
function seek(t) {
|
|
scenes(t);
|
|
background(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;
|
|
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, W, H, BEAT, captionTimes };
|
|
|
|
if (q.has('t')) ready.then(() => seek(Number(q.get('t'))));
|
|
if (q.has('play')) ready.then(() => {
|
|
const t0 = performance.now();
|
|
const loop = () => { seek(((performance.now() - t0) / 1000) % DURATION); requestAnimationFrame(loop); };
|
|
loop();
|
|
});
|