// Slide motion layer on top of Reveal: when a slide becomes current, its // elements enter in story order (lift + fade, draw, type, light up), and the // loop diagrams keep a slow ambient pulse. Every resting state is the final // frame, so ?static, overview, print, and the speaker view's next-slide // preview always show the full slide. Reduced motion softens to fades. ;(() => { const deck = window.__deck const root = document.documentElement const params = new URLSearchParams(window.location.search) if (params.has('static')) { root.dataset.motion = 'off' return } const reduce = window.matchMedia('(prefers-reduced-motion: reduce)') const setMode = () => (root.dataset.motion = reduce.matches || params.has('soft') ? 'soft' : 'full') setMode() reduce.addEventListener('change', setMode) // [selector, kind, gap after each match (ms), pause before (ms)] const lift = [['h2', 'rise']] const plans = { title: [['.mark', 'pop', 0], ['h1', 'rise', 160], ['.who', 'rise'], ['.event', 'rise'], ['.event-podium.is-on', 'fade']], factory: [...lift, ['.stat', 'rise', 130], ['.solo', 'fade', 200, 500], ['.safe', 'rise']], lineage: [...lift, ['.shot', 'wipe', 500], ['.link', 'fade']], thesis: [ ...lift, ['[data-node="build"]', 'pop', 120], ['.arc-right', 'draw', 0], ['.head-right', 'fade', 160, 260], ['[data-node="verify"]', 'pop', 120], ['.arc-bottom', 'draw', 0], ['.head-bottom', 'fade', 160, 260], ['[data-node="deploy"]', 'pop', 120], ['.arc-left', 'draw', 0], ['.head-left', 'fade', 160, 260], ['.hub', 'fade', 120], ['.signal', 'rise', 160], ['.feed', 'draw', 0], ['.feedhead', 'fade', 0, 260], ], pillars: [...lift, ['.pillar', 'lightleft', 150], ['.then', 'rise', 0, 250]], 'run-autopilot': [['.huge', 'rise', 260], ['code', 'type']], 'your-turn': [...lift, ['.ask', 'fade'], ['.cmd', 'pop', 220], ['.cmd code', 'type', 500], ['li', 'rise', 120]], ladder: [...lift, ['.gh', 'fade', 50], ['.rung', 'rise', 45]], primitives: [...lift, ['.cat > span', 'rise', 70], ['.short', 'rise', 0, 150], ['.src', 'fade']], 'pr-3782': [...lift, ['.tl', 'rail', 0], ['.tl > li', 'rise', 150], ['.tl > li:last-child .dot', 'merged', 0], ['.qr-link', 'pop', 120, 200], ['.qrl', 'fade']], 'pr-3765': [...lift, ['figure:not(.after)', 'rise', 450], ['figure.after', 'lightup', 300], ['.link', 'fade']], 'control-kody': [...lift, ['.lead', 'fade'], ['.cmd', 'type', 380], ['.qr-link', 'pop', 120, 100], ['.qrl', 'fade']], 'health-checks': [['.statement', 'rise', 650], ['.statement .m-line2', 'fade']], break: [['.lead', 'fade'], ['.timer', 'pop', 160], ['.next', 'rise']], flags: [...lift, ['.lead', 'fade', 150], ['.field', 'lighttop', 170]], loops: [...lift, ['.steps > *', 'rise', 140]], 'signal-loop': [...lift, ['.src', 'rise', 110], ['.sig > .ar', 'fade', 0], ['.gate', 'pop', 160], ['.agent', 'pop', 160], ['.out', 'rise', 140]], 'ship-pr': [...lift, ['.fn, .ar', 'rise', 70], ['.loopback', 'fade', 0, 150], ['.how', 'rise']], 'product-decision': [...lift, ['.steps > *', 'rise', 140], ['.ask', 'rise', 0, 200]], 'pr-template': [...lift, ['.tile', 'lightleft', 130], ['.src', 'fade']], doors: [...lift, ['.card', 'rise', 160], ['.flag', 'rise', 0, 200]], faq: [...lift, ['.qi', 'rise', 40], ['.faq-back', 'fade']], 'codebase-cleanup': [['.name', 'rise', 160], ['.desc', 'rise', 200], ['.qr-link', 'pop']], 'kody-mcp': [...lift, ['.tile', 'lightleft', 130], ['.nokody', 'rise', 0, 200]], final: [['.thanks', 'rise', 200], ['.thanks .green', 'pop', 220], ['.who', 'rise'], ['.links', 'fade'], ['.cmd code', 'type', 300], ['.qr-link', 'pop', 120], ['.qrl', 'fade']], } const defaults = [['h2', 'rise'], ['.sec-num', 'pop', 120], ['.sec-rule', 'grow', 120], ['.sec-name', 'rise', 120], ['.sec-sub', 'fade'], ['.huge', 'pop', 160], ['.next', 'rise'], ['li', 'rise', 120]] const statement = document.querySelector('#health-checks .statement') const br = statement?.querySelector('br') if (br) { const line = document.createElement('span') line.className = 'm-line2' while (br.nextSibling) line.append(br.nextSibling) statement.append(line) } const wheel = document.querySelector('#thesis .fly') if (wheel) { const svg = wheel.querySelector('svg') for (const p of svg.querySelectorAll('.arc, .feed')) p.setAttribute('pathLength', '1') const packet = (cls) => Object.assign(document.createElement('div'), { className: cls, ariaHidden: 'true' }) svg.after(packet('m-packet'), packet('m-packet m-feedpacket')) } for (const section of document.querySelectorAll('.reveal .slides section')) { let t = 0 for (const [sel, kind, gap = 90, pause = 0] of plans[section.id] ?? defaults) { const els = section.querySelectorAll(sel) if (!els.length) continue t += pause for (const el of els) { if (el.dataset.m || el.closest('aside')) continue el.dataset.m = kind el.style.setProperty('--d', `${t}ms`) if (kind === 'type') el.style.setProperty('--steps', Math.max(8, el.textContent.trim().length)) if (getComputedStyle(el).display === 'inline' && !(el instanceof SVGElement)) el.style.display = 'inline-block' t += gap } } section.style.setProperty('--m-end', `${t}ms`) } const ease = (x) => 1 - (1 - x) ** 3 let counting = [] function countUp(section) { for (const el of section.querySelectorAll('.stat .v')) { const text = (el.dataset.final ??= el.textContent) const match = text.match(/\d[\d,]*/) if (!match) continue const target = Number(match[0].replace(/,/g, '')) const comma = match[0].includes(',') const start = performance.now() + 120 const job = { el, text, done: false } const tick = (now) => { if (job.done) return const x = Math.min(1, Math.max(0, (now - start) / 1100)) const n = Math.round(target * ease(x)) el.textContent = x >= 1 ? text : text.replace(match[0], comma ? n.toLocaleString('en-US') : String(n)) if (x < 1) requestAnimationFrame(tick) } requestAnimationFrame(tick) counting.push(job) } } function stopCounting() { for (const job of counting) { job.done = true job.el.textContent = job.text } counting = [] } function play(section) { stopCounting() for (const s of document.querySelectorAll('.reveal .slides section.m-go')) s.classList.remove('m-go') if (!section) return void section.offsetWidth section.classList.add('m-go') if (section.id === 'factory' && root.dataset.motion === 'full') countUp(section) } deck.on('slidechanged', (event) => play(event.currentSlide)) if (deck.isReady()) play(deck.getCurrentSlide()) else deck.on('ready', (event) => play(event.currentSlide)) })()