/* Hero data-flow stage, ported from the first landing draft (sweed-brain-landing.vercel.app): a turning network sphere (Sweed Brain) with signals running from the "Data in" labels into it and from it out to the "Data out" labels. Teal in, lilac out. */ (() => { const TEAL = [84, 200, 212], LILAC = [168, 156, 255], PALE = [222, 240, 237] const mix = (a, b, t) => a.map((v, i) => Math.round(v + (b[i] - v) * t)) const rgba = (c, a) => `rgba(${c[0]},${c[1]},${c[2]},${a.toFixed(3)})` const smooth = (x) => x * x * (3 - 2 * x) const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches function fibonacci(n) { const g = Math.PI * (3 - Math.sqrt(5)) return Array.from({ length: n }, (_, i) => { const y = 1 - (i + .5) / n * 2, r = Math.sqrt(1 - y * y), a = g * i; return [Math.cos(a) * r, y, Math.sin(a) * r] }) } /* the sphere */ function sphere(cv, { nodes: N = 128, threshold: TH = .4, radius: RAD = .4, signals: S = 6, pulse = { value: 0 }, pointer = { x: 0, y: 0 }, glow: GLOW = true, comets: COM = 0, pale: PL = false, spin: SPIN = .14, tail: TAILK = .55, cdur: CD = 1.6 } = {}) { const g = cv.getContext('2d'), base = fibonacci(N), ph = base.map((_, i) => [i * .31 + 9, i * .53 + 27, i * .77 + 55]) const unit = base.map(() => [0, 0, 0]), P = base.map(() => ({ x: 0, y: 0, z: 0, s: 1 })), ptr = { x: 0, y: 0 } let W = 0, H = 0, dpr = 1, raf = 0, on = true, t0 = performance.now(), nb = [] const sig = Array.from({ length: S }, (_, i) => ({ from: 0, to: 1, t: -i / S, dur: 1.4, ready: false })) const reseed = (s) => { const a = Math.floor(Math.random() * N), l = nb[a]; s.from = a; s.to = l && l.length ? l[Math.floor(Math.random() * l.length)] : (a + 1) % N; s.t = 0; s.ready = true; s.dur = .9 + Math.random() * .9 } const size = () => { const r = cv.getBoundingClientRect(); W = r.width; H = r.height; dpr = Math.min(devicePixelRatio || 1, 2); cv.width = Math.max(1, Math.round(W * dpr)); cv.height = Math.max(1, Math.round(H * dpr)) } const draw = (now, dt) => { { const r = cv.getBoundingClientRect(); if (Math.abs(r.width - W) > 1 || Math.abs(r.height - H) > 1) size() } if (!W || !H) return const T = (now - t0) / 1000, pu = pulse.value ptr.x += (pointer.x - ptr.x) * .04; ptr.y += (pointer.y - ptr.y) * .04 g.setTransform(dpr, 0, 0, dpr, 0, 0); g.clearRect(0, 0, W, H) const cx = W / 2, cy = H / 2, R = Math.min(W, H) * RAD * (1 + pu * .035) const glow = g.createRadialGradient(cx, cy, 0, cx, cy, R * 1.5) glow.addColorStop(0, rgba(mix(TEAL, LILAC, .35), .14 + pu * .16)); glow.addColorStop(.55, rgba(TEAL, .035)); glow.addColorStop(1, rgba(TEAL, 0)) if (GLOW) { g.fillStyle = glow; g.fillRect(0, 0, W, H) } const ay = T * SPIN + ptr.x * .45, ax = .32 + ptr.y * .3, cy1 = Math.cos(ay), sy1 = Math.sin(ay), cx1 = Math.cos(ax), sx1 = Math.sin(ax) for (let i = 0; i < N; i++) { const [bx, by, bz] = base[i], [p, q, r] = ph[i] let x = bx + .14 * Math.sin(p + T * .62), y = by + .14 * Math.sin(q + T * .55), z = bz + .14 * Math.sin(r + T * .7) const l = Math.hypot(x, y, z) || 1; x /= l; y /= l; z /= l; unit[i] = [x, y, z] const rx = x * cy1 + z * sy1, rz = -x * sy1 + z * cy1, ry = y * cx1 - rz * sx1, d = y * sx1 + rz * cx1, k = 3.4 / (3.4 - d) P[i].x = cx + rx * R * k; P[i].y = cy + ry * R * k; P[i].z = d; P[i].s = k } nb = base.map(() => []); g.lineCap = 'round' for (let i = 0; i < N; i++) for (let j = i + 1; j < N; j++) { const a = unit[i], b = unit[j], dd = Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]); if (dd >= TH) continue nb[i].push(j); nb[j].push(i) const A = P[i], B = P[j], depth = ((A.z + B.z) / 2 + 1) / 2, al = (1 - dd / TH) * (.1 + .5 * depth) * (1 + pu * .9) const side = Math.min(1, Math.max(0, ((A.x + B.x) / 2 - (cx - R)) / (2 * R))) g.strokeStyle = PL ? rgba(PALE, Math.min(.7, al * 1.15)) : rgba(mix(TEAL, LILAC, side), Math.min(.85, al)); g.lineWidth = PL ? .6 + depth * .7 : .5 + depth * .5 g.beginPath(); g.moveTo(A.x, A.y); g.lineTo(B.x, B.y); g.stroke() } const order = P.map((_, i) => i).sort((a, b) => P[a].z - P[b].z) for (const i of order) { const p = P[i], depth = (p.z + 1) / 2, tw = 1 + .25 * Math.sin(T * 1.4 + i * 2.7), c = i % 17 === 0 && !PL ? mix(TEAL, LILAC, (p.x - cx + R) / (2 * R)) : PALE g.fillStyle = rgba(c, PL ? .3 + depth * .65 : .18 + depth * .62); g.beginPath(); g.arc(p.x, p.y, Math.max(.5, (.45 + depth * 1.25) * tw * p.s * (R / 150) ** .4), 0, Math.PI * 2); g.fill() } if (COM) { const hs = (n, s) => { const x = Math.sin(n * 127.1 + s * 311.7) * 43758.5453; return x - Math.floor(x) }, tail = R * TAILK for (let k = 0; k < COM; k++) { const D = CD + hs(k, 1) * CD * .75, ph = T / D + hs(k, 2), sl = Math.floor(ph), u = ph - sl let a = Math.floor(hs(sl * 31 + k, 3) * N), prev = -1; const ch = [a] for (let hop = 0; hop < 5; hop++) { const l = nb[a].filter((v) => v !== prev); if (!l.length) break let b = l[Math.floor(hs(sl * 7 + k + hop, 4) * l.length)] if (prev >= 0) { const dx = P[a].x - P[prev].x, dy = P[a].y - P[prev].y; let best = -2 l.forEach((v) => { const ex = P[v].x - P[a].x, ey = P[v].y - P[a].y, c = (dx * ex + dy * ey) / ((Math.hypot(dx, dy) * Math.hypot(ex, ey)) || 1); if (c > best) { best = c; b = v } }) } ch.push(b); prev = a; a = b } if (ch.length < 2) continue const pts = ch.map((i) => P[i]), seg = []; let L = 0; for (let i = 1; i < pts.length; i++) { const l = Math.hypot(pts[i].x - pts[i - 1].x, pts[i].y - pts[i - 1].y); seg.push(l); L += l } if (L < 20) continue const head = u * (L + tail), dep = (pts[0].z + pts[pts.length - 1].z) / 4 + .5, fd = Math.min(1, u * 6, (1 - u) * 5) * (.35 + .65 * dep) const at = (q) => { q = Math.max(0, Math.min(L, q)); let i = 0; while (i < seg.length - 1 && q > seg[i]) { q -= seg[i]; i++ } const f = seg[i] ? Math.min(1, q / seg[i]) : 0; return [pts[i].x + (pts[i + 1].x - pts[i].x) * f, pts[i].y + (pts[i + 1].y - pts[i].y) * f] } for (let q = 0; q < 8; q++) { const a0 = head - tail * (1 - q / 8), a1 = head - tail * (1 - (q + 1) / 8); if (a1 < 0 || a0 > L) continue const p0 = at(a0), p1 = at(a1); g.strokeStyle = `rgba(255,255,255,${(.95 * fd * (q + 1) / 8).toFixed(3)})`; g.lineWidth = 1 + 1.8 * (q + 1) / 8; g.beginPath(); g.moveTo(p0[0], p0[1]); g.lineTo(p1[0], p1[1]); g.stroke() } if (head <= L) { const hp = at(head), rg = g.createRadialGradient(hp[0], hp[1], 0, hp[0], hp[1], 6); rg.addColorStop(0, `rgba(255,255,255,${(.8 * fd).toFixed(3)})`); rg.addColorStop(1, 'rgba(255,255,255,0)'); g.fillStyle = rg; g.fillRect(hp[0] - 6, hp[1] - 6, 12, 12) } } } if (!COM) for (const s of sig) { s.t += dt / s.dur; if (s.t >= 1 || (s.t >= 0 && !s.ready)) reseed(s); if (s.t < 0) continue const A = P[s.from], B = P[s.to], e = smooth(Math.min(1, s.t)), x = A.x + (B.x - A.x) * e, y = A.y + (B.y - A.y) * e const depth = ((A.z + B.z) / 2 + 1) / 2, f = Math.sin(Math.PI * Math.min(1, s.t)), rr = 7 + depth * 5 const gr = g.createRadialGradient(x, y, 0, x, y, rr) gr.addColorStop(0, rgba([240, 255, 252], .9 * f * (.4 + depth * .6))); gr.addColorStop(.3, rgba(mix(TEAL, LILAC, (x - cx + R) / (2 * R)), .45 * f)); gr.addColorStop(1, rgba(TEAL, 0)) g.fillStyle = gr; g.beginPath(); g.arc(x, y, rr, 0, Math.PI * 2); g.fill() } pulse.value = pu * Math.pow(.1, dt) } let last = performance.now() const loop = (now) => { const dt = Math.min(.05, (now - last) / 1000); last = now; if (on) draw(now, dt); raf = requestAnimationFrame(loop) } new ResizeObserver(() => { size(); if (reduce) draw(t0 + 600, 0) }).observe(cv) new IntersectionObserver(([e]) => { on = e.isIntersecting }).observe(cv) size() if (reduce) { sig.length = 0; draw(t0 + 600, 0) } else raf = requestAnimationFrame(loop) } /* the in/out lines between labels and the sphere */ const IN = '84,200,212', OUT = '168,156,255' const bez = (p, t) => { const m = 1 - t; return [m * m * m * p[0] + 3 * m * m * t * p[2] + 3 * m * t * t * p[4] + t * t * t * p[6], m * m * m * p[1] + 3 * m * m * t * p[3] + 3 * m * t * t * p[5] + t * t * t * p[7]] } const box = (el, root) => { let x = 0, y = 0, n = el; while (n && n !== root) { x += n.offsetLeft; y += n.offsetTop; n = n.offsetParent } return { x, y, w: el.offsetWidth, h: el.offsetHeight } } function flow(root, cv, core, labels, pulse) { const g = cv.getContext('2d'); let W = 0, H = 0, dpr = 1, on = true, L = [] const t0 = performance.now() const layout = () => { W = root.clientWidth; H = root.clientHeight; dpr = Math.min(devicePixelRatio || 1, 2) cv.width = Math.round(W * dpr); cv.height = Math.round(H * dpr) const c = box(core, root), cx = c.x + c.w / 2, cy = c.y + c.h / 2, r = c.w * .3, prev = L L = labels.map((el, i) => { const side = el.dataset.side, b = box(el, root), ly = b.y + b.h / 2, same = labels.filter((e) => e.dataset.side === side) const k = (same.indexOf(el) - (same.length - 1) / 2) / Math.max(1, same.length - 1), ty = cy + k * r * .9 const tx = cx + (side === 'in' ? -1 : 1) * Math.sqrt(Math.max(0, r * r - (ty - cy) ** 2)) const lx = side === 'in' ? b.x + b.w + 14 : b.x - 14 const pts = side === 'in' ? [lx, ly, lx + (tx - lx) * .55, ly, lx + (tx - lx) * .6, ty, tx, ty] : [tx, ty, tx + (lx - tx) * .4, ty, tx + (lx - tx) * .45, ly, lx, ly] const o = prev[i] return { el, side, pts, t: o ? o.t : side === 'in' ? -(Math.random() * 2.5 + (i % 3) * .5) : -(.8 + Math.random() * 2), dur: side === 'in' ? 2.6 + Math.random() * .8 : 2.3 + Math.random() * .5, lit: o ? o.lit : 0 } }) } const fireOut = () => { const idle = L.filter((l) => l.side === 'out' && l.t < -.35); if (idle.length) idle[Math.floor(Math.random() * idle.length)].t = -.35 } const draw = (now, dt) => { g.setTransform(dpr, 0, 0, dpr, 0, 0); g.clearRect(0, 0, W, H) const T = (now - t0) / 1000, grow = reduce ? 1 : Math.min(1, Math.max(0, (T - .5) / 1.6)) for (const l of L) { const col = l.side === 'in' ? IN : OUT g.beginPath(); for (let i = 0; i <= 48 * grow; i++) { const [x, y] = bez(l.pts, i / 48); i ? g.lineTo(x, y) : g.moveTo(x, y) } g.setLineDash([2, 7]); g.lineDashOffset = l.side === 'in' ? -T * 6 : T * 6; g.strokeStyle = `rgba(${col},0.26)`; g.lineWidth = 1; g.stroke(); g.setLineDash([]) if (reduce || grow < 1) continue l.t += dt / l.dur if (l.side === 'in' && l.t >= 0 && !l.started) { l.started = true; l.lit = 1 } if (l.t >= 1) { if (l.side === 'in') { pulse.value = Math.min(1.2, pulse.value + .45); fireOut(); l.t = -(.6 + Math.random() * 1.8); l.started = false } else { l.lit = 1; l.t = -(1 + Math.random() * 1.8) } } if (l.t > 0 && l.t < 1) { const b = l.t, a = Math.max(0, b - .16), gr = g.createLinearGradient(...bez(l.pts, a), ...bez(l.pts, b)) gr.addColorStop(0, `rgba(${col},0)`); gr.addColorStop(1, `rgba(${col},0.95)`) g.beginPath(); for (let i = 0; i <= 12; i++) { const [x, y] = bez(l.pts, a + (b - a) * i / 12); i ? g.lineTo(x, y) : g.moveTo(x, y) } g.strokeStyle = gr; g.lineWidth = 1.6; g.stroke() const [x, y] = bez(l.pts, b), rg = g.createRadialGradient(x, y, 0, x, y, 9) rg.addColorStop(0, 'rgba(240,255,252,0.95)'); rg.addColorStop(.35, `rgba(${col},0.5)`); rg.addColorStop(1, `rgba(${col},0)`) g.fillStyle = rg; g.beginPath(); g.arc(x, y, 9, 0, Math.PI * 2); g.fill() } const [ex, ey] = l.side === 'in' ? bez(l.pts, 0) : bez(l.pts, 1) g.fillStyle = `rgba(${col},${.35 + l.lit * .65})`; g.beginPath(); g.arc(ex, ey, 2 + l.lit * 1.5, 0, Math.PI * 2); g.fill() const lit = l.lit > .05; if (lit !== l.el.classList.contains('is-lit')) l.el.classList.toggle('is-lit', lit) l.lit = Math.max(0, l.lit - dt / 2) } } let last = performance.now() const loop = (now) => { const dt = Math.min(.05, (now - last) / 1000); last = now; if (on) draw(now, dt); requestAnimationFrame(loop) } new ResizeObserver(() => { layout(); if (reduce) draw(performance.now(), 0) }).observe(root) new IntersectionObserver(([e]) => { on = e.isIntersecting }).observe(root) layout(); document.fonts && document.fonts.ready.then(layout) if (reduce) draw(performance.now(), 0); else requestAnimationFrame(loop) } window.SweedSphere = sphere window.SweedHero = (root) => { const pulse = { value: 0 }, pointer = { x: 0, y: 0 } root.addEventListener('pointermove', (e) => { const r = root.getBoundingClientRect(); pointer.x = (e.clientX - r.left) / r.width - .5; pointer.y = (e.clientY - r.top) / r.height - .5 }) root.addEventListener('pointerleave', () => { pointer.x = 0; pointer.y = 0 }) sphere(root.querySelector(".flow-core canvas"), { nodes: 96, threshold: .46, radius: .4, signals: 6, pulse, pointer }) flow(root, root.querySelector('.flow-canvas'), root.querySelector('.flow-core'), [...root.querySelectorAll('[data-side]')], pulse) } })() /*@@SBL-NEXT-SCRIPT@@*/ // Wireframe solids for the landing, copied from the Sweed Brain story film (storyboard/brain-story.html, draft v110) // by sync_film.py: helpers + the house (shop), the product blocks, the register, the swirl, the jack-in-the-box and the cubes. const TAU = Math.PI * 2 const hsh = (i, s) => { const x = Math.sin(i * 127.1 + s * 311.7) * 43758.5453; return x - Math.floor(x) } const _g = () => ({ V: [], E: [] }) const rotAx = (v, a, th) => { const c = Math.cos(th), s = Math.sin(th), d = (a[0] * v[0] + a[1] * v[1] + a[2] * v[2]) * (1 - c); return [v[0] * c + (a[1] * v[2] - a[2] * v[1]) * s + a[0] * d, v[1] * c + (a[2] * v[0] - a[0] * v[2]) * s + a[1] * d, v[2] * c + (a[0] * v[1] - a[1] * v[0]) * s + a[2] * d] } const ASME = u => { if (u <= 0) return 0; if (u >= 1) return 1; const c = 1.5, v = u - 1; return 1 + (c + 1) * v * v * v + c * v * v } // flies in and settles with a small overshoot const BRKE = u => u < .16 ? -.035 * Math.sin(Math.PI * u / .16) : u < .78 ? ((u - .16) / .62) ** 2 : 1 - .08 * Math.sin(Math.PI * (u - .78) / .22) * (1 - (u - .78) / .22) // a piece falling: it hesitates, gravity takes it, it lands with a small bounce const sBox = (g, x, y, z, w, h, d, ry = 0) => { const b = g.V.length, c = Math.cos(ry), s = Math.sin(ry); for (const [i, j, k] of [[0, 0, 0], [1, 0, 0], [1, 0, 1], [0, 0, 1], [0, 1, 0], [1, 1, 0], [1, 1, 1], [0, 1, 1]]) { const lx = (i - .5) * w, lz = (k - .5) * d; g.V.push([x + lx * c + lz * s, y + j * h, z - lx * s + lz * c]) } for (const [a, q] of [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4], [0, 4], [1, 5], [2, 6], [3, 7]]) g.E.push([b + a, b + q]); return g } const sPrism = (g, poly, y, h, vert) => { const b = g.V.length, n = poly.length; for (const [x, z] of poly) g.V.push([x, y, z]); for (const [x, z] of poly) g.V.push([x, y + h, z]) for (let i = 0; i < n; i++) { g.E.push([b + i, b + (i + 1) % n], [b + n + i, b + n + (i + 1) % n]); if (!vert || vert(i)) g.E.push([b + i, b + n + i]) } return g } const sExt = (g, poly, z0, dp, vert) => { const b = g.V.length, n = poly.length; for (const [x, y] of poly) g.V.push([x, y, z0]); for (const [x, y] of poly) g.V.push([x, y, z0 + dp]) for (let i = 0; i < n; i++) { g.E.push([b + i, b + (i + 1) % n], [b + n + i, b + n + (i + 1) % n]); if (!vert || vert(i)) g.E.push([b + i, b + n + i]) } return g } const sPyr = (g, x, y, z, w, h) => { const b = g.V.length; for (const [i, k] of [[-1, -1], [1, -1], [1, 1], [-1, 1]]) g.V.push([x + i * w / 2, y, z + k * w / 2]); g.V.push([x, y + h, z]); for (let i = 0; i < 4; i++) g.E.push([b + i, b + (i + 1) % 4], [b + i, b + 4]); return g } const ring = (r, n = 16, a0 = 0, a1 = TAU, cx = 0, cz = 0) => { const full = a1 - a0 > TAU - .01; return Array.from({ length: n }, (_, i) => { const a = a0 + (a1 - a0) * i / (full ? n : n - 1); return [cx + Math.cos(a) * r, cz + Math.sin(a) * r] }) } const gold8 = (g, i) => { if (i != null) g.gold = [i * 8, i * 8 + 8]; return g } const SOL = { shop: p => { const g = _g(), BV = g.BV = [], BK = g.BK = [], tag = id => { while (BV.length < g.V.length) BV.push(id) }, K = (pts, closed = true) => { const q = g.V.length; pts.forEach(v => g.V.push(v)); for (let i = 1; i < pts.length; i++) g.E.push([q + i - 1, q + i]); if (closed) g.E.push([q + pts.length - 1, q]) } const piece = (s, draw) => { const id = BK.length; BK.push(s); draw(); tag(id) }, win = f => { const q = g.V.length; [[-1, -1], [1, -1], [1, 1], [-1, 1], [0, -1], [0, 1], [-1, 0], [1, 0]].map(f).forEach(v => g.V.push(v)); [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [6, 7]].forEach(([a, b]) => g.E.push([q + a, q + b])) } // the house is put together from separate pieces; with brk (on «patched together») it falls apart piece by piece: chimney, rafters, ridge and eaves, posts, walls sBox(g, 0, -214, 0, 470, 14, 360); K([[-190, -200, -140], [190, -200, -140], [190, -200, 140], [-190, -200, 140]]); tag(-1) // the plinth and the sills stay piece({ d: 0, dur: .72, pv: [120, 150, 87], dir: [0, 1], an: 1.35, tr: [-30, -330, 110] }, () => sBox(g, 120, 150, 60, 54, 96, 54)) // the chimney topples off first, backwards const RX = [-220, -110, 0, 110, 220] RX.forEach((x, i) => { const sg = i % 2 ? 1 : -1; piece({ d: .1 + i * .09, dur: .62, pv: [x, 30, 172 * sg], dir: [0, sg], an: .3, tr: [(hsh(i, 201) - .5) * 60, -226, 200 * sg] }, () => K([[x, 30, -172], [x, 205, 0], [x, 30, 172]], false)) }) // the rafters slide off one after another, to either side piece({ d: .5, dur: .6, pv: [0, 205, 0], dir: [1, 0], an: .14, tr: [30, -398, 0] }, () => K(RX.map(x => [x, 205, 0]), false)) // the ridge drops for (const sg of [-1, 1]) piece({ d: .56 + (sg + 1) * .04, dur: .55, pv: [0, 30, 172 * sg], dir: [0, sg], an: .25, tr: [0, -226, 70 * sg] }, () => K(RX.map(x => [x, 30, 172 * sg]), false)) // the eaves ;[[-190, -140], [190, -140], [190, 140], [-190, 140]].forEach(([x, z], i) => { const l = Math.hypot(x, z); piece({ d: .72 + [0, .06, .14, .2][i], dur: .62, pv: [x, -200, z], dir: [x / l, z / l], an: 1.45 }, () => K([[x, -200, z], [x, 30, z]], false)) }) // the corner posts topple outward piece({ d: .82, dur: .7, pv: [0, -200, -140], dir: [0, -1], an: 1.52 }, () => { K([[-190, 30, -140], [190, 30, -140]], false) // the front wall tips forward with its door and window K([[-140, -200, -141], [-140, -52, -141], [-54, -52, -141], [-54, -200, -141]], false); K([[-128, -200, -141], [-128, -64, -141], [-66, -64, -141], [-66, -200, -141]], false); win(([u, v]) => [80 + u * 56, -90 + v * 46, -141]) }) piece({ d: .9, dur: .7, pv: [190, -200, 0], dir: [1, 0], an: 1.52 }, () => { K([[190, 30, -140], [190, 30, 140]], false); win(([u, v]) => [191, -90 + v * 46, u * 62]) }) // the side wall with its window piece({ d: 1.0, dur: .7, pv: [0, -200, 140], dir: [0, 1], an: 1.52 }, () => K([[-190, 30, 140], [190, 30, 140]], false)) // the back wall piece({ d: 1.06, dur: .7, pv: [-190, -200, 0], dir: [-1, 0], an: 1.52 }, () => K([[-190, 30, -140], [-190, 30, 140]], false)) // the far side wall return g }, blocks: p => { const g = _g(), BV = g.BV = [], BK = g.BK = [], LB = g.LB = [], nd = g.nd = new Set(), A = 150, G = 172 // his note 27.11: no computer — the product's blocks as cubes that stack into one thing const at = [[-G, -230], [0, -230], [G, -230], [-G / 2, -230 + G], [G / 2, -230 + G], [0, -230 + 2 * G]], names = ['POS', 'E-com', 'CRM', 'Loyalty', 'Marketing', 'Kiosk'] const far = [[-90, -260, -60, .9, [0, 1]], [150, -290, -40, -.8, [1, 0]], [200, -10, -160, .8, [0, -1]], [-110, 60, 60, -.9, [1, 0]], [140, 250, -60, .9, [0, 1]], [-40, 290, -140, -.7, [1, 0]]] // where each block floats while it is loose (its centre), and how it is turned at.forEach(([x, y], i) => { const id = BK.length, [dx, dy, dz, an, dir] = far[i]; BK.push({ d: [0, .14, .28, .5, .64, .86][i], dur: .62, pv: [x, y + A / 2, 0], dir, an, tr: [dx - x, dy - y - A / 2, dz] }) sBox(g, x, y, 0, A, A, A); const v = g.V.length; g.V.push([x, y + A / 2, -A / 2 - 1]); nd.add(v); LB.push({ v, t: names[i] }); while (BV.length < g.V.length) BV.push(id) }) return g }, register: p => { const g = _g(), K = (pts, closed = true) => { const q = g.V.length; pts.forEach(v => g.V.push(v)); for (let i = 1; i < pts.length; i++) g.E.push([q + i - 1, q + i]); if (closed) g.E.push([q + pts.length - 1, q]) } // everything that has a face shows it to the camera: the screen, the drawer front, the card reader's keypad, the printer's slot sBox(g, 0, -260, 0, 440, 96, 200) // the cash drawer, shallow, its front to the viewer K([[-205, -234, -101], [205, -234, -101]], false); K([[-70, -222, -101], [70, -222, -101], [70, -206, -101], [-70, -206, -101]]) // the drawer's seam and handle slot, on the front sBox(g, 0, -164, 30, 36, 116, 36) // the stand const W = 205, H = 135, Y = 90, Z = 10, q = (x, y, z = Z) => [x, Y + y, z] // the screen, square to the viewer K([q(-W, -H), q(W, -H), q(W, H), q(-W, H)]); K([q(-W, -H, Z + 16), q(W, -H, Z + 16), q(W, H, Z + 16), q(-W, H, Z + 16)]) K([q(-W + 18, -H + 18, Z - 1), q(W - 18, -H + 18, Z - 1), q(W - 18, H - 18, Z - 1), q(-W + 18, H - 18, Z - 1)]) K([q(-160, 70, Z - 2), q(-40, 70, Z - 2), q(-40, 20, Z - 2), q(-160, 20, Z - 2)]); K([q(10, 80, Z - 2), q(160, 80, Z - 2)], false); K([q(10, 45, Z - 2), q(130, 45, Z - 2)], false); K([q(10, 10, Z - 2), q(150, 10, Z - 2)], false) K([q(-160, -40, Z - 2), q(-60, -40, Z - 2), q(-60, -90, Z - 2), q(-160, -90, Z - 2)]); K([q(-40, -40, Z - 2), q(60, -40, Z - 2), q(60, -90, Z - 2), q(-40, -90, Z - 2)]); K([q(80, -40, Z - 2), q(160, -40, Z - 2), q(160, -90, Z - 2), q(80, -90, Z - 2)]) // tiles on the screen sBox(g, 292, -164, 0, 110, 70, 96); K([[256, -118, -49], [328, -118, -49]], false) // the receipt printer, right, its slot on the front for (const dx of [-30, 30]) K(Array.from({ length: 7 }, (_, i) => { const t = i / 6; return [292 + dx, -94 + 104 * t, -44 - 34 * Math.sin(t * 2.4)] }), false) // the slip curling out towards the viewer sBox(g, -292, -164, -10, 78, 124, 28) // the card reader, upright, left K([[-318, -60, -25], [-266, -60, -25], [-266, -84, -25], [-318, -84, -25]]) // its little screen for (let r = 0; r < 3; r++) for (let c = 0; c < 3; c++) g.V.push([-310 + c * 18, -104 - r * 16, -25]) // its keypad: nine dots return g }, swirl: p => { const g = _g(), rot = (p && p.a) || 0, ex = (p && p.ex) || 0; g.nd = new Set(); g.W = [] // like the Dutchie spinner, not one-to-one: ten curved strokes, long and short in turn, sweeping out from the middle, no hub for (let q = 0; q < 10; q++) { const long = q % 2 === 0, a0 = q / 10 * TAU + rot + (long ? 0 : .32), r0 = long ? 70 : 125, r1 = long ? 305 : 235, sweep = long ? 1.45 : 1.0 const at = t => { const an = a0 + t * sweep, r = (r0 + (r1 - r0) * t) * (1 + ex * (.4 + t)); return [Math.cos(an) * r, Math.sin(an) * r] } const M = 160, cum = [0]; let pr = at(0); for (let i = 1; i <= M; i++) { const c = at(i / M); cum.push(cum[i - 1] + Math.hypot(c[0] - pr[0], c[1] - pr[1])); pr = c } const L = cum[M], n = long ? 19 : 13, b = g.V.length // a smooth curve: vertices at equal steps along the arc, a dot on every third, the last segments thinner for (let i = 0; i < n; i++) { const s = L * i / (n - 1); let k = 1; while (k < M && cum[k] < s) k++; const t = (k - 1 + (s - cum[k - 1]) / ((cum[k] - cum[k - 1]) || 1)) / M, [x, y] = at(t); g.V.push([x, y, 0]) if (i % 3) g.nd.add(b + i); if (i) { g.E.push([b + i - 1, b + i]); g.W.push(Math.min(1, .25 + .25 * Math.min(i, n - i))) } } } return g }, jack: p => { const a = (p && p.a) || 0, s = (p && p.s) || 0, g = _g(), F = pts => { const q = g.V.length; pts.forEach(v => g.V.push(v)); for (let i = 0; i < 4; i++) g.E.push([q + i, q + (i + 1) % 4]) } F([[-170, -170, -170], [170, -170, -170], [170, -170, 170], [-170, -170, 170]]); for (const [u, v] of [[[-170, -170], [170, -170]], [[170, -170], [170, 170]], [[170, 170], [-170, 170]], [[-170, 170], [-170, -170]]]) F([[u[0], -170, u[1]], [v[0], -170, v[1]], [v[0], 110, v[1]], [u[0], 110, u[1]]]) // floor and four walls const b = g.V.length, c = Math.cos(a), sn = Math.sin(a) ;[[-170, 0], [170, 0], [170, 340], [-170, 340]].forEach(([x, d]) => g.V.push([x, 110 + d * sn, 170 - d * c])); for (let i = 0; i < 4; i++) g.E.push([b + i, b + (i + 1) % 4]) // hinged at the back: it swings up behind the jester and leaves the front open g.E.push([b, b + 2]) // a brace across the lid, so it reads as a lid if (s < .04) return g const e = Math.min(1, s), R = 80 * e, y0 = -160, top = y0 + 470 * s, K = (pts, closed = true) => { const q = g.V.length; pts.forEach(v => g.V.push(v)); for (let i = 1; i < pts.length; i++) g.E.push([q + i - 1, q + i]); if (closed) g.E.push([q + pts.length - 1, q]); return q } K(Array.from({ length: 30 }, (_, i) => { const t = i / 29, an = t * TAU * 4; return [Math.cos(an) * 44 * e, y0 + (top - y0) * t, Math.sin(an) * 44 * e] }), false) // the spring const cy = top + R * 1.15 K(Array.from({ length: 16 }, (_, i) => { const an = i / 16 * TAU, r = (i % 2 ? .72 : 1.18) * R; return [Math.cos(an) * r, top + R * .1, Math.sin(an) * r] })) // the ruff const hs = g.V.length // from here on the head: it is turned to the camera (fy = the figure's ry) and tilted up a little, so he looks at the viewer, not into the box K(Array.from({ length: 14 }, (_, i) => { const an = i / 14 * TAU; return [Math.cos(an) * R, cy + Math.sin(an) * R, 0] })) // the head K(Array.from({ length: 14 }, (_, i) => { const an = i / 14 * TAU; return [Math.cos(an) * R, cy, Math.sin(an) * R] })) for (const sx of [-1, 1]) K(Array.from({ length: 4 }, (_, i) => { const an = i / 4 * TAU; return [sx * R * .36 + Math.cos(an) * R * .1, cy + R * .2 + Math.sin(an) * R * .1, -R * .93] })) // the eyes K(Array.from({ length: 6 }, (_, i) => { const an = Math.PI * (1.2 + .6 * i / 5); return [Math.cos(an) * R * .5, cy - R * .05 + Math.sin(an) * R * .5, -R * .9] }), false) // the grin const hb = cy + R * .62, hr = K(Array.from({ length: 10 }, (_, i) => { const an = i / 10 * TAU; return [Math.cos(an) * R * .95, hb, Math.sin(an) * R * .95] })) // the cap band for (const d of [-1, 0, 1]) { // three floppy points, each ending in a bell const C = t => d ? [d * (R * .45 + R * 2.0 * t), hb + R * 1.7 * Math.sin(Math.PI * t * .78) - R * 1.1 * t * t] : [R * 1.1 * t * t, hb + R * 2.5 * t - R * .7 * t * t] const side = sg => Array.from({ length: 7 }, (_, i) => { const t = i / 6, p0 = C(t), p1 = C(Math.min(1, t + .02)), dx = p1[0] - p0[0], dy = p1[1] - p0[1], l = Math.hypot(dx, dy) || 1, w = R * .42 * (1 - t); return [p0[0] - dy / l * w * sg, p0[1] + dx / l * w * sg, 0] }) const L = side(1), Rr = side(-1).reverse(); K([...L, ...Rr.slice(1)], false) const tip = C(1); K(Array.from({ length: 8 }, (_, i) => { const an = i / 8 * TAU; return [tip[0] + Math.cos(an) * R * .2, tip[1] - R * .2 + Math.sin(an) * R * .2, 0] })) } { const ps = .25, fy = -(p.fy ?? .62), cp = Math.cos(ps), sp = Math.sin(ps), cf = Math.cos(fy), sf = Math.sin(fy) for (let i = hs; i < g.V.length; i++) { const [x, y0, z0] = g.V[i], y = y0 - cy, y1 = y * cp - z0 * sp, z1 = y * sp + z0 * cp; g.V[i] = [x * cf + z1 * sf, cy + y1, -x * sf + z1 * cf] } } return g }, cubes: p => { const g = _g(), sz = 150, ex = p.ex ?? 0, j = p.j ?? 0; let c = 0; for (const y of [-1, 1]) for (const z of [-1, 1]) for (const x of [-1, 1]) { const q = c++, d = sz / 2 * (1 + ex) + (ex || j ? 4 : 0) // closed, the eight cubes share their faces exactly: no doubled lines sBox(g, x * d + (hsh(q, 91) - .5) * 300 * j, y * d - sz / 2 + (hsh(q, 92) - .5) * 180 * j, z * d + (hsh(q, 93) - .5) * 300 * j, sz, sz, sz, (hsh(q, 94) - .5) * 1.7 * j) } return gold8(g, p.gold) }, } ; /* Wireframe figures on the landing, drawn like the story film: thin mint edges, a dot in every vertex, a couple of glints running along the edges. Geometry comes from solids-geo.js (copied from the film); here is only the camera and each figure's choreography, played when its canvas comes into view and looped while it stays there. SweedSolid(canvas, 'house' | 'jack' | 'swirl' | 'register') */ (() => { const FOC = 1600, reduce = matchMedia('(prefers-reduced-motion: reduce)').matches const cl = (v, a = 0, b = 1) => Math.max(a, Math.min(b, v)) const io = (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2 const out = (p) => 1 - Math.pow(1 - p, 3) const back = (p) => { const c = 1.7, q = p - 1; return 1 + (c + 1) * q * q * q + c * q * q } const seg = (t, a, d) => cl((t - a) / d) // connected pieces of a figure (for the register's scattered parts); loose dots join the nearest piece function pieces(g) { const par = g.V.map((_, i) => i), f = (i) => par[i] === i ? i : (par[i] = f(par[i])) g.E.forEach(([a, b]) => { par[f(a)] = f(b) }) const deg = g.V.map(() => 0); g.E.forEach(([a, b]) => { deg[a]++; deg[b]++ }) g.V.forEach((v, i) => { if (deg[i]) return; let best = -1, bd = 1e9; g.V.forEach((w, j) => { if (!deg[j]) return; const d = Math.hypot(v[0] - w[0], v[1] - w[1], v[2] - w[2]); if (d < bd) { bd = d; best = j } }); if (best >= 0) par[i] = f(best) }) const ids = new Map(); return g.V.map((_, i) => { const r = f(i); if (!ids.has(r)) ids.set(r, ids.size); return ids.get(r) }) } /* each figure: the pose at time t (s) of a cycle of length `loop` returns { g, ry, yaw, pitch, dist, k, at, brk, ana } — the film's camera words */ const FIG = { // the house is put together, stands, then falls apart piece by piece: chimney, rafters, ridge, eaves, posts, walls house: { loop: 7.2, base: { ry: .62, yaw: -.2, pitch: .34, dist: 1650, k: 1 }, pose(t) { const g = SOL.shop({ j: 0 }); return { g, grow: seg(t, 0, 1.4), brk: (t - 2.6) / 2.1, fade: 1 - seg(t, 6.4, .7) } } }, // a closed box; the lid swings back on its hinge, the jester springs out facing the viewer and bobs to a stop jack: { loop: 6.4, rest: 4.8, base: { ry: .62, yaw: 0, pitch: .3, dist: 1900, k: 1, at: [0, -60, 0] }, pose(t) { const K = [[0, 0, 0], [.9, 0, 0], [1.05, 1.95, 1.3], [1.32, 1.7, .82], [1.54, 1.85, 1.1], [1.76, 1.76, .94], [2.02, 1.8, 1], [4.9, 1.8, 1], [5.5, 0, 0], [6.4, 0, 0]] let i = 0; while (i < K.length - 2 && t > K[i + 1][0]) i++ const [t0, a0, s0] = K[i], [t1, a1, s1] = K[i + 1], u = io(cl((t - t0) / ((t1 - t0) || 1))) return { g: SOL.jack({ a: a0 + (a1 - a0) * u, s: s0 + (s1 - s0) * u, fy: .62 }), grow: 1 } } }, // the spinner: ten arcs, each turning with its own lag; then the camera swings round and shows it is flat swirl: { loop: 6, rest: 5.95, base: { ry: 0, yaw: 0, pitch: 0, dist: 1500, k: 1 }, arms: true, pose(t) { const sw = seg(t, 3.4, .8) - seg(t, 4.9, .8); return { g: SOL.swirl({ a: 0 }), grow: 1, spin: t, yaw: 1.45 * io(cl(sw)) } } }, // the register's parts hang apart in space; as the camera comes round they line up into one terminal, facing you register: { loop: 7, base: { ry: 0, yaw: 0, pitch: .07, dist: 1700, k: 1.15, at: [0, 40, 0] }, aq: [.1, .55, .2, .8, .35, .15, .62, .3, .05, .45], pose(t) { const u = io(seg(t, .6, 1.9)), back = io(seg(t, 5.6, 1.3)), a = Math.max(1 - u, back); return { g: SOL.register({}), grow: 1, ana: a, yaw: .62 * a } } }, // the product's blocks hang apart, each a cube with its name; they turn square, close in and lock into one block cubes: { loop: 7.4, base: { ry: .62, yaw: 0, pitch: .42, dist: 1700, k: 1.15, at: [0, 30, 0] }, labels: ['POS', 'eCommerce', 'Loyalty', 'Marketing', 'Inventory', 'Delivery', 'Analytics', 'Compliance'], pose(t) { const j = 1 - io(seg(t, .5, 1.6)) + io(seg(t, 6.2, 1.1)), ex = .55 * (1 - io(seg(t, 1.5, .9))) + .55 * io(seg(t, 6.2, 1.1)) return { g: SOL.cubes({ ex, j }), grow: 1, lab: 1 - seg(t, 2.1, .5) + seg(t, 6.3, .5), spinY: .18 * Math.sin(t * .6) } } }, // the film's «Your software vendor…» (v110): six product blocks float loose, each turned its own way; one by one they fly // into place and stack into one pyramid, each landing with a small flash; held, then they drift apart again blocks: { loop: 8, rest: 6.3, base: { ry: .45, yaw: 0, pitch: .24, dist: 1750, k: 1.25, at: [0, 0, 0] }, pose(t) { const a = t < 6.4 ? t - 1.4 : (1 - (t - 6.4) / 1.4) * 5; return { g: SOL.blocks({}), grow: 1, asm: a, yaw: .14 * seg(t, .3, 3.6) } } }, } window.SweedSolid = (cv, kind) => { const F = FIG[kind], g0 = F.pose(0).g, cmp = kind === 'register' ? pieces(g0) : null const ARM = []; if (F.arms) for (let q = 0; q < 10; q++) for (let i = 0; i < (q % 2 ? 13 : 19); i++) ARM.push(q) // the swirl: which arc a vertex is on const ink = cv.hasAttribute('data-ink'), C = ink ? { e: '28,32,36', d: '28,32,36', gl: '29,120,116', tx: 'rgba(28,32,36,.95)', fl: '29,120,116', pill: 'rgba(255,255,255,.9)', pt: '#1c2024' } : { e: '214,244,238', d: '226,250,245', gl: '145,225,221', tx: 'rgba(245,247,244,.95)', fl: '255,255,255', pill: 'rgba(3,34,31,.78)', pt: '#eaf7f6' } const ctx = cv.getContext('2d'); let W = 0, H = 0, dpr = 1, on = false, t0 = 0, raf = 0 const size = () => { const r = cv.getBoundingClientRect(); W = r.width; H = r.height; dpr = Math.min(devicePixelRatio || 1, 2); cv.width = Math.round(W * dpr); cv.height = Math.round(H * dpr) if (cv.hasAttribute('data-fit') && W) { FIT = null; let x0 = 1e9, x1 = -1e9, y0 = 1e9, y1 = -1e9 for (let t = 0; t <= (F.rest ?? F.loop); t += .05) draw(t, 1).forEach((p) => { x0 = Math.min(x0, p[0]); x1 = Math.max(x1, p[0]); y0 = Math.min(y0, p[1]); y1 = Math.max(y1, p[1]) }) const pad = Math.min(18, W * .03), s = Math.min((W - 2 * pad) / (x1 - x0), (H - 2 * pad) / (y1 - y0)); FIT = [s, W / 2 - s * (x0 + x1) / 2, H / 2 - s * (y0 + y1) / 2] } } // glints: bright sparks sliding along random edges const NG = +cv.dataset.glints || 3 let ADJ = null // vertex → neighbouring vertices, built once from the figure's edges let FIT = null // data-fit: [scale, x, y] measured over the whole play, so the loose blocks never leave the canvas const draw = (T, measure) => { if (!W) return const t = ((T % F.loop) + F.loop) % F.loop, P = F.pose(t), B = F.base, g = P.g const ry = B.ry + (P.spinY || 0), yaw = P.yaw ?? B.yaw, pitch = B.pitch, dist = B.dist, k = B.k, at = B.at || [0, 0, 0] let S = Math.min(W / 1.05, H) / 740 * (+cv.dataset.k || 1), ox = W / 2, oy = H / 2 + (+cv.dataset.dy || 0) * H // a figure ~740 units tall fills the canvas if (measure) { S = 1; ox = 0; oy = 0 } else if (FIT) [S, ox, oy] = FIT const cr = Math.cos(ry), sr = Math.sin(ry), cy = Math.cos(yaw), sy = Math.sin(yaw), cp = Math.cos(pitch), sp = Math.sin(pitch) const E0 = [0, dist * sp, -dist * cp] // the reference eye (for the register's anamorphosis) let ymin = 1e9, ymax = -1e9; g.V.forEach((v) => { ymin = Math.min(ymin, v[1]); ymax = Math.max(ymax, v[1]) }) const pts = g.V.map((v, i) => { let [x, y, z] = v if (F.arms) { const r0 = Math.hypot(x, y), arm = ARM[i] ?? 0, lag = .22 * r0 / 300 + .05 * (arm % 10) / 10 + (arm % 2 ? .06 : 0), an = -1.1 * Math.max(0, P.spin - lag) - .06 * Math.sin(P.spin * 2.6 + arm * 1.7) * r0 / 300, c = Math.cos(an), s = Math.sin(an); [x, y] = [x * c - y * s, x * s + y * c] } if (P.brk != null && g.BV && g.BV[i] >= 0) { const b = g.BK[g.BV[i]], u = cl((P.brk - b.d) / b.dur); if (u > 0) { const f = BRKE(u), ax = [b.dir[1], 0, -b.dir[0]], r = rotAx([x - b.pv[0], y - b.pv[1], z - b.pv[2]], ax, b.an * f), tr = b.tr || [0, 0, 0]; x = b.pv[0] + r[0] + tr[0] * f; y = b.pv[1] + r[1] + tr[1] * f; z = b.pv[2] + r[2] + tr[2] * f } } if (P.asm != null && g.BV && g.BV[i] >= 0) { const id = g.BV[i], b = g.BK[id], u = cl((P.asm - b.d) / b.dur), f = 1 - ASME(u) // assembles (film: o.asm) if (f > .001) { const ax = [b.dir[1], 0, -b.dir[0]], r = rotAx([x - b.pv[0], y - b.pv[1], z - b.pv[2]], ax, (b.an + .3 * Math.sin(T * .8 + id * 1.3)) * f), bob = 12 * Math.sin(T * 1.7 + id * 2.1) * Math.min(1, f * 1.5); const SP = +cv.dataset.spread || 1; x = b.pv[0] + r[0] + b.tr[0] * SP * f; y = b.pv[1] + r[1] + (b.tr[1] * SP + bob) * f; z = b.pv[2] + r[2] + SP * b.tr[2] * f } } // the figure in the world: turned by ry, scaled, placed let wx = at[0] + (x * cr + z * sr) * k, wy = at[1] + y * k, wz = at[2] + (-x * sr + z * cr) * k if (P.ana) { const f = 1 + P.ana * (F.aq[cmp[i] % F.aq.length] * 1.4 - .3); wx = E0[0] + (wx - E0[0]) * f; wy = E0[1] + (wy - E0[1]) * f; wz = E0[2] + (wz - E0[2]) * f } // the camera: yaw round the figure, then pitch down onto it const x1 = wx * cy - wz * sy, z1 = wx * sy + wz * cy, y2 = wy * cp + z1 * sp, z2 = -wy * sp + z1 * cp, q = FOC / (dist + z2) // grows from the ground up (house): each vertex pops in by its height const h = (v[1] - ymin) / ((ymax - ymin) || 1), gr = P.grow == null ? 1 : out(cl((P.grow - h * .7) / .3)) return [ox + x1 * q * S, oy - (y2 - (1 - gr) * 60) * q * S, z2, q, gr] }) if (measure) return pts const fade = P.fade ?? 1 ctx.setTransform(dpr, 0, 0, dpr, 0, 0); ctx.clearRect(0, 0, W, H); ctx.lineCap = 'round'; ctx.lineJoin = 'round' g.E.forEach(([a, b], e) => { const A = pts[a], Bp = pts[b], gr = Math.min(A[4], Bp[4]); if (gr < .02) return const depth = cl(.6 - (A[2] + Bp[2]) / 2 / 900), w = g.W ? g.W[e] ?? 1 : 1 ctx.strokeStyle = `rgba(${C.e},${((ink ? .5 : .34) + (ink ? .4 : .5) * depth) * gr * fade})`; ctx.lineWidth = Math.max(ink ? 1.4 : 1.15, 1.5 * S * 1.6 * w * (A[3] + Bp[3]) / 2) ctx.beginPath(); ctx.moveTo(A[0], A[1]); ctx.lineTo(Bp[0], Bp[1]); ctx.stroke() }) pts.forEach((p, i) => { if (p[4] < .02 || (g.nd && g.nd.has(i))) return const r = Math.max(1.2, 3.1 * S * 1.6 * p[3] * (p[4] < 1 ? 1 + 1.4 * Math.sin(Math.PI * p[4]) * (1 - p[4]) : 1)) ctx.fillStyle = `rgba(${C.d},${(.92 * fade).toFixed(3)})`; ctx.beginPath(); ctx.arc(p[0], p[1], r, 0, 6.283); ctx.fill() }) // glints as in the film («glints on the figures»): light runs along a chain of edges, corner to corner, as a crisp white // streak — a tail of 8 segments that grow wider and brighter towards the head; no blob, no flare if (!reduce) { if (!ADJ) { ADJ = g.V.map(() => []); g.E.forEach(([a, b]) => { ADJ[a].push(b); ADJ[b].push(a) }) } const now = performance.now() / 1000, hs = (n, s) => { const x = Math.sin(n * 127.1 + s * 311.7) * 43758.5453; return x - Math.floor(x) } const tail = Math.max(50, W * .16) for (let k = 0; k < NG; k++) { const D = 1.3 + hs(k, 1) * .9, ph = now / D + hs(k, 2), sl = Math.floor(ph), u = ph - sl // the route: from a random corner, keep going the straightest way for a few edges let a = Math.floor(hs(sl * 31 + k, 3) * g.V.length), prev = -1; const ch = [a] for (let hop = 0; hop < 4; hop++) { const nb = ADJ[a].filter((v) => v !== prev); if (!nb.length) break let b = nb[Math.floor(hs(sl * 7 + k + hop, 4) * nb.length)] if (prev >= 0) { const dx = pts[a][0] - pts[prev][0], dy = pts[a][1] - pts[prev][1]; let best = -2 nb.forEach((v) => { const ex = pts[v][0] - pts[a][0], ey = pts[v][1] - pts[a][1], c = (dx * ex + dy * ey) / ((Math.hypot(dx, dy) * Math.hypot(ex, ey)) || 1); if (c > best) { best = c; b = v } }) } ch.push(b); prev = a; a = b } if (ch.length < 2 || ch.some((v) => pts[v][4] < 1)) continue const P2 = ch.map((v) => pts[v]), seg = []; let L = 0; for (let i = 1; i < P2.length; i++) { const l = Math.hypot(P2[i][0] - P2[i - 1][0], P2[i][1] - P2[i - 1][1]); seg.push(l); L += l } if (L < 30) continue const head = u * (L + tail), fd = Math.min(1, u * 6, (1 - u) * 5) * fade const at = (q) => { q = Math.max(0, Math.min(L, q)); let i = 0; while (i < seg.length - 1 && q > seg[i]) { q -= seg[i]; i++ } const f = seg[i] ? Math.min(1, q / seg[i]) : 0; return [P2[i][0] + (P2[i + 1][0] - P2[i][0]) * f, P2[i][1] + (P2[i + 1][1] - P2[i][1]) * f] } for (let q = 0; q < 8; q++) { const a0 = head - tail * (1 - q / 8), a1 = head - tail * (1 - (q + 1) / 8); if (a1 < 0 || a0 > L) continue const p0 = at(a0), p1 = at(a1); ctx.strokeStyle = ink ? `rgba(${C.gl},${(.95 * fd * (q + 1) / 8).toFixed(3)})` : `rgba(255,255,255,${(.95 * fd * (q + 1) / 8).toFixed(3)})` ctx.lineWidth = 1.2 + 2.2 * (q + 1) / 8; ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.lineTo(p1[0], p1[1]); ctx.stroke() } if (head <= L && !ink) { const hp = at(head), rg = ctx.createRadialGradient(hp[0], hp[1], 0, hp[0], hp[1], 6) // the film's small head light rg.addColorStop(0, `rgba(255,255,255,${(.8 * fd).toFixed(3)})`); rg.addColorStop(1, 'rgba(255,255,255,0)'); ctx.fillStyle = rg; ctx.fillRect(hp[0] - 6, hp[1] - 6, 12, 12) } } } // words written at a vertex (the film's product blocks: g.LB), and a small flash where a block lands if (g.LB) { const fs = Math.max(W < 480 ? 9 : 13, Math.round(17 * S * 1.6)); ctx.font = `700 ${fs}px "DM Sans SB", system-ui, sans-serif`; ctx.textAlign = 'center'; ctx.textBaseline = 'middle' g.LB.forEach((l) => { const p = pts[l.v]; if (!p) return if (ink) { const w = ctx.measureText(l.t).width + fs * 1.1, h = fs * 1.75; ctx.fillStyle = '#fff'; ctx.strokeStyle = 'rgba(28,32,36,.14)'; ctx.lineWidth = 1; ctx.beginPath(); ctx.roundRect(p[0] - w / 2, p[1] - h / 2, w, h, h / 2); ctx.fill(); ctx.stroke() } if (!ink && cv.dataset.halo) { ctx.lineWidth = fs * .55; ctx.strokeStyle = `rgba(${cv.dataset.halo},.92)`; ctx.strokeText(l.t, p[0], p[1] + 1) } ctx.fillStyle = C.tx; ctx.fillText(l.t, p[0], p[1] + 1) }) } if (P.asm != null && g.BK && P.asm > 0) g.BK.forEach((b, i) => { const age = P.asm - b.d - .55 * b.dur; if (age <= 0 || age > .4) return const u = age / .4, v = g.V.findIndex((_, k) => g.BV[k] === i), p = pts[v]; if (!p) return ctx.strokeStyle = `rgba(${C.fl},${((1 - u) * .75).toFixed(3)})`; ctx.lineWidth = 1.4 for (let j = 0; j < 8; j++) { const an = j / 8 * 6.283 + i, r0 = (40 + u * 90) * S, r1 = r0 + 18 * S * (1 - u); ctx.beginPath(); ctx.moveTo(p[0] + Math.cos(an) * r0, p[1] + Math.sin(an) * r0); ctx.lineTo(p[0] + Math.cos(an) * r1, p[1] + Math.sin(an) * r1); ctx.stroke() } }) // names on the product cubes (8 vertices per cube), fading as they lock together if (F.labels && P.lab > .02) { ctx.font = `600 ${Math.max(11, Math.round(15 * S * 1.6))}px "DM Sans SB", system-ui, sans-serif`; ctx.textAlign = 'center'; ctx.textBaseline = 'middle' F.labels.forEach((name, q) => { let x = 0, y = 0; for (let i = 0; i < 8; i++) { x += pts[q * 8 + i][0]; y += pts[q * 8 + i][1] } x /= 8; y /= 8 const w = ctx.measureText(name).width + 16, h = Math.max(20, 26 * S * 1.6) ctx.globalAlpha = cl(P.lab); ctx.fillStyle = C.pill; ctx.beginPath(); ctx.roundRect(x - w / 2, y - h / 2, w, h, h / 2); ctx.fill() ctx.fillStyle = C.pt; ctx.fillText(name, x, y + 1); ctx.globalAlpha = 1 }) } } const REST = F.rest ?? F.loop - .01 // a page, not a video: the figure plays once when it scrolls into view, rests on its telling pose, // and plays again when clicked or tapped let playing = false, done = false // once it rests, the pose holds but the glints keep running while the figure is on screen let vis = false, idle = 0 const rest = () => { idle = 0; if (!done || playing || !vis || reduce) return; draw(REST); idle = requestAnimationFrame(rest) } new IntersectionObserver(([e]) => { vis = e.isIntersecting; if (vis && !idle) rest() }).observe(cv) const frame = (now) => { if (!playing) return; const t = (now - t0) / 1000; if (t >= REST) { draw(REST); playing = false; done = true; rest(); return } draw(t); requestAnimationFrame(frame) } const play = () => { if (reduce || playing) return; t0 = performance.now(); playing = true; requestAnimationFrame(frame) } new ResizeObserver(() => { size(); draw(reduce || done ? REST : 0) }).observe(cv) new IntersectionObserver(([e], o) => { if (e.isIntersecting) { play(); o.disconnect() } }, { threshold: .45 }).observe(cv) cv.addEventListener('click', () => { if (done) play() }) size(); draw(reduce ? REST : 0) } })() /*@@SBL-NEXT-SCRIPT@@*/ (() => { const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches const $ = (s, r = document) => r.querySelector(s), $$ = (s, r = document) => [...r.querySelectorAll(s)] /* the page uses the site's own Navbar; the landing's header and its scroll state are not here */ /* hero */ SweedHero($('#flow')) /* reveal */ const io = new IntersectionObserver((es) => es.forEach((e) => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target) } }), { rootMargin: '0px 0px -10% 0px' }) $$('.rv').forEach((el) => io.observe(el)) /* ── wire figures from the film ── */ $$('canvas.wire').forEach((cv) => SweedSolid(cv, cv.dataset.solid)) /* ── the jigsaw plays when it comes into view ── */ $$('.askb').forEach((el) => new IntersectionObserver(([e], o) => { if (e.isIntersecting) { el.classList.add('go'); o.disconnect() } }, { threshold: .4 }).observe(el)) /* ── the Brains: list ↔ panel, arrows, arrow keys ── */ ;(() => { const bx = $('.bxw'); if (!bx) return const tabs = [...bx.querySelectorAll('[role=tab]')], ps = [...bx.querySelectorAll('[role=tabpanel]')]; let k = tabs.findIndex((t) => t.getAttribute('aria-selected') === 'true') const show = (n, focus) => { const k0 = k; k = (n + tabs.length) % tabs.length const dir = Math.sign(n - k0) || 1; tabs.forEach((t, i) => { const on = i === k; t.setAttribute('aria-selected', on); t.tabIndex = on ? 0 : -1 }) ps.forEach((p, i) => { p.hidden = i !== k; if (i === k) { p.classList.remove('go'); p.style.setProperty('--dx', (28 * dir) + 'px'); void p.offsetWidth; p.classList.add('go') } }) if (focus) tabs[k].focus(); if (matchMedia('(max-width:900px)').matches) tabs[k].scrollIntoView({ block: 'nearest', inline: 'center', behavior: 'smooth' }) } tabs.forEach((t, i) => { t.addEventListener('click', () => show(i)); t.addEventListener('keydown', (e) => { const d = { ArrowDown: 1, ArrowRight: 1, ArrowUp: -1, ArrowLeft: -1 }[e.key]; if (d) { e.preventDefault(); show(k + d, true) } }) }) bx.querySelectorAll('.bxa').forEach((b) => b.addEventListener('click', () => show(k + +b.dataset.d))) })() /* ── the network box covers its section (16:9, cropped like background-size:cover) ── */ $$('section.live').forEach((lv) => { const cv = $('.ground canvas', lv); if (!cv) return const g = cv.getContext('2d'); let W = 0, H = 0, on = false, last = 0, t0 = performance.now() const fit = () => { const r = lv.getBoundingClientRect(); W = cv.width = 160; H = cv.height = Math.max(40, Math.round(160 * r.height / r.width)) } const blob = (x, y, r, c, a) => { const q = g.createRadialGradient(x, y, 0, x, y, r); q.addColorStop(0, `rgba(${c},${a})`); q.addColorStop(.5, `rgba(${c},${(a * .42).toFixed(3)})`); q.addColorStop(1, `rgba(${c},0)`); g.fillStyle = q; g.fillRect(0, 0, W, H) } const paint = (T) => { const k = W / 1920 g.fillStyle = '#03221F'; g.fillRect(0, 0, W, H) blob((1450 + 220 * Math.cos(T * .17)) * k, (120 + 140 * Math.sin(T * .13)) * k, 1150 * k, '30,140,120', .34) blob((360 + 200 * Math.sin(T * .15 + 1)) * k, H - 100 * k, 900 * k, '8,70,62', .5) blob(W / 2, H / 2, 700 * k, '20,110,96', .12) } const loop = (now) => { if (!on) return; if (now - last > 66) { last = now; paint((now - t0) / 1000) } requestAnimationFrame(loop) } new ResizeObserver(() => { fit(); paint((performance.now() - t0) / 1000) }).observe(lv) new IntersectionObserver(([e]) => { const was = on; on = e.isIntersecting && !reduce; if (on && !was) requestAnimationFrame(loop) }).observe(lv) }) /* ── the moving ground runs only while its section is on screen; the capability cards come in together ── */ { $$('section.live').forEach((lv) => new IntersectionObserver(([e]) => lv.classList.toggle('off', !e.isIntersecting)).observe(lv)) const c6 = $('.caps6'); if (c6) new IntersectionObserver(([e], o) => { if (e.isIntersecting) { c6.classList.add('go'); o.disconnect() } }, { threshold: .25 }).observe(c6) } /* ── product cards: their parts rise in, bars fill, chart lines draw, when the card comes into view ── */ $$('.pc').forEach((pc) => { let i = 0; pc.querySelectorAll('.bar-top,.hd,.row,.ins,tr,.io2 li,.bars>div,.lim,.two>div,.ask,.chart,.f').forEach((el) => { el.classList.add('a'); el.style.setProperty('--i', i++) }) }) { const po = new IntersectionObserver((es) => es.forEach((e) => { if (e.isIntersecting) { e.target.classList.add('go'); po.unobserve(e.target) } }), { threshold: .3 }); $$('.pc').forEach((el) => po.observe(el)) } })() /*@@SBL-NEXT-SCRIPT@@*/ window.FILM = true /*@@SBL-NEXT-SCRIPT@@*/ // The Sweed Brain video ground, as in the main film: dark green #03221F, one soft light drifting at the top right, // a deeper pool at the bottom left, and a slow diagonal sheen sweeping across every 9 s. // SweedBG(ctx, T) paints the whole 1920×1080 canvas for time T (seconds). Pure function of T, so renders repeat exactly. // In the spec page every frame paints it under its own network on the page clock; in film.html (window.FILM) // the frames' network canvases stay transparent and one canvas behind them is painted on film time. function SweedBG(g, T) { if (T == null) T = performance.now() / 1000 g.clearRect(0, 0, 1920, 1080) if (window.FILM && !g.canvas.dataset.ground) return g.fillStyle = '#03221F'; g.fillRect(0, 0, 1920, 1080) const blob = (x, y, r, c, a) => { const q = g.createRadialGradient(x, y, 0, x, y, r) q.addColorStop(0, `rgba(${c},${a})`); q.addColorStop(.5, `rgba(${c},${(a * .42).toFixed(3)})`); q.addColorStop(1, `rgba(${c},0)`) g.fillStyle = q; g.fillRect(0, 0, 1920, 1080) } blob(1450 + 220 * Math.cos(T * .17), 120 + 140 * Math.sin(T * .13), 1150, '30,140,120', .34) blob(360 + 200 * Math.sin(T * .15 + 1), 980, 900, '8,70,62', .5) blob(960, 560, 700, '20,110,96', .12) const u = ((T / 9) % 1 + 1) % 1, x = -900 + u * 3700, sh = g.createLinearGradient(x - 420, 0, x + 420, 260) sh.addColorStop(0, 'rgba(190,255,235,0)'); sh.addColorStop(.5, `rgba(190,255,235,${(.075 * Math.sin(Math.PI * u)).toFixed(3)})`); sh.addColorStop(1, 'rgba(190,255,235,0)') g.fillStyle = sh; g.fillRect(0, 0, 1920, 1080) } /*@@SBL-NEXT-SCRIPT@@*/ (() => { const FPS = 30, DUR = 7, START = 48; const ease = { out: (p) => 1 - Math.pow(1 - p, 5), io: (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2, sine: (p) => -(Math.cos(Math.PI * p) - 1) / 2 }; const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v)); const $ = (id) => document.getElementById(id); /* ── icons ── */ const I = { sales: '', customers: '', orders: '', inventory: '', events: '', campaigns: '', products: '', stock: '', messages: '', promotions: '', loyalty: '', operations: '' }; const svg = (k) => ``; /* ── widget bodies ── */ const bar = (pct, c) => ``; const spark = (pts, c) => { const w = 348, h = 58, mx = Math.max(...pts), mn = Math.min(...pts); const xy = pts.map((v, i) => [i * w / (pts.length - 1), h - 4 - (v - mn) / (mx - mn) * (h - 10)]); const d = xy.map((p, i) => (i ? 'L' : 'M') + p[0].toFixed(1) + ' ' + p[1].toFixed(1)).join(' '); const [lx, ly] = xy[xy.length - 1]; return ``; }; const donut = (parts) => { const r = 38, C = 2 * Math.PI * r; let off = 0; const arcs = parts.map(([v, c]) => { const s = ``; off += v / 100 * C; return s }).join(''); return `${arcs}486orders`; }; const bars = (hs, c, last) => `${hs.map((v, i) => ``).join('')}`; const heat = () => { let s = ''; for (let d = 0; d < 6; d++) for (let h = 0; h < 12; h++) { const peak = Math.exp(-Math.pow(h - 8.5, 2) / 5) * (d >= 4 ? 1 : .65), noise = ((d * 7 + h * 13) % 5) / 25; s += ``; } return `${s}`; }; const st = (txt, bg, fg) => `${txt}`; const SRC = [ { k: 'sales', t: 'Sales', p: 'This week', c: '#10b981', w: 400, b: `
$47.8Knet sales↗ 3.1%
${spark([30, 33, 31, 36, 35, 41, 39, 45, 44, 50, 53, 58], '#10b981')}` }, { k: 'customers', t: 'Customers', p: 'This month', c: '#8b5cf6', w: 400, b: `
Loyal ${bar(82, '#7c4dff')}1,284
New ${bar(34, '#7c4dff')}312
At risk ${bar(14, '#f5b301')}96
` }, { k: 'orders', t: 'Orders', p: 'Today', c: '#3b82f6', w: 380, b: `
${donut([[54, '#3b82f6'], [31, '#93c5fd'], [15, '#c7d2fe']])}
Pickup54%
Delivery31%
In-store15%
` }, { k: 'inventory', t: 'Inventory', p: 'On hand', c: '#f59e0b', w: 380, b: `
Blue Dream 3.5g128
Mango gummies42
Pre-roll 5-pack${st('Low', '#fff4d6', '#b7791f')}6
` }, { k: 'events', t: 'Events', p: 'Live', c: '#ec4899', w: 400, b: `
Checkout Hartfordnow
Cart add Stamford12s
Sign-up Northleaf40s
` }, { k: 'campaigns', t: 'Campaigns', p: 'Spring drop', c: '#f97316', w: 400, b: `
$12.4Kof $17K goal72%
${bar(72, '#f97316')}
8,420 sent · 1,180 clicks
` }, { k: 'products', t: 'Products', p: 'Top sellers', c: '#06b6d4', w: 400, b: `
1Blue Dream 3.5g ${bar(90, '#06b6d4')}412
2Mango gummies ${bar(68, '#06b6d4')}308
3OG vape 1g ${bar(52, '#06b6d4')}236
` }, { k: 'stock', t: 'Stock', p: 'Transfers', c: '#6366f1', w: 380, b: `
Hartford → Stamford24
Northleaf → Hartford18
Stamford → Northleaf9
` }, { k: 'messages', t: 'Messages', p: 'Last 30 days', c: '#ef4444', w: 400, b: `
38%open rate
${bars([40, 58, 48, 70, 62, 45, 55, 78, 60, 52, 66, 86], '#fdba9a', '#f97340')}` }, { k: 'promotions', t: 'Promotions', p: 'Active', c: '#d946ef', w: 380, b: `
Happy hour${st('Live', '#e3f6ea', '#1f9d55')}
Birthday reward${st('Ends Sun', '#fff4d6', '#b7791f')}
Win-back 15%${st('Scheduled', '#e6efff', '#2f6fdd')}
` }, { k: 'loyalty', t: 'Loyalty', p: 'This month', c: '#eab308', w: 400, b: `
84.2Kpoints issued
Gold 18%Silver 34%Bronze 48%
` }, { k: 'operations', t: 'Operations', p: 'Peak Fri 6 pm', c: '#65a30d', w: 400, b: heat() } ]; const card = (s, extra = '') => `
${svg(s.k)}${s.t}${s.p}
${s.b}
`; /* ── stage: title words ── */ const L1 = 'Brain connects what’s happening'.split(' '), L2 = 'across your business'.split(' '); $('title').innerHTML = L1.map((w) => `${w}`).join(' ') + '
' + L2.map((w) => `${w}`).join(' ') + ''; const words = [...$('title').querySelectorAll('span')].filter((s) => !s.classList.contains('l2')); /* ── stage: rows ── */ const GAP = 24, A = 420, H = 200; const ROWS = [{ top: 540, v: -60, off: 40, items: SRC.slice(0, 6) }, { top: 768, v: 48, off: -180, items: SRC.slice(6) }]; const cardsEl = $('cards'), CARDS = []; ROWS.forEach((row, ri) => { let x = 0; row.L = row.items.reduce((a, s) => a + s.w + GAP, 0); row.items.forEach((s) => { const el = document.createElement('div'); el.className = 'vs-card'; el.innerHTML = card(s); cardsEl.appendChild(el); CARDS.push({ s, el, vc: el.firstChild, row, ri, base: x }); x += s.w + GAP; }); }); const posX = (c, t) => { const L = c.row.L, raw = c.base + c.row.v * t + c.row.off + A; return ((raw % L) + L) % L - A }; const cx = (c, t) => posX(c, t) + c.s.w / 2; /* timings: appear ripple left→right, connect closest-to-centre first */ const T_CONNECT = 1.6, STEP = .12, DRAW = .45; CARDS.forEach((c) => { const x0 = posX(c, 0); c.tA = (x0 + c.s.w < 0 || x0 > 1920) ? 0 : .45 + c.ri * .12 + clamp(x0 / 1920) * .6; c.tVis = Infinity; for (let f = 0; f <= DUR * FPS; f++) { const t = f / FPS, m = cx(c, t); if (m > 140 && m < 1780) { c.tVis = t; break } } }); const ranked = CARDS.filter((c) => c.tVis <= T_CONNECT).sort((a, b) => Math.abs(cx(a, T_CONNECT) - 960) - Math.abs(cx(b, T_CONNECT) - 960)); ranked.forEach((c, i) => c.tc = T_CONNECT + i * STEP); CARDS.forEach((c) => { if (c.tc == null) c.tc = c.tVis < DUR ? Math.max(T_CONNECT + ranked.length * STEP, c.tVis) : Infinity; c.ta = c.tc + DRAW }); /* background network (seeded, deterministic) */ let seed = 7; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647; const NODES = Array.from({ length: 0 }, () => ({ x: rnd() * 1920, y: rnd() * 1080, ph: rnd() * 6.28, r: 1 + rnd() * 2.2 })); const hexA = (h, a) => { const n = parseInt(h.slice(1), 16); return `rgba(${n >> 16},${(n >> 8) & 255},${n & 255},${a})` }; const BX = 960, BY = 370; const bez = (p, u) => { const m = 1 - u; return [m * m * m * p[0] + 3 * m * m * u * p[2] + 3 * m * u * u * p[4] + u * u * u * p[6], m * m * m * p[1] + 3 * m * m * u * p[3] + 3 * m * u * u * p[5] + u * u * u * p[7]] }; const net = $('net'), g = net.getContext('2d'); function draw(t) { SweedBG(g); // network const P = NODES.map((n) => [n.x + Math.sin(t * .25 + n.ph) * 18, n.y + Math.cos(t * .2 + n.ph) * 14, n.r]); g.lineWidth = 1; for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const dx = P[i][0] - P[j][0], dy = P[i][1] - P[j][1], d = Math.hypot(dx, dy); if (d < 250) { g.strokeStyle = `rgba(145,225,221,${(.13 * (1 - d / 250)).toFixed(3)})`; g.beginPath(); g.moveTo(P[i][0], P[i][1]); g.lineTo(P[j][0], P[j][1]); g.stroke() } } P.forEach((p) => { g.fillStyle = 'rgba(170,235,228,.35)'; g.beginPath(); g.arc(p[0], p[1], p[2], 0, 6.283); g.fill() }); } /* render a moment (pure function of t → scrubbable) */ const scene = $('scene'), brain = $('brain'), halo = $('halo'); function render(t) { scene.style.transform = `scale(${(1 + .035 * ease.sine(t / DUR)).toFixed(4)})`; words.forEach((w, i) => { const s = i < L1.length ? i * .06 : .25 + (i - L1.length) * .06, e = ease.out(clamp((t - s) / .6)); w.style.opacity = e.toFixed(3); w.style.transform = `translateY(${((1 - e) * 28).toFixed(1)}px)` }); CARDS.forEach((c) => { const e = ease.out(clamp((t - c.tA) / .6)); c.el.style.opacity = e.toFixed(3); c.el.style.transform = `translate(${posX(c, t).toFixed(1)}px,${(c.row.top + (1 - e) * 60).toFixed(1)}px) scale(${(.96 + .04 * e).toFixed(4)})`; const on = t >= c.ta; if (on !== c.on) { c.on = on; c.vc.classList.toggle('on', on) } }); let pulse = 0; CARDS.forEach((c) => { if (t >= c.ta) pulse += Math.exp(-(t - c.ta) * 6) }); pulse = Math.min(1, pulse); const eb = ease.out(clamp((t - 1.1) / .5)); brain.style.opacity = eb.toFixed(3); brain.style.transform = `scale(${((.7 + .3 * eb) * (1 + .06 * pulse)).toFixed(4)})`; halo.style.opacity = (eb * (.45 + .45 * pulse)).toFixed(3); draw(t); } /* player: loops on its own */ let t = 0, last = 0; const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) t = 4; function loop(now) { const dt = last ? (now - last) / 1000 : 0; last = now; if (!reduce) { t += dt; if (t >= DUR) t = 0 } render(t); requestAnimationFrame(loop); } /* fit 1920 stage into the viewport */ const vp = $('vp'), stage = $('stage'); new ResizeObserver(() => { stage.style.transform = `scale(${vp.clientWidth / 1920})` }).observe(vp); window.VS = { svg }; (window.FR = window.FR || []).push({ stage, DUR, render }); })(); /*@@SBL-NEXT-SCRIPT@@*/ /* ── frame 0:55: forecast vs actual → Brain keeps the wins, drops the misses ── */ (() => { const FPS = 30, DUR = 8, $ = (id) => document.getElementById(id); const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v)); const out = (p) => 1 - Math.pow(1 - p, 5), io = (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2, inC = (p) => p * p * p; const svg = window.VS.svg; const PLANS = [ { t: 'Columbus Day weekend: edibles', ic: 'promotions', c: '#d946ef', lo: 6, hi: 9, act: 7.2, side: -1, y: 480 }, { t: 'Sell aging pre-rolls in NJ', ic: 'inventory', c: '#f59e0b', lo: 4, hi: 6, act: 2.6, side: 1, y: 600 }, { t: 'Birthday messages', ic: 'messages', c: '#ef4444', lo: 3, hi: 4, act: 4.4, side: -1, y: 720 }, { t: 'Match market prices', ic: 'sales', c: '#10b981', lo: 5, hi: 7, act: 6.8, side: 1, y: 840 } ]; const W = 640, H = 210, GAP = 140; const wrap = $('f2cards'); PLANS.forEach((p, i) => { p.win = p.act >= p.lo; p.s = 1 + i * 1.5; p.max = p.hi * 1.45; p.cx = 960 + p.side * (GAP + W / 2); const el = document.createElement('div'); el.className = 'lc'; el.style.setProperty('--c', p.c); el.innerHTML = `
${svg(p.ic)}${p.t}Running
Forecast $${p.lo}–${p.hi}k est.
+$0.0kBrought in
${p.win ? 'Learned' : 'Dropped'}`; wrap.appendChild(el); p.el = el; p.st = el.querySelector('.lc-st'); p.bar = el.querySelector('.lc-act'); p.num = el.querySelector('.lc-num'); p.stamp = el.querySelector('.lc-stamp'); }); const T = { enter: .5, fill: .8, hold: .45, exit: .6 }; PLANS.forEach((p) => { p.tFill = p.s + T.enter; p.tV = p.tFill + T.fill; p.tX = p.tV + T.hold; p.tEnd = p.tX + T.exit }); $('f2title').innerHTML = 'Learns how you operate'.split(' ').map((w) => `${w}`).join(' '); const words = [...$('f2title').querySelectorAll('span')]; let seed = 11; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647; const NODES = Array.from({ length: 0 }, () => ({ x: rnd() * 1920, y: rnd() * 1080, ph: rnd() * 6.28, r: 1 + rnd() * 2 })); const g = $('f2net').getContext('2d'), BX = 960, BY = 250, LINE0 = 320; function draw(t, eb) { const T_ = t; SweedBG(g); const P = NODES.map((n) => [n.x + Math.sin(t * .25 + n.ph) * 18, n.y + Math.cos(t * .2 + n.ph) * 14, n.r]); g.lineWidth = 1; for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const d = Math.hypot(P[i][0] - P[j][0], P[i][1] - P[j][1]); if (d < 240) { g.strokeStyle = `rgba(145,225,221,${(.11 * (1 - d / 240)).toFixed(3)})`; g.beginPath(); g.moveTo(P[i][0], P[i][1]); g.lineTo(P[j][0], P[j][1]); g.stroke() } } P.forEach((p) => { g.fillStyle = 'rgba(170,235,228,.3)'; g.beginPath(); g.arc(p[0], p[1], p[2], 0, 6.283); g.fill() }); // the timeline: grows down from Brain, pulses travel up into it const len = (1080 - LINE0) * io(clamp((t - .5) / .7)); if (len > 0) { const gr = g.createLinearGradient(0, LINE0, 0, 1080); gr.addColorStop(0, 'rgba(232,110,255,.95)'); gr.addColorStop(.6, 'rgba(120,110,255,.6)'); gr.addColorStop(1, 'rgba(120,110,255,0)'); g.save(); g.shadowColor = '#c46bff'; g.shadowBlur = 16; g.strokeStyle = gr; g.lineWidth = 4; g.beginPath(); g.moveTo(BX, LINE0); g.lineTo(BX, LINE0 + len); g.stroke(); g.restore(); for (let k = 0; k < 7; k++) { const y = 1080 - (((t * 150) + k * 110) % 770); if (y > LINE0 + len || y < LINE0) continue; g.fillStyle = `rgba(255,220,255,${(.25 + .5 * (1 - (y - LINE0) / 760)).toFixed(2)})`; g.beginPath(); g.arc(BX, y, 2.5, 0, 6.283); g.fill() } } PLANS.forEach((p) => { const t = LT(p, T_) if (t < p.s || t > p.tEnd + .3) return; const a = clamp((t - p.s) / .3) * (1 - clamp((t - p.tX) / .5)); const col = t < p.tV ? '179,155,255' : p.win ? '74,222,128' : '248,113,113'; const edge = 960 + p.side * GAP; g.strokeStyle = `rgba(${col},${(.7 * a).toFixed(2)})`; g.lineWidth = 2; g.setLineDash([6, 8]); g.beginPath(); g.moveTo(BX + p.side * 12, p.y); g.lineTo(BX + (edge - BX) * clamp((t - p.s) / .35), p.y); g.stroke(); g.setLineDash([]); g.save(); g.shadowColor = `rgb(${col})`; g.shadowBlur = 18; g.fillStyle = `rgba(${col},${a.toFixed(2)})`; g.beginPath(); g.arc(BX, p.y, 9, 0, 6.283); g.fill(); g.restore(); if (p.win && t >= p.tX && t <= p.tEnd) { const q = inC((t - p.tX) / T.exit), y = p.y + (LINE0 - p.y) * q; g.save(); g.shadowColor = '#4ade80'; g.shadowBlur = 20; g.fillStyle = '#d9ffe6'; g.beginPath(); g.arc(BX, y, 7, 0, 6.283); g.fill(); g.restore() } }); } const scene = $('f2scene'), brain = $('f2brain'), halo = $('f2halo'), cW = $('f2win'), cL = $('f2loss'); const CYC = 6, LT = (p, t) => t < p.s ? t : p.s + ((t - p.s) % CYC), RUNS = (p, t) => t < p.s ? 0 : Math.floor((t - p.s) / CYC) function render(t) { const T_ = t scene.style.transform = `scale(${(1 + .03 * (-(Math.cos(Math.PI * t / DUR) - 1) / 2)).toFixed(4)})`; words.forEach((w, i) => { const e = out(clamp((t - i * .06) / .6)); w.style.opacity = e.toFixed(3); w.style.transform = `translateY(${((1 - e) * 28).toFixed(1)}px)` }); const eb = out(clamp((t - .35) / .5)); let pulse = 0, nW = 0, nL = 0, bW = 0, bL = 0; PLANS.forEach((p) => { const t = LT(p, T_), k = RUNS(p, T_); if (p.win) nW += k; else nL += k if (p.win && t >= p.tEnd) { nW++; pulse += Math.exp(-(t - p.tEnd) * 6); bW = Math.max(bW, Math.exp(-(t - p.tEnd) * 7)) } if (!p.win && t >= p.tX) { nL++; bL = Math.max(bL, Math.exp(-(t - p.tX) * 7)) } }); pulse = Math.min(1, pulse); brain.style.opacity = eb.toFixed(3); brain.style.transform = `scale(${((.7 + .3 * eb) * (1 + .08 * pulse)).toFixed(4)})`; halo.style.opacity = (eb * (.4 + .5 * pulse)).toFixed(3); const ec = out(clamp((t - .6) / .5)); [[cW, nW, bW, 1], [cL, nL, bL, -1]].forEach(([el, n, b, d]) => { el.style.opacity = ec.toFixed(3); el.style.transform = `translateX(${((1 - ec) * -30 * d).toFixed(1)}px) scale(${(1 + .1 * b).toFixed(3)})` }); $('f2winN').textContent = nW; $('f2lossN').textContent = nL; PLANS.forEach((p) => { const t = LT(p, T_) const e = out(clamp((t - p.s) / T.enter)), f = io(clamp((t - p.tFill) / T.fill)), v = t >= p.tV; p.el.classList.toggle('win', v && p.win); p.el.classList.toggle('loss', v && !p.win); p.st.textContent = v ? (p.win ? 'Hit forecast' : 'Missed forecast') : 'Running'; p.bar.style.width = (p.act / p.max * 100 * f).toFixed(2) + '%'; p.num.textContent = '+$' + (p.act * f).toFixed(1) + 'k'; const sp = clamp((t - p.tV) / .25); p.stamp.style.opacity = sp.toFixed(3); p.stamp.style.transform = `rotate(${p.win ? 10 : -10}deg) scale(${(1.6 - .6 * out(sp)).toFixed(3)})`; let x = p.cx + p.side * (1 - e) * 90, y = p.y, r = 0, s = .96 + .04 * e, o = e, gs = 0; const tilt = clamp((t - p.tV - .1) / .3); r = (p.win ? -p.side : p.side) * 5 * out(tilt); if (t >= p.tX) { const q = inC(clamp((t - p.tX) / T.exit)); if (p.win) { x += (BX - x) * q; y += (BY - y) * q; s *= 1 - .88 * q; r *= 1 - q; o = 1 - q * q } else { x += p.side * 560 * q; y += 160 * q; r = p.side * (5 + 16 * q); o = 1 - q; gs = q } } if (t < p.s) o = 0; p.el.style.opacity = o.toFixed(3); p.el.style.filter = gs ? `grayscale(${gs.toFixed(2)})` : ''; p.el.style.transform = `translate(${(x - W / 2).toFixed(1)}px,${(y - H / 2).toFixed(1)}px) rotate(${r.toFixed(2)}deg) scale(${s.toFixed(4)})`; }); draw(t, eb); } let t = 0, last = 0; const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) t = 7.9; function loop(now) { const dt = last ? (now - last) / 1000 : 0; last = now; if (!reduce) { t += dt; if (t >= DUR) t = 0 } render(t); requestAnimationFrame(loop) } const vp = $('f2vp'), stage = $('f2stage'); new ResizeObserver(() => { stage.style.transform = `scale(${vp.clientWidth / 1920})` }).observe(vp); (window.FR = window.FR || []).push({ stage, DUR, render }); })(); /*@@SBL-NEXT-SCRIPT@@*/ /* ── frame 0:58: Brain scans stores vs market (matrix) + small white market map ── */ (() => { const DUR = 5, $ = (id) => document.getElementById(id); const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v)); const out = (p) => 1 - Math.pow(1 - p, 5), io = (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2; const COLS = ['Sales growth', 'Gross margin', 'Basket', 'Customer growth', 'Repeat rate', 'Online share']; // value, tone (-2 behind … 2 ahead), flagged const ROWS = [ ['Newark', 'NJ', [['-5.5%', -2, 1], ['60.7%', 2], ['$70.80', 2], ['2.8%', -2, 1], ['59.6%', 1], ['52.6%', 1]]], ['Jersey City', 'NJ', [['-5.5%', -2, 1], ['60.5%', 2], ['$67.47', 2], ['9.8%', -2, 1], ['55.6%', 0], ['48.2%', 1]]], ['Logan Square', 'IL', [['2.0%', -2, 1], ['33.3%', -2, 1], ['$67.10', 2], ['0.5%', -2, 1], ['50.5%', -2], ['53.4%', 1]]], ['Wicker Park', 'IL', [['22.0%', 0], ['34.3%', -2, 1], ['$52.93', -1], ['26.0%', 0], ['58.5%', 1], ['49.0%', 1]]], ['River North', 'IL', [['30.0%', 1], ['36.5%', -1], ['$47.91', -2, 1], ['37.3%', 2], ['54.5%', -1], ['62.6%', 2]]], ['Lakeview', 'IL', [['127.7%', 2], ['39.3%', 0], ['$45.63', -2, 1], ['141.2%', 2], ['50.6%', -2], ['58.3%', 2]]], ['Hoboken', 'NJ', [['-15.4%', -2, 1], ['57.1%', 2], ['$53.37', -1], ['-7.6%', -2, 1], ['51.6%', -1], ['43.8%', 0]]] ]; const BG = { '-2': '#f9d3da', '-1': '#fce9ec', '0': '#f1f1f3', '1': '#edf6ef', '2': '#dcefe1' }; const FILL = { '-2': .06, '-1': .25, '0': .55, '1': .7, '2': .9 }; const BAR = (tone) => tone < 0 ? '#e5484d' : tone > 0 ? '#4caf6e' : '#6b6e7b'; const grid = $('f3grid'); grid.innerHTML = '' + COLS.map((c) => `${c}`).join('') + ROWS.map(([n, st, cells]) => `${n}${st}` + cells.map(([v, tone]) => `${v}`).join('')).join('') + ''; const cells = [...grid.querySelectorAll('.mx-c')].map((el, k) => { const r = Math.floor(k / 6), c = k % 6, d = ROWS[r][2][c]; return { el, c, tone: d[1], flag: !!d[2], bar: el.querySelector('i') } }); const band = $('f3band'); // column centres in grid px (grid width = 1290 - 64) const GW = 1226, CW = (GW - 200 - 6 * 8) / 6, colX = (c) => 200 + 8 + c * (CW + 8) + CW / 2; const X0 = 200, X1 = GW + 20; const PASS1 = [1.0, 3.0], PASS2 = [3.15, 4.85]; const bandX = (t) => { if (t > PASS2[0]) t = PASS2[0] + ((t - PASS2[0]) % (PASS2[1] - PASS2[0] + .5)); for (const [a, b] of [PASS1, PASS2]) if (t >= a && t <= b) return X0 + (X1 - X0) * io((t - a) / (b - a)); return null }; const tHit = (c) => PASS1[0] + (PASS1[1] - PASS1[0]) * inv((colX(c) - X0) / (X1 - X0)); function inv(y) { let lo = 0, hi = 1; for (let i = 0; i < 30; i++) { const m = (lo + hi) / 2; io(m) < y ? lo = m : hi = m } return lo } cells.forEach((k) => { k.tH = tHit(k.c) }); $('f3title').innerHTML = 'Watches the market'.split(' ').map((w) => `${w}`).join(' ') + '
' + 'and competitors'.split(' ').map((w) => `${w}`).join(' ') + ''; const words = [...$('f3title').querySelectorAll('span')].filter((s) => !s.classList.contains('l2')); /* small white map */ const MW = 382, MH = 594, mg = $('f3map').getContext('2d'); mg.scale(2, 2); const SHORE = [[292, 0], [300, 90], [286, 170], [292, 250], [282, 320], [296, 390], [318, 470], [340, 570]]; const shoreX = (y) => { for (let i = 1; i < SHORE.length; i++) if (y <= SHORE[i][1]) { const [x0, y0] = SHORE[i - 1], [x1, y1] = SHORE[i]; return x0 + (x1 - x0) * (y - y0) / (y1 - y0) } return 340 }; const PLACES = [['Evanston', 262, 92], ['Skokie', 210, 128], ['Schaumburg', 78, 160], ['Oak Park', 168, 352], ['Naperville', 82, 452], ['Joliet', 128, 545], ['Oak Lawn', 228, 470]]; const OWN = [[208, 262], [228, 292], [262, 318], [266, 236], [262, 112]]; let seed = 41; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647; const gauss = () => { let u = 0; for (let i = 0; i < 4; i++) u += rnd(); return (u - 2) / .58 }; const COMP = []; while (COMP.length < 38) { const near = COMP.length < 24, x = near ? 230 + gauss() * 55 : 20 + rnd() * 260, y = near ? 300 + gauss() * 90 : 30 + rnd() * 520; if (x < 14 || x > shoreX(y) - 12 || y < 14 || y > MH - 14) continue; if (OWN.some(([ox, oy]) => Math.hypot(ox - x, oy - y) < 16) || COMP.some((c) => Math.hypot(c.x - x, c.y - y) < 13)) continue; COMP.push({ x, y, tA: .9 + rnd() * .5 }); } const R0 = 1.3, PER = 2.2, RMAX = 420; COMP.forEach((c) => { c.tLit = R0 + Math.min(...OWN.map(([ox, oy]) => Math.hypot(ox - c.x, oy - c.y))) / RMAX * PER }); function drawMap(t) { mg.clearRect(0, 0, MW, MH); mg.fillStyle = '#f3f4f7'; mg.fillRect(0, 0, MW, MH); mg.beginPath(); mg.moveTo(SHORE[0][0], 0); SHORE.forEach(([x, y]) => mg.lineTo(x, y)); mg.lineTo(MW, MH); mg.lineTo(MW, 0); mg.closePath(); mg.fillStyle = '#dbe9f7'; mg.fill(); mg.strokeStyle = '#ffffff'; mg.lineWidth = 1; for (let x = 12; x < MW; x += 22) { mg.beginPath(); for (let y = 0; y <= MH; y += 10) { x < shoreX(y) ? mg.lineTo(x, y) : mg.moveTo(x, y) } mg.stroke() } for (let y = 12; y < MH; y += 22) { mg.beginPath(); mg.moveTo(0, y); mg.lineTo(shoreX(y), y); mg.stroke() } mg.strokeStyle = '#d3d6df'; mg.lineWidth = 2.5; [[40, 120], [0, 330], [130, 570], [280, 0], [210, 0], [270, 570], [0, 220]].forEach(([x, y]) => { mg.beginPath(); mg.moveTo(270, 330); mg.quadraticCurveTo((270 + x) / 2 + 12, (330 + y) / 2 - 8, x, y); mg.stroke() }); mg.font = '500 12px "DM Sans SB",system-ui,sans-serif'; mg.fillStyle = '#8a8d99'; mg.textAlign = 'center'; PLACES.forEach(([n, x, y]) => mg.fillText(n, x, y + 20)); mg.font = 'italic 500 12px "DM Sans SB",system-ui,sans-serif'; mg.fillStyle = '#6e93bb'; mg.fillText('Lake Michigan', 338, 200); if (t > R0) OWN.forEach(([x, y]) => { for (let k = 0; k < 2; k++) { if (k && t - R0 < PER / 2) continue; const ph = ((t - R0) / PER + k * .5) % 1; mg.strokeStyle = `rgba(124,92,240,${(.35 * (1 - ph)).toFixed(3)})`; mg.lineWidth = 1.5; mg.beginPath(); mg.arc(x, y, ph * RMAX, 0, 6.283); mg.stroke() } }); COMP.forEach((c) => { const a = clamp((t - c.tA) / .3); if (!a) return; const lit = clamp((t - c.tLit) / .25); mg.fillStyle = `rgba(${lit ? '18,19,24' : '160,163,176'},${(a * (.55 + .4 * lit)).toFixed(2)})`; mg.beginPath(); mg.arc(c.x, c.y, 3.6 + .8 * lit, 0, 6.283); mg.fill() }); OWN.forEach(([x, y], i) => { const a = out(clamp((t - .8 - i * .08) / .4)); if (!a) return; const r = 8 * (.5 + .5 * a); mg.fillStyle = '#7c5cf0'; mg.beginPath(); mg.arc(x, y, r, 0, 6.283); mg.fill(); mg.strokeStyle = '#fff'; mg.lineWidth = 2.5; mg.stroke() }); } /* background network, as in the other frames */ seed = 5; const NODES = Array.from({ length: 0 }, () => ({ x: rnd() * 1920, y: rnd() * 1080, ph: rnd() * 6.28, r: 1 + rnd() * 2 })); const ng = $('f3net').getContext('2d'); function drawNet(t) { SweedBG(ng); const P = NODES.map((n) => [n.x + Math.sin(t * .25 + n.ph) * 18, n.y + Math.cos(t * .2 + n.ph) * 14, n.r]); ng.lineWidth = 1; for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const d = Math.hypot(P[i][0] - P[j][0], P[i][1] - P[j][1]); if (d < 240) { ng.strokeStyle = `rgba(145,225,221,${(.11 * (1 - d / 240)).toFixed(3)})`; ng.beginPath(); ng.moveTo(P[i][0], P[i][1]); ng.lineTo(P[j][0], P[j][1]); ng.stroke() } } P.forEach((p) => { ng.fillStyle = 'rgba(170,235,228,.3)'; ng.beginPath(); ng.arc(p[0], p[1], p[2], 0, 6.283); ng.fill() }); } const scene = $('f3scene'), mx = $('f3mx'), mp = $('f3mp'); function render(t) { scene.style.transform = `scale(${(1 + .025 * (-(Math.cos(Math.PI * t / DUR) - 1) / 2)).toFixed(4)})`; words.forEach((w, i) => { const s = i < 3 ? i * .06 : .25 + (i - 3) * .06, e = out(clamp((t - s) / .6)); w.style.opacity = e.toFixed(3); w.style.transform = `translateY(${((1 - e) * 28).toFixed(1)}px)` }); const em = out(clamp((t - .45) / .6)); mx.style.opacity = em.toFixed(3); mx.style.transform = `translateY(${((1 - em) * 50).toFixed(1)}px)`; const ep = out(clamp((t - .65) / .6)); mp.style.opacity = ep.toFixed(3); mp.style.transform = `translateY(${((1 - ep) * 50).toFixed(1)}px)`; const bx = bandX(t); band.style.opacity = bx == null ? 0 : clamp(Math.min((bx - X0) / 60, (X1 - bx) / 60)).toFixed(3); if (bx != null) band.style.left = bx.toFixed(1) + 'px'; cells.forEach((k) => { const p = clamp((t - k.tH) / .3); k.el.style.background = p > .5 ? BG[k.tone] : '#f4f4f7'; k.el.style.color = p > .5 ? '#121318' : '#9a9caa'; k.bar.style.width = (FILL[k.tone] * 100 * io(p)).toFixed(1) + '%'; k.bar.style.background = BAR(k.tone); k.el.style.setProperty('--f', k.flag ? out(clamp((t - k.tH - .1) / .3)).toFixed(3) : 0); }); $('f3n').textContent = COMP.filter((c) => t >= c.tLit).length; drawMap(t); drawNet(t); } let t = 0, last = 0; const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) t = 4.0; function loop(now) { const dt = last ? (now - last) / 1000 : 0; last = now; if (!reduce) { t += dt; if (t >= DUR) t = 0 } render(t); requestAnimationFrame(loop) } const vp = $('f3vp'), stage = $('f3stage'); new ResizeObserver(() => { stage.style.transform = `scale(${vp.clientWidth / 1920})` }).observe(vp); (window.FR = window.FR || []).push({ stage, DUR, render }); })(); /*@@SBL-NEXT-SCRIPT@@*/ /* ── frame 1:03: insights pile up in perspective (newest on top, older recede below) + 3×3 health tiles ── */ (() => { const DUR = 6, $ = (id) => document.getElementById(id); const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v)); const out = (p) => 1 - Math.pow(1 - p, 5), io = (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2; const IC = { risk: '', opp: '', anom: '' }; const TAG = { risk: ['Risk', 't-risk'], opp: ['Opportunity', 't-opp'], anom: ['Anomaly', 't-anom'] }; // oldest first; the first 3 are already there, the rest arrive one by one const INS = [ ['opp', 'as of Oct 22', '11,400 adults near Evanston aren’t customers yet', 'No store within 2 miles of three neighbourhoods', '$120–180k', 'est. to gain in year one', 'good', 'Plan a campaign'], ['risk', 'as of this morning', '412 top customers haven’t visited in 45+ days', 'They used to come back every 9 days', '$60–100k', 'est. to win back', 'good', 'Send win-back'], ['anom', 'as of this morning', 'Newark net sales −11% Tue–Thu, mostly Flower', 'Started three weeks ago, other categories flat', '$38k', 'lost so far', 'bad', 'Review Flower prices'], ['risk', 'as of this morning', 'Wicker Park: 23% of regulars find favourites out', '31 of their 120 favourites have no par level', '$5–8k', 'at risk in 90 days', 'bad', 'Set pars on 31 items'], ['opp', 'as of this morning', 'Online conversion 2.1% vs 3.4% at peers', 'Delivery slots are full from 4 pm, 5 days a week', '$9–14k', 'to gain a month', 'good', 'Add delivery slots'], ['risk', 'as of this morning', 'BOGO Edibles loses money: 80% would buy anyway', 'It costs 1.1 points of margin this month', '$5.6k', 'profit lost a month', 'bad', 'Pause BOGO Edibles'], ['anom', 'just now', 'Newark register 1: Saturday voids 2.8× normal', 'Mostly one budtender, same shifts as short drawer', '$1.9k', 'lost over 6 Saturdays', 'bad', 'Review Saturday shifts'], ['anom', 'just now', 'Logan Square newcomers come back less: 41% → 29%', 'The whole drop is at visit two', '$6–9k', 'to gain in 90 days', 'good', 'Reward second visits'] ]; const FRONT_B = 546, STEP = 88, SCALE = .085, SLIDE = .6; const deck = $('f4deck'); const cards = INS.map((d, i) => { const el = document.createElement('div'); el.className = 'fc'; el.style.zIndex = i + 1; el.innerHTML = `
${IC[d[0]]}${TAG[d[0]][0]}${d[1]}
${d[2]}
${d[3]}
${d[4]}${d[5]}
${d[7]}`; deck.appendChild(el); return { el, dim: el.querySelector('.fc-dim'), ring: el.querySelector('.fc-new'), tIn: i < 3 ? .5 + i * .12 : 1.5 + (i - 3) * .9, first: i < 3 }; }); const HEALTH = [ ['Inventory', 'bad', .14, ''], ['Payments', 'bad', .2, ''], ['Compliance', 'bad', .1, ''], ['Devices', 'ok', 0, ''], ['Security', 'ok', 0, ''], ['Integrations', 'ok', 0, ''], ['Cash drawers', 'ok', 0, ''], ['Staff & shifts', 'ok', 0, ''], ['Online menu', 'ok', 0, ''] ]; $('f4hl').innerHTML = HEALTH.map(([n, k, r, ic]) => `
${ic}
${n}
${k === 'bad' ? `` : ''}
`).join(''); const tiles = [...$('f4hl').children].map((el, i) => ({ el, bad: HEALTH[i][1] === 'bad', ic: el.querySelector('.ht-ic'), st: el.querySelector('.ht-st') })); $('f4title').innerHTML = 'Shows you what needs attention'.split(' ').map((w) => `${w}`).join(' ') + '
' + 'Where an opportunity is taking shape'.split(' ').map((w) => `${w}`).join(' ') + ''; const words = [...$('f4title').querySelectorAll('span')].filter((s) => !s.classList.contains('l2')); const labs = [...document.querySelectorAll('#f4scene .f4-lab')]; let seed = 9; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647; const NODES = Array.from({ length: 0 }, () => ({ x: rnd() * 1920, y: rnd() * 1080, ph: rnd() * 6.28, r: 1 + rnd() * 2 })); const ng = $('f4net').getContext('2d'); function drawNet(t) { SweedBG(ng); const P = NODES.map((n) => [n.x + Math.sin(t * .25 + n.ph) * 18, n.y + Math.cos(t * .2 + n.ph) * 14, n.r]); ng.lineWidth = 1; for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const d = Math.hypot(P[i][0] - P[j][0], P[i][1] - P[j][1]); if (d < 240) { ng.strokeStyle = `rgba(145,225,221,${(.11 * (1 - d / 240)).toFixed(3)})`; ng.beginPath(); ng.moveTo(P[i][0], P[i][1]); ng.lineTo(P[j][0], P[j][1]); ng.stroke() } } P.forEach((p) => { ng.fillStyle = 'rgba(170,235,228,.3)'; ng.beginPath(); ng.arc(p[0], p[1], p[2], 0, 6.283); ng.fill() }); } const scene = $('f4scene'); function render(t) { scene.style.transform = `scale(${(1 + .025 * (-(Math.cos(Math.PI * t / DUR) - 1) / 2)).toFixed(4)})`; words.forEach((w, i) => { const s = i < 5 ? i * .05 : .25 + (i - 5) * .05, e = out(clamp((t - s) / .6)); w.style.opacity = e.toFixed(3); w.style.transform = `translateY(${((1 - e) * 28).toFixed(1)}px)` }); labs.forEach((l, i) => { const e = out(clamp((t - .4 - i * .2) / .5)); l.style.opacity = e.toFixed(3) }); // stack: depth = how many newer cards have arrived (smooth); deeper = higher, smaller, darker let count = 0; cards.forEach((c, i) => { let d = 0; for (let j = i + 1; j < cards.length; j++) d += cards[j].first ? 1 : io(clamp((t - cards[j].tIn) / SLIDE)); const e = out(clamp((t - c.tIn) / .55)); const y = FRONT_B - 176 + d * STEP - (1 - e) * 90, s = (1 - SCALE * d) * (1 + .05 * (1 - e)); const o = clamp((t - c.tIn) / .15) * clamp(1 - (d - 4) / 1); c.el.style.opacity = o.toFixed(3); c.el.style.transform = `translateY(${y.toFixed(1)}px) scale(${Math.max(.4, s).toFixed(4)})`; c.dim.style.opacity = Math.min(.7, d * .2).toFixed(3); c.ring.style.opacity = c.first ? 0 : (clamp((t - c.tIn) / .2) * (1 - clamp((t - c.tIn - .7) / .6))).toFixed(3); if (t >= c.tIn) count++; }); $('f4cnt').textContent = Math.max(3, count); tiles.forEach((h, i) => { const e = out(clamp((t - .8 - (i % 3) * .08 - Math.floor(i / 3) * .1) / .5)); let sc = .9 + .1 * e; if (h.bad && t > 1.5) { const ph = ((t + i * .3) % 1.1) / 1.1; h.el.style.background = `rgb(255,${Math.round(244 - 14 * Math.sin(Math.PI * ph))},${Math.round(245 - 14 * Math.sin(Math.PI * ph))})`; h.el.style.boxShadow = `0 0 0 ${(ph * 12).toFixed(1)}px rgba(229,72,77,${(.45 * (1 - ph)).toFixed(3)}),0 20px 50px -24px rgba(0,0,0,.6)`; h.st.style.boxShadow = `0 0 0 ${(ph * 8).toFixed(1)}px rgba(229,72,77,${(.45 * (1 - ph)).toFixed(3)})`; } h.el.style.opacity = e.toFixed(3); h.el.style.transform = `scale(${sc.toFixed(4)})`; }); drawNet(t); } let t = 0, last = 0; const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) t = 5.8; function loop(now) { const dt = last ? (now - last) / 1000 : 0; last = now; if (!reduce) { t += dt; if (t >= DUR) t = 0 } render(t); requestAnimationFrame(loop) } const vp = $('f4vp'), stage = $('f4stage'); new ResizeObserver(() => { stage.style.transform = `scale(${vp.clientWidth / 1920})` }).observe(vp); (window.FR = window.FR || []).push({ stage, DUR, render }); })(); /*@@SBL-NEXT-SCRIPT@@*/ /* ── frame 1:09: pinned decision on top, the story scrolls under it ── */ (() => { const DUR = 7, $ = (id) => document.getElementById(id); const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v)); const out = (p) => 1 - Math.pow(1 - p, 5), io = (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2; const CHECKS = [['Is it unusual, or noise?', 'Second-purchase rate 29% vs a 41% baseline for the cohort'], ['Where is it?', 'Repeat ladder: the step 1→2 lost 12 pp'], ['What changed around it?', '62% of the cohort came on the first-visit offer'], ['How do peers compare?', 'You are at P38'], ['What would confirm it?', 'The September cohort at 36% or more at day 30']]; $('f5checks').innerHTML = CHECKS.map(([q, a]) => `
✓${q}${a}
`).join(''); const checks = [...$('f5checks').children]; const DRV = [['Offer-only newcomers', 'Came for the discount, no reason to return', 68, '#8b5cf6'], ['No follow-up message', 'Nothing sent between visit 1 and 2', 21, '#3b82f6'], ['Seasonal dip', 'August is usually a little lower', 11, '#a3a6b5']]; $('f5drv').innerHTML = DRV.map(([n, s, w, c]) => `
${n}${s}
0%
`).join(''); const drv = [...$('f5drv').children].map((el) => ({ b: el.querySelector('b'), i: el.querySelector('i') })); const chain = [...$('f5chain').children]; /* chart */ const H = [58, 57.4, 58.8, 57, 55.6, 55.2, 56.3, 57, 57.3, 57.2, 55.8, 54.0]; const X = (i) => 90 + i * 96, Y = (v) => 270 - (v - 50) / 10 * 240; const hist = H.map((v, i) => (i ? 'L' : 'M') + X(i) + ' ' + Y(v).toFixed(1)).join(' '); const xe = X(11), xd = 1360; $('f5svg').innerHTML = ` 60%50% Oct ’25Today · Oct 22Nov 30 Target 58% 59.6% 51.3%`; const dash = (id) => { const p = $(id), L = p.getTotalLength(); p.style.strokeDasharray = `${L} ${L}`; return { p, L } }; const ph = dash('f5hist'), pu = dash('f5up'), pd = $('f5down'), ends = $('f5ends'), area = $('f5area'), now = $('f5now'); /* scroll stops: section tops inside the track */ const track = $('f5track'), view = $('f5view'), thumb = $('f5thumb'), rail = $('f5rail'); let STOPS = null; const measure = () => { const maxS = track.offsetHeight - view.clientHeight; STOPS = [0, $('f5s2').offsetTop - 30, $('f5s3').offsetTop - 30, Math.min(maxS, $('f5s4').offsetTop - 30)]; rail.style.height = ($('f5s4').offsetTop - 56 + 20) + 'px'; }; const MOVES = [[2.3, 2.9, 0, 1], [4.0, 4.6, 1, 2], [6.0, 6.5, 2, 3]]; const scrollAt = (t) => { let y = STOPS[0]; MOVES.forEach(([a, b, f, to]) => { if (t >= a) y = STOPS[f] + (STOPS[to] - STOPS[f]) * io(clamp((t - a) / (b - a))) }); return y }; $('f5title').innerHTML = 'It recommends your next move'.split(' ').map((w) => `${w}`).join(' ') + '
' + 'and explains why'.split(' ').map((w) => `${w}`).join(' ') + ''; const words = [...$('f5title').querySelectorAll('span')].filter((s) => !s.classList.contains('l2')); let seed = 17; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647; const NODES = Array.from({ length: 0 }, () => ({ x: rnd() * 1920, y: rnd() * 1080, ph: rnd() * 6.28, r: 1 + rnd() * 2 })); const ng = $('f5net').getContext('2d'); function drawNet(t) { SweedBG(ng); const P = NODES.map((n) => [n.x + Math.sin(t * .25 + n.ph) * 18, n.y + Math.cos(t * .2 + n.ph) * 14, n.r]); ng.lineWidth = 1; for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const d = Math.hypot(P[i][0] - P[j][0], P[i][1] - P[j][1]); if (d < 240) { ng.strokeStyle = `rgba(145,225,221,${(.11 * (1 - d / 240)).toFixed(3)})`; ng.beginPath(); ng.moveTo(P[i][0], P[i][1]); ng.lineTo(P[j][0], P[j][1]); ng.stroke() } } P.forEach((p) => { ng.fillStyle = 'rgba(170,235,228,.3)'; ng.beginPath(); ng.arc(p[0], p[1], p[2], 0, 6.283); ng.fill() }); } const show = (el, dt, dy = 24, dur = .5, dx = 0) => { const e = out(clamp(dt / dur)); el.style.opacity = e.toFixed(3); el.style.transform = `translate(${((1 - e) * dx).toFixed(1)}px,${((1 - e) * dy).toFixed(1)}px)`; return e }; function render(t) { if (!STOPS) measure(); $('f5scene').style.transform = `scale(${(1 + .02 * (-(Math.cos(Math.PI * t / DUR) - 1) / 2)).toFixed(4)})`; words.forEach((w, i) => show(w, t - (i < 5 ? i * .06 : .3 + (i - 5) * .08), 28, .6)); show($('f5sw'), t - .35, 60, .6); show($('f5hero'), t - .7, 16); // scroll const y = scrollAt(t), maxS = track.offsetHeight - view.clientHeight; track.style.transform = `translateY(${(-y).toFixed(1)}px)`; const vh = view.clientHeight - 20, th = vh * view.clientHeight / track.offsetHeight; thumb.style.height = th.toFixed(1) + 'px'; thumb.style.top = ((vh - th) * (maxS ? y / maxS : 0)).toFixed(1) + 'px'; rail.style.transform = `scaleY(${io(clamp((t - .9) / 5.4)).toFixed(4)})`; // 1 · checks tick down the timeline show($('f5s1'), t - .9, 16); checks.forEach((c, i) => show(c, t - 1.1 - i * .22, 0, .35, -16)); // 2 · weights, then the chain of causes drv.forEach((d, i) => { const f = io(clamp((t - 2.8 - i * .25) / .7)); d.i.style.width = (DRV[i][2] * f) + '%'; d.b.textContent = Math.round(DRV[i][2] * f) + '%' }); chain.forEach((c, i) => show(c, t - 3.45 - i * .1, 0, .35, -12)); // 3 · trend + forecast fork const fh = io(clamp((t - 4.45) / .8)); ph.p.style.strokeDashoffset = (ph.L * (1 - fh)).toFixed(1); area.style.opacity = (.1 * fh * fh).toFixed(3); now.style.opacity = clamp((t - 5.25) / .2); pd.style.opacity = clamp((t - 5.3) / .4).toFixed(3); const fu = io(clamp((t - 5.35) / .6)); pu.p.style.strokeDashoffset = (pu.L * (1 - fu)).toFixed(1); ends.style.opacity = clamp((t - 5.85) / .3).toFixed(3); // 4 · decision: the pinned button answers const pb = t > 6.4 ? (Math.sin((t - 6.4) * 8) + 1) / 2 : 0; $('f5btn').style.boxShadow = `0 0 0 ${(pb * 8).toFixed(1)}px rgba(217,70,239,${(.3 * pb).toFixed(2)}),0 10px 24px -10px rgba(124,92,240,.7)`; drawNet(t); } let t = 0, last = 0; const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) t = 5.9; const FZ = parseFloat(new URLSearchParams(location.search).get('t')); if (!isNaN(FZ)) t = FZ; // ?t=4.5 freezes the preview for review function loop(n) { const dt = last ? (n - last) / 1000 : 0; last = n; if (!reduce && isNaN(FZ)) { t += dt; if (t >= DUR) t = 0 } render(t); requestAnimationFrame(loop) } const vp = $('f5vp'), stage = $('f5stage'); new ResizeObserver(() => { stage.style.transform = `scale(${vp.clientWidth / 1920})`; STOPS = null }).observe(vp); (window.FR = window.FR || []).push({ stage, DUR, render }); })(); /*@@SBL-NEXT-SCRIPT@@*/ /* ── frame 1:13: one goal → segment + challenge → launch ── */ (() => { const DUR = 6, $ = (id) => document.getElementById(id); const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v)); const out = (p) => 1 - Math.pow(1 - p, 5), io = (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2; // RFM grid: rows = frequency (top high), cols = recency (left = long ago). At risk = high F, low R. const AT = new Set(['0-0', '0-1', '1-0', '1-1', '2-0']); $('f6rfm').innerHTML = Array.from({ length: 25 }, (_, k) => ``).join(''); const cells = [...$('f6rfm').children].filter((c) => AT.has(c.dataset.k)); const L = $('f6l'), R = $('f6r'), LL = L.getTotalLength(), RL = R.getTotalLength(); [L, R].forEach((p) => { const n = p.getTotalLength(); p.style.strokeDasharray = `${n} ${n}` }); const dl = $('f6dl'), dr = $('f6dr'); const TASKS = [ ['Make 3 separate purchases on 3 different days', ''], ['Spend at least $49 each visit', ''], ['Leave a Google Review for the local store', ''] ]; const tcard = (k) => { const [txt, ic] = TASKS[k % 3], n = k % 3; return `
${ic}
Task ${n + 1}of 3

${txt}

${[0, 1, 2].map((j) => `${j + 1}`).join('')}
` }; $('f6car').innerHTML = Array.from({ length: 7 }, (_, k) => tcard(k)).join(''); const car = $('f6car'), STEP = 318; // carousel: one step every 0.75 s after the card lands, looping 1 → 2 → 3 → 1 const carX = (t) => { if (t < 2.6) return 0; const k = (t - 2.6) / .75, i = Math.floor(k), f = io(clamp((k - i) / .55)); return -STEP * ((i + f) % 3) }; $('f6title').innerHTML = 'Helps you turn that decision'.split(' ').map((w) => `${w}`).join(' ') + '
' + 'into action'.split(' ').map((w) => `${w}`).join(' ') + ''; const words = [...$('f6title').querySelectorAll('span')].filter((s) => !s.classList.contains('l2')); let seed = 29; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647; const NODES = Array.from({ length: 0 }, () => ({ x: rnd() * 1920, y: rnd() * 1080, ph: rnd() * 6.28, r: 1 + rnd() * 2 })); const ng = $('f6net').getContext('2d'); function drawNet(t) { SweedBG(ng); const P = NODES.map((n) => [n.x + Math.sin(t * .25 + n.ph) * 18, n.y + Math.cos(t * .2 + n.ph) * 14, n.r]); ng.lineWidth = 1; for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const d = Math.hypot(P[i][0] - P[j][0], P[i][1] - P[j][1]); if (d < 240) { ng.strokeStyle = `rgba(145,225,221,${(.11 * (1 - d / 240)).toFixed(3)})`; ng.beginPath(); ng.moveTo(P[i][0], P[i][1]); ng.lineTo(P[j][0], P[j][1]); ng.stroke() } } P.forEach((p) => { ng.fillStyle = 'rgba(170,235,228,.3)'; ng.beginPath(); ng.arc(p[0], p[1], p[2], 0, 6.283); ng.fill() }); } const show = (el, dt, dy = 24, dur = .5, dx = 0, s0 = 1) => { const e = out(clamp(dt / dur)); el.style.opacity = e.toFixed(3); el.style.transform = `translate(${((1 - e) * dx).toFixed(1)}px,${((1 - e) * dy).toFixed(1)}px) scale(${(s0 + (1 - s0) * e).toFixed(4)})`; return e }; const CUR0 = [1700, 760]; function render(t) { $('f6scene').style.transform = `scale(${(1 + .025 * (-(Math.cos(Math.PI * t / DUR) - 1) / 2)).toFixed(4)})`; words.forEach((w, i) => show(w, t - (i < 5 ? i * .06 : .3 + (i - 5) * .08), 28, .6)); show($('f6goal'), t - .4, 30, .55, 0, .94); // branches draw, then a pulse runs down each const f = io(clamp((t - 1.0) / .55)); L.style.strokeDashoffset = (LL * (1 - f)).toFixed(1); R.style.strokeDashoffset = (RL * (1 - f)).toFixed(1); [[dl, L, LL], [dr, R, RL]].forEach(([d, p, n]) => { const u = t < 1.0 ? 0 : t < 1.55 ? f : ((t - 1.55) / 1.1) % 1; const q = p.getPointAtLength(n * u); d.setAttribute('cx', q.x); d.setAttribute('cy', q.y); d.style.opacity = t < 1.0 ? 0 : (t < 1.55 ? 1 : .8 * Math.sin(Math.PI * u)).toFixed(2) }); show($('f6seg'), t - 1.45, 40, .55, 0, .92); show($('f6ch'), t - 1.75, 40, .55, 0, .92); // segment fills: count up + at-risk cells light const c = io(clamp((t - 1.8) / .9)); $('f6cnt').firstChild.textContent = Math.round(2340 * c).toLocaleString('en-US'); cells.forEach((el, i) => { const on = clamp((t - 1.9 - i * .1) / .25); el.style.background = on ? `rgba(229,72,77,${(.25 + .6 * on).toFixed(2)})` : '' }); // challenge: task cards slide in, then the carousel keeps turning const ce = out(clamp((t - 2.05) / .55)); car.style.transform = `translateX(${(carX(t) + (1 - ce) * 240).toFixed(1)}px)`; car.style.opacity = ce.toFixed(3); // launch from the goal card const gE = $('f6goal'), bE = $('f6btn'), CUR1 = [gE.offsetLeft + bE.offsetLeft + bE.offsetWidth * .42, gE.offsetTop + bE.offsetTop + bE.offsetHeight * .55]; const m = io(clamp((t - 3.5) / .7)), cx = CUR0[0] + (CUR1[0] - CUR0[0]) * m, cy = CUR0[1] + (CUR1[1] - CUR0[1]) * m; const cur = $('f6cur'); cur.style.opacity = clamp((t - 3.4) / .2) * (1 - clamp((t - 4.65) / .3)); const press = t > 4.2 && t < 4.35 ? .94 : 1; cur.style.transform = `translate(${cx.toFixed(1)}px,${cy.toFixed(1)}px) scale(${press})`; const done = t >= 4.3; bE.style.transform = `scale(${press})`; bE.classList.toggle('done', done); bE.textContent = done ? '✓ Plan launched' : '→ Launch plan'; const pill = $('f6pill'); pill.classList.toggle('live', done); pill.textContent = done ? 'Live' : 'Ready for you'; drawNet(t); } let t = 0, last = 0; const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) t = 4.9; const FZ = parseFloat(new URLSearchParams(location.search).get('t')); if (!isNaN(FZ)) t = FZ; function loop(n) { const dt = last ? (n - last) / 1000 : 0; last = n; if (!reduce && isNaN(FZ)) { t += dt; if (t >= DUR) t = 0 } render(t); requestAnimationFrame(loop) } const vp = $('f6vp'), stage = $('f6stage'); new ResizeObserver(() => { stage.style.transform = `scale(${vp.clientWidth / 1920})` }).observe(vp); (window.FR = window.FR || []).push({ stage, DUR, render }); })(); /*@@SBL-NEXT-SCRIPT@@*/ /* ── frame 1:19: one chart, two futures — same metric, scale and target as 1:09 ── */ (() => { const DUR = 6, $ = (id) => document.getElementById(id); const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v)); const out = (p) => 1 - Math.pow(1 - p, 5), io = (p) => p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2; const HIST = [57.6, 57.9, 57.2, 57.5, 56.8, 56.9, 56.1, 55.8, 55.4, 55.0, 54.6, 54.0]; // weekly, last = today (Oct 22) const UP = [54.0, 54.6, 55.8, 57.0, 58.3, 59.3, 59.6], DN = [54.0, 53.5, 53.0, 52.4, 51.9, 51.5, 51.3]; const X = (w) => 96 + w * 58, Y = (v) => 560 - (v - 48) / 14 * 520; // 48–62% const TODAY = 11, FW = (k) => TODAY + k * (5.6 / 6); // forecast points to Nov 30 const pth = (pts) => pts.map(([x, y], i) => (i ? 'L' : 'M') + x.toFixed(1) + ' ' + y.toFixed(1)).join(' '); const hist = HIST.map((v, i) => [X(i), Y(v)]), up = UP.map((v, k) => [X(FW(k)), Y(v)]), dn = DN.map((v, k) => [X(FW(k)), Y(v)]); const xT = X(TODAY), xE = X(FW(6)), xGW = X(TODAY + 4.86); let grid = ''; for (let v = 48; v <= 62; v += 2) grid += `${v}%`; const XL = [[0, 'Aug 6'], [3, 'Aug 27'], [6, 'Sep 17'], [9, 'Oct 8']]; $('f7svg').innerHTML = ` ${grid}${XL.map(([w, l]) => `${l}`).join('')} Nov 30 FORECAST Target 58% Green Wednesday Today · Oct 22 54.0% · decide now 59.6% 51.3% +8.3 pp`; const dash = (id) => { const p = $(id), L = p.getTotalLength(); if (id !== 'f7dnp') p.style.strokeDasharray = `${L} ${L}`; return { p, L } }; const H = dash('f7hist'), U = dash('f7upp'), D = $('f7dnp'), DL = D.getTotalLength(); // dashed line: reveal with a clip that grows to the right $('f7svg').insertAdjacentHTML('afterbegin', ``); D.setAttribute('clip-path', 'url(#f7clip)'); // callouts sit level with the branch ends $('f7up').style.top = (104 + Y(59.6) - 92) + 'px'; $('f7dn').style.top = (104 + Y(51.3) - 70) + 'px'; $('f7title').innerHTML = 'Shows you the gain'.split(' ').map((w) => `${w}`).join(' ') + '
' + 'and size of missed opportunity'.split(' ').map((w) => `${w}`).join(' ') + ''; const words = [...$('f7title').querySelectorAll('span')].filter((s) => !s.classList.contains('l2')); let seed = 31; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647; const NODES = Array.from({ length: 0 }, () => ({ x: rnd() * 1920, y: rnd() * 1080, ph: rnd() * 6.28, r: 1 + rnd() * 2 })); const ng = $('f7net').getContext('2d'); function drawNet(t) { SweedBG(ng); const P = NODES.map((n) => [n.x + Math.sin(t * .25 + n.ph) * 18, n.y + Math.cos(t * .2 + n.ph) * 14, n.r]); ng.lineWidth = 1; for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const d = Math.hypot(P[i][0] - P[j][0], P[i][1] - P[j][1]); if (d < 240) { ng.strokeStyle = `rgba(145,225,221,${(.11 * (1 - d / 240)).toFixed(3)})`; ng.beginPath(); ng.moveTo(P[i][0], P[i][1]); ng.lineTo(P[j][0], P[j][1]); ng.stroke() } } P.forEach((p) => { ng.fillStyle = 'rgba(170,235,228,.3)'; ng.beginPath(); ng.arc(p[0], p[1], p[2], 0, 6.283); ng.fill() }); } const show = (el, dt, dy = 24, dur = .5, dx = 0) => { const e = out(clamp(dt / dur)); el.style.opacity = e.toFixed(3); el.style.transform = `translate(${((1 - e) * dx).toFixed(1)}px,${((1 - e) * dy).toFixed(1)}px)`; return e }; const money = (a, b, f) => `${Math.round(a * f)}–${Math.round(b * f)}k`; function render(t) { $('f7scene').style.transform = `scale(${(1 + .025 * (-(Math.cos(Math.PI * t / DUR) - 1) / 2)).toFixed(4)})`; words.forEach((w, i) => show(w, t - (i < 5 ? i * .06 : .3 + (i - 5) * .06), 28, .6)); show($('f7card'), t - .4, 50, .6); $('f7grid').style.opacity = out(clamp((t - .8) / .4)).toFixed(3); const fh = io(clamp((t - 1.0) / 1.3)); H.p.style.strokeDashoffset = (H.L * (1 - fh)).toFixed(1); H.p.style.opacity = fh > 0 ? 1 : 0; $('f7area').style.opacity = (.1 * fh * fh).toFixed(3); const et = out(clamp((t - 2.3) / .35)); $('f7today').style.opacity = et.toFixed(3); const pp = t > 2.4 ? ((t - 2.4) % 1.2) / 1.2 : 0; $('f7pulse').setAttribute('r', (10 + pp * 18).toFixed(1)); $('f7pulse').style.opacity = (1 - pp).toFixed(2); // no action: red dashed slides down const fd = io(clamp((t - 2.75) / .7)); $('f7cr').setAttribute('width', ((xE - xT + 30) * fd).toFixed(1)); const ed = show($('f7dn'), t - 3.05, 0, .5, 60); $('f7dnv').firstChild.textContent = '−$' + money(15, 30, io(clamp((t - 3.05) / .7))); // if you launch: green climbs, the gap fills const fu = io(clamp((t - 3.6) / .75)); U.p.style.strokeDashoffset = (U.L * (1 - fu)).toFixed(1); U.p.style.opacity = fu > 0 ? 1 : 0; $('f7gap').style.opacity = (.14 * io(clamp((t - 4.1) / .6))).toFixed(3); show($('f7up'), t - 3.9, 0, .5, 60); $('f7upv').firstChild.textContent = '$' + money(60, 100, io(clamp((t - 3.9) / .8))); $('f7ends').style.opacity = clamp((t - 4.3) / .3).toFixed(3); $('f7delta').style.opacity = out(clamp((t - 4.7) / .4)).toFixed(3); drawNet(t); } let t = 0, last = 0; const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) t = 5.9; const FZ = parseFloat(new URLSearchParams(location.search).get('t')); if (!isNaN(FZ)) t = FZ; function loop(n) { const dt = last ? (n - last) / 1000 : 0; last = n; if (!reduce && isNaN(FZ)) { t += dt; if (t >= DUR) t = 0 } render(t); requestAnimationFrame(loop) } const vp = $('f7vp'), stage = $('f7stage'); new ResizeObserver(() => { stage.style.transform = `scale(${vp.clientWidth / 1920})` }).observe(vp); (window.FR = window.FR || []).push({ stage, DUR, render }); })(); /*@@SBL-NEXT-SCRIPT@@*/ /* ── 04 · THE BRAINS: each Brain's beat plays the live product (Sweed Brain prototype rebuilt in HTML/SVG) ── CHARTS are the prototype's own chart paths (viewBox 240×112, read by landing/capture-ui.cjs-style extraction). Every animated detail carries data-at="ms"; the beat adds .on to it on that clock when it comes into view. */ const CHARTS = {"sales": {"g": 56.0, "t": 185.7, "a": "M5.0 71.7 C7.7 72.9 16.0 79.3 21.4 78.8 C26.9 78.3 32.4 67.8 37.9 68.9 C43.3 69.9 48.8 79.2 54.3 85.1 C59.8 91.0 65.2 105.2 70.7 104.4 C76.2 103.6 81.7 84.7 87.1 80.4 C92.6 76.0 98.1 81.9 103.6 78.3 C109.0 74.7 114.5 61.5 120.0 58.8 C125.5 56.1 131.0 63.9 136.4 62.0 C141.9 60.2 147.4 49.4 152.9 47.7 C158.3 46.1 163.8 48.8 169.3 52.0 C174.8 55.1 183.0 64.4 185.7 66.8", "b": "M185.7 66.8 C188.5 64.3 196.7 53.7 202.1 51.7 C207.6 49.7 213.1 54.3 218.6 54.8 C224.0 55.4 232.3 54.9 235.0 55.0", "f": "M185.7 66.8 C188.5 64.1 196.7 52.7 202.1 50.2 C207.6 47.7 213.1 51.8 218.6 51.8 C224.0 51.9 232.3 50.7 235.0 50.4", "yl": [["$14M", 5.0], ["$12M", 56.0], ["$10M", 107.0]], "el": [["$12.2M", 50.0], ["$12M", 67.0], ["Dec", 125.0]]}, "marketing": {"g": 52.6, "t": 185.7, "a": "M5.0 76.4 C7.7 75.9 16.0 73.0 21.4 73.3 C26.9 73.5 32.4 77.9 37.9 77.7 C43.3 77.5 48.8 72.9 54.3 72.0 C59.8 71.1 65.2 71.8 70.7 72.3 C76.2 72.7 81.7 75.4 87.1 74.8 C92.6 74.1 98.1 68.9 103.6 68.3 C109.0 67.8 114.5 71.1 120.0 71.5 C125.5 71.9 131.0 71.8 136.4 70.8 C141.9 69.8 147.4 65.7 152.9 65.7 C158.3 65.6 163.8 70.1 169.3 70.3 C174.8 70.5 183.0 67.5 185.7 66.9", "b": "M185.7 66.9 C188.5 67.0 196.7 67.5 202.1 67.3 C207.6 67.2 213.1 66.3 218.6 66.0 C224.0 65.7 232.3 65.6 235.0 65.6", "f": "M185.7 66.9 C188.5 65.1 196.7 60.1 202.1 56.2 C207.6 52.4 213.1 47.7 218.6 43.7 C224.0 39.7 232.3 34.2 235.0 32.2", "yl": [["$40k", 5.0], ["$26k", 53.0], ["$10k", 107.0]], "el": [["$32k", 32.0], ["$22.2k", 66.0], ["Dec", 125.0]]}, "customers": {"g": 17.8, "t": 185.7, "a": "M5.0 76.4 C7.7 75.1 16.0 69.2 21.4 68.5 C26.9 67.7 32.4 73.3 37.9 72.0 C43.3 70.6 48.8 62.7 54.3 60.3 C59.8 57.8 65.2 57.8 70.7 57.4 C76.2 57.0 81.7 60.0 87.1 57.9 C92.6 55.9 98.1 47.0 103.6 45.1 C109.0 43.2 114.5 47.1 120.0 46.7 C125.5 46.2 131.0 44.9 136.4 42.4 C141.9 39.9 147.4 32.7 152.9 31.5 C158.3 30.3 163.8 36.1 169.3 35.3 C174.8 34.5 183.0 28.3 185.7 26.9", "b": "M185.7 26.9 C188.5 26.5 196.7 25.7 202.1 24.4 C207.6 23.1 213.1 20.7 218.6 19.1 C224.0 17.6 232.3 16.0 235.0 15.4", "f": "M185.7 26.9 C188.5 26.2 196.7 24.5 202.1 22.5 C207.6 20.6 213.1 17.5 218.6 15.4 C224.0 13.2 232.3 10.7 235.0 9.7", "yl": [["135k", 18.0], ["100k", 107.0]], "el": [["138.2k", 10.0], ["135.9k", 27.0], ["Dec", 125.0]]}, "inventory": {"g": 79.8, "t": 185.7, "a": "M5.0 66.2 C7.7 64.7 16.0 56.7 21.4 57.0 C26.9 57.3 32.4 68.9 37.9 68.1 C43.3 67.3 48.8 54.9 54.3 52.2 C59.8 49.5 65.2 51.0 70.7 52.0 C76.2 52.9 81.7 59.9 87.1 57.9 C92.6 55.9 98.1 41.7 103.6 40.0 C109.0 38.3 114.5 46.9 120.0 47.7 C125.5 48.6 131.0 47.9 136.4 45.1 C141.9 42.2 147.4 31.0 152.9 30.6 C158.3 30.1 163.8 41.9 169.3 42.2 C174.8 42.5 183.0 33.9 185.7 32.2", "b": "M185.7 32.2 C188.5 32.3 196.7 33.3 202.1 32.6 C207.6 32.0 213.1 29.2 218.6 28.2 C224.0 27.1 232.3 26.6 235.0 26.3", "f": "M185.7 32.2 C188.5 33.4 196.7 37.8 202.1 39.4 C207.6 41.0 213.1 40.6 218.6 41.8 C224.0 43.0 232.3 45.9 235.0 46.7", "yl": [["45 d", 5.0], ["34 d", 80.0], ["30 d", 107.0]], "el": [["42 d", 26.0], ["39 d", 47.0], ["Dec", 125.0]]}, "catalog": {"g": 43.2, "t": 185.7, "a": "M5.0 81.5 C7.7 80.8 16.0 77.8 21.4 77.5 C26.9 77.2 32.4 80.5 37.9 79.9 C43.3 79.2 48.8 75.0 54.3 73.8 C59.8 72.6 65.2 72.7 70.7 72.6 C76.2 72.5 81.7 74.3 87.1 73.3 C92.6 72.3 98.1 67.5 103.6 66.6 C109.0 65.7 114.5 68.0 120.0 67.9 C125.5 67.7 131.0 67.2 136.4 65.9 C141.9 64.7 147.4 60.8 152.9 60.3 C158.3 59.8 163.8 63.1 169.3 62.8 C174.8 62.5 183.0 59.3 185.7 58.6", "b": "M185.7 58.6 C188.5 58.4 196.7 58.1 202.1 57.6 C207.6 57.0 213.1 55.8 218.6 55.0 C224.0 54.3 232.3 53.6 235.0 53.3", "f": "M185.7 58.6 C188.5 56.5 196.7 50.8 202.1 46.5 C207.6 42.2 213.1 37.3 218.6 32.9 C224.0 28.6 232.3 22.3 235.0 20.2", "yl": [["100", 5.0], ["85", 43.0], ["60", 107.0]], "el": [["94", 20.0], ["81", 53.0], ["Dec", 125.0]]}, "operations": {"g": 66.2, "t": 185.7, "a": "M5.0 76.4 C7.7 73.8 16.0 59.5 21.4 60.6 C26.9 61.7 32.4 84.0 37.9 83.0 C43.3 82.1 48.8 59.4 54.3 55.0 C59.8 50.6 65.2 54.2 70.7 56.5 C76.2 58.8 81.7 72.0 87.1 68.8 C92.6 65.5 98.1 39.8 103.6 37.1 C109.0 34.5 114.5 50.8 120.0 52.9 C125.5 55.1 131.0 54.6 136.4 49.9 C141.9 45.1 147.4 24.7 152.9 24.4 C158.3 24.0 163.8 46.8 169.3 47.8 C174.8 48.9 183.0 33.4 185.7 30.5", "b": "M185.7 30.5 C188.5 30.9 196.7 33.7 202.1 33.1 C207.6 32.4 213.1 27.8 218.6 26.4 C224.0 24.9 232.3 24.8 235.0 24.4", "f": "M185.7 30.5 C188.5 34.3 196.7 47.3 202.1 53.5 C207.6 59.6 213.1 61.8 218.6 67.2 C224.0 72.5 232.3 82.6 235.0 85.6", "yl": [["25.0%", 5.0], ["23.8%", 66.0], ["23.0%", 107.0]], "el": [["24.6%", 24.0], ["23.4%", 86.0], ["Dec", 125.0]]}} ;(() => { const $ = (s, r = document) => r.querySelector(s), $$ = (s, r = document) => [...r.querySelectorAll(s)] const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches const MARK = ($('.brain-mark-src .bm') || { outerHTML: '' }).outerHTML const STRIP = '0123456789'.repeat(2).split('').map((d) => `${d}`).join('') // a number whose digits spin and land one after another const reel = (s, at) => { let j = 0; return '' + [...String(s)].map((ch) => /\d/.test(ch) ? `${ch}${STRIP}` : `${ch}`).join('') + '' } const ICON = { anomaly: '', risk: '', opportunity: '', forecast: '', task: '', benchmark: '', } const pill = (k) => `${ICON[k]}${k[0].toUpperCase() + k.slice(1)}` const CURSOR = '' const endY = (d) => { const n = d.trim().split(/[\s,A-Z]+/).filter(Boolean).map(Number); return n[n.length - 1] } // ── widgets ── // the two-futures chart: «so far» wipes in behind a light, then splits into «if you act» and «if nothing changes» const plot = (C, T, X) => { const t = C.t / 240 * 100, ya = endY(C.a), yf = endY(C.f), yb = endY(C.b), pc = (y) => (y / 112 * 100).toFixed(2) + '%' const near = (y) => C.el.filter((e) => e[0] !== 'Dec').sort((p, q) => Math.abs(p[1] - y) - Math.abs(q[1] - y))[0][0] const id = 'w' + Math.random().toString(36).slice(2, 7) return `
${C.yl.map(([v, y]) => `${v}`).join('')} ${C.tl ? `${C.tl}` : ''}${C.gl ? `${C.gl}` : ''}${C.gp ? `${C.gp}` : ''} ${near(yf)} ${near(yb)} ${X[0]}${X[1]}${X[2]}
` } const pulse = (c, T) => `
${c.q}See why
${c.title} ${reel(c.metric, T + 350)}

${c.sub} ${c.est}

so farif nothing changesif you actgoal
${plot(CHARTS[c.tab], T, ['Oct ’25', 'Sep ’26', 'Dec'])}
If you act on the Brain’s cards${reel(c.act[0], T + 2700)}${c.act[1]}
If nothing changes${reel(c.base[0], T + 2900)}by Dec
` const insight = (n, T, cls = 'side2') => `
${n.tag ? `${n.tag}` : ''}
${pill(n.p)}${n.asof}

${n.t}

${n.s}

${reel(n.v, T + 300)}${n.est ? ' est.' : ''}${n.vs}
${n.btn}✓ In Actions${CURSOR.replace('AT', T + 1200)}See why···
` const H = (seed, n) => { let s = seed; return Array.from({ length: n }, (_, i) => { s = (s * 9301 + 49297) % 233280; const r = s / 233280; return i % 7 === 3 && r < .35 ? .02 : .35 + r * .6 }) } const live = (c, T) => `
Live · ${c.label}
${reel(c.n, T + 300)}in the last 30 minutesper minute
${H(c.seed, 30).map((h, i) => ``).join('')}
−30 min−15 minnow
${kpis(c.k, T + 1300)}
` const kpis = (k, T) => `
${k.map(([a, b, c, d]) => `
${a}${b}${c} ${d}
`).join('')}
` const table = (c, T) => `
Running out first
${reel(12, T + 300)}top sellers run out within 3 days; the vendor needs 5
${c.rows.map(([n, s, d, o]) => `
${n} · ${s}${d}${o}
`).join('')}
${kpis(c.k, T + 1300)}
` const shelf = (c, T) => `
Your shelf vs local demand
${reel(3, T + 300)}categories sell below local demand; the biggest gap is Concentrates, 9% vs 14%
your saleslocal demand
${c.rows.map(([n, y, l], i) => `${n}${y >= l ? '+' : '−'}${Math.abs(y - l)} pp
`).join('')}
${kpis(c.k, T + 1500)}` const chat = (c, T, cls = 'narrow') => `
${MARK}
Sweed BrainBusiness Pulse
What needs me today?

5 cards need you today, worth ~$288–418k est. on Net sales:

    ${c.lines.map((l, i) => `
  1. ${l}
  2. `).join('')}
Fix it in Promo →
Ask about your business
` const head = (T) => `

Net sales are up ${reel('9.4%', T + 300)} vs Sep 2025. 5 decisions today are worth $288–418k est. First up: ${reel('$38k', T + 600)} lost so far.

The Brain’s advice brought in this month, est.+${reel('$12k', T + 800)}
Decisions acted on${reel(2, T + 1000)}
Time saved${reel(9, T + 1100)} h
` const gauge = (T) => `
Health
${reel(96, T + 400)} /100Critical

3 critical in 3 stores and network-wide

3 critical21 attention6 hygiene
Recalled lot still sellable08:30 todayLot 24-XK-118: 23 units sellable · River North, Evanston→ Pull lot 24-XK-118 from menu and stock immediately
Negative on-hand stock20 Oct, 2.5 d14 SKUs, −61 units · Logan Square→ Freeze the 14 SKUs and run an audit recount now
` const slots = (T) => { const hrs = ['11 am', '1 pm', '3 pm', '4 pm', '6 pm', '8 pm'], days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; let i = 0 return `
Delivery slots · this week

Full from 4 pm, 5 days a week · 60% of online drop-off happens here

${days.map((d) => `${d}`).join('')} ${hrs.map((h, r) => `${h}` + days.map((d, c) => { const full = r >= 3 && c < 5, hot = full && r === 3; return `` }).join('')).join('')}
openfullfull at 4 pm, when most orders come in
` } // ── 03 · the seven capability screens: the wireframe's own figures, live ── const IN = ['Sales & Inventory', 'Product & Lab Data', 'Competitor Pricing', 'Market & Foot Traffic', 'Customer Behavior', 'Marketing & Digital', 'Service & Labor'] const OUT = ['Business Overview', 'Forecasts & Opportunities', 'Risk Analysis', 'Priorities & Alerts', 'Goal-driven Strategies', 'Prepared Actions', 'Continuous Optimization'] const io = (T) => `
  • Data In
  • ${IN.map((x, i) => `
  • ${x}
  • `).join('')}
${MARK}
  • Data Out
  • ${OUT.map((x, i) => `
  • ${x}
  • `).join('')}
` const okb = (t) => `✓ ${t}`, badb = (t) => `✕ ${t}` const learned = (T) => `
Forecast vs actual${okb('Learned 2')}${badb('Dropped 1')}
${[['Columbus Day weekend: edibles', 'Forecast $6–9k est. · Hit forecast', '+$7.2k', 1], ['Sell aging pre-rolls in NJ', 'Forecast $4–6k est. · Missed forecast', '+$2.6k', 0], ['Birthday messages', 'Forecast $3–4k est. · Running', '+$2.1k', 1]] .map(([a, b, v, ok], i) => `
${a}${b}
${reel(v, T + 600 + i * 350)}${ok ? okb('Learned') : badb('Dropped')}
`).join('')}
Limits · Max 15% off · margin floor 25% · no Concentrate
` const MK = [['Newark', 'NJ', '-5.5%', '60.7%', '$70.80', '2.8%'], ['Jersey City', 'NJ', '-5.5%', '60.5%', '$67.47', '9.8%'], ['Logan Square', 'IL', '2.0%', '33.3%', '$67.10', '0.5%'], ['Wicker Park', 'IL', '22.0%', '34.3%', '$52.93', '26.0%'], ['Hoboken', 'NJ', '-15.4%', '57.1%', '$53.37', '-7.6%']] const cellTone = (c, v) => { const n = parseFloat(v.replace(/[$,]/g, '')); if (c === 0 || c === 3) return n < 0 ? 'be' : n > 15 ? 'ah' : ''; if (c === 1) return n < 40 ? 'be' : ''; if (c === 2) return n < 60 ? 'be' : ''; return '' } const market = (T) => `
13 of 14 stores behind on 3+ measuresBehindAhead
${MK.map(([s, st, ...v], i) => `${v.map((x, c) => ``).join('')}`).join('')}
StoreSales growthGross marginBasketCustomer growth
${s} ${st}${x}

Chicago market · 38 competitor stores watched

` const att = (T) => `
${MARK}Brain insights7 today
${[['risk', 'as of this morning', 'Wicker Park: 23% of regulars find favourites out', '31 of their 120 favourites have no par level', '$5–8k', 'at risk in 90 days', 'Set pars on 31 items'], ['opportunity', 'as of this morning', '11,400 adults near Evanston aren’t customers yet', 'No store within 2 miles of three neighbourhoods', '$120–180k', 'est. to gain in year one', 'Plan a campaign']] .map(([p, a, t, sub, v, vs, b], i) => `
${pill(p)}${a}

${t}

${sub}

${reel(v, i ? T + 500 : T + 1500)} ${vs}${b}
`).join('')}
Health · 3 need attention
${['Inventory', 'Payments', 'Compliance', 'Devices', 'Security', 'Integrations', 'Cash drawers', 'Staff & shifts', 'Online menu'].map((x, i) => `${x}`).join('')}
` const plan = (T) => `

Goal · Bring regulars back before Green Wednesday

Green Wednesday Re-engagement ChallengeReady for you
SegmentRFM At Risk · ${reel('2,340', T + 600)} customersBought often, haven’t been back in 45+ days · Recency 45+ days · Spend $70+ avg
ChallengeGreen Wednesday Challenge3 purchases on 3 different days · At least $49 each visit · Leave a Google review
→ Launch plan✓ In Actions${CURSOR.replace('AT', T + 1400)}Pause any time in Actions
` const why = (T) => `
${pill('anomaly')}HighCustomers · Logan Square

Fewer August newcomers return to Logan Square: 41% → 29%

${reel('$6–9k', T + 300)} est. to gain in 90 daysReward second visits

Why · share of the 12 pp drop

${[['Offer-only newcomers', 'came for the discount', 68], ['No follow-up message', 'nothing between visits 1 and 2', 21], ['Seasonal dip', 'August is usually lower', 11]] .map(([a, b, v], i) => `
${a} ${b}${reel(v + '%', T + 800 + i * 300)}
`).join('')}
Ask the Brain about this…
` const yv = (v) => +(106 - (v - 50.5) / 10 * 100).toFixed(1) const sm = (pts) => pts.map(([x, v], i) => { const y = yv(v); if (!i) return `M${x} ${y}`; const [px, pv] = pts[i - 1], mx = (px + x) / 2; return `C${mx} ${yv(pv)} ${mx} ${y} ${x} ${y}` }).join(' ') const RP = { t: 150, g: yv(58), a: sm([[5, 52.6], [42, 52.9], [80, 53.5], [115, 53.3], [150, 54]]), f: sm([[150, 54], [192, 56.7], [235, 59.6]]), b: sm([[150, 54], [192, 52.4], [235, 51.3]]), yl: [['60%', yv(60)], ['56%', yv(56)], ['52%', yv(52)]], el: [['59.6%', yv(59.6)], ['51.3%', yv(51.3)]], tl: '54.0%' } RP.gl = 'Target 58%'; RP.gp = '+8.3 pp' RP.gap = RP.f + ' ' + sm([[235, 51.3], [192, 52.4], [150, 54]]).replace(/^M/, 'L') + ' Z' const predict = (T) => `
Repeat purchase rateforecast to Nov 30
${plot(RP, T, ['Aug', 'Today', 'Nov 30'])}
If you launch${reel('$54–90k', T + 2700)} est.59.6% by Nov 30, above target
If nothing changes−${reel('$15–30k', T + 2900)} lostslides to 51.3%
` // ── what each Brain shows (prototype data; tab = the prototype's area tab) ── const K_OPS = [['Checkout wait time', '4.8 min', 'SLA 5.0 min', '· held'], ['Shrink and variance', '1.4%', '0.4 pp over', '1.0% limit'], ['Delivery on-time rate', '91.0%', '−3.0 pp', 'vs Sep 2025'], ['Troubleshooting & manual time', '11.0%', '6.0 pp over', '5.0% limit']] const STAGES = [ (T) => pulse({ tab: 'sales', q: 'Am I selling more and earning more?', title: 'Net sales', metric: '$11.58M', tone: 'good', sub: 'Up 9.4% vs Sep 2025. Close to goal. Ahead of 44% of similar stores. 5 decisions here, worth', est: '$76–95k est.', act: ['$12.22M', 'by Dec · +$178k'], base: ['$12.04M'] }, T) + insight({ p: 'benchmark', asof: 'as of Oct 22', t: 'Baskets hold 1.3 fewer items than at peers', s: 'Accessories go in 27% of baskets vs 38% at peers', v: '$18–26k', est: 1, vs: 'to gain a month', btn: 'Suggest add-ons', tag: 'A gap in every basket, priced' }, T + 3200), (T) => live({ label: 'Message clicks', n: 120, seed: 7, k: [['Marketing ROI by channel', '2.1×', '70% of 3.0×', 'pace to goal'], ['Customer communications', '57', '13 below', 'target 70–100'], ['Loyalty engagement', '31.0%', '78% of 40.0%', 'pace to goal'], ['Online discoverability', '58', '12 below', 'target 70–100']] }, T) + insight({ p: 'task', asof: 'as of today, 6:00 am', t: '4 campaign drafts are ready; 1 weak journey paused', s: 'The paused journey converted 3 per 1,000 vs 15 at benchmark', v: '$9–14k', est: 1, vs: 'to gain in 30 days', btn: 'Review 4 drafts', tag: 'Drafted overnight, waiting for you' }, T + 2200), (T) => pulse({ tab: 'customers', q: 'Who are my customers, are they coming back, and how long do they stay?', title: 'Active customers', metric: '131,400', tone: 'good', sub: 'Up 1.9% vs prior 90 days. Ahead of 58% of similar stores. 7 decisions here, worth', est: '$144–229k est.', act: ['138,153', 'by Dec · +2,212'], base: ['135,941'] }, T) + insight({ p: 'risk', asof: 'as of Oct 22', t: '412 top customers haven’t visited in 45+ days', s: 'Nobody has messaged them in 90 days', v: '$60–100k', est: 1, vs: 'to win back in 60 days', btn: 'Review win-back draft', tag: 'Your best customers, slipping away' }, T + 3200), (T) => live({ label: 'Orders', n: 114, seed: 31, k: K_OPS }, T) + insight({ p: 'risk', asof: 'as of this morning', t: 'Only 48% of Newark baskets are tied to a customer', s: 'Guest checkout is on by default; two budtenders rarely look customers up', v: '$3–6k', est: 1, vs: 'to gain a month', btn: 'Prompt sign-ups', tag: 'Every counter, every screen, one place' }, T + 2200), (T) => head(T) + chat({ lines: ['Net sales −11% vs expected Tue–Thu · $38k, the last 3 days', '412 top-20% customers have not visited in 45+ days · $60–100k', 'Evanston: 11,400 reachable adults are not customers yet · $120–180k', 'Customers stay 7.4 months vs 9.1 at peers · $60–90k', 'Lab results expire for 9 active SKUs in 6 days · $9.6k'] }, T + 1200), (T) => shelf({ rows: [['Flower', 38, 34], ['Vapes', 18, 22], ['Edibles', 12, 14], ['Pre-rolls', 17, 12], ['Concentrates', 9, 14], ['Other', 6, 4]], k: [['SKU productivity', '$6.3k', '90% of $7k', 'pace to goal'], ['Category mix vs state peers', '0.94', '−0.03', 'vs prior month'], ['Assortment index vs. market', '74', '−2', 'vs prior month'], ['Product fit for repeat', '71', '9 below', 'target 80–100']] }, T) + insight({ p: 'opportunity', asof: 'as of Oct 22', t: 'Concentrates 9% of sales vs 14% at peers', s: '4 of the state’s top-10 brands are not on your menu', v: '$12–20k', est: 1, vs: 'a month after 90 days', btn: 'Add 4 top brands', tag: 'What your shelf is missing' }, T + 2600), (T) => pulse({ tab: 'operations', q: 'Is the floor running right?', title: 'Labour % of sales', metric: '24.5%', tone: 'good', sub: 'Up 0.7 pp vs Sep 2025. Ahead of 42% of similar stores. 18 decisions here, worth', est: '$77–117k est.', act: ['23.4%', 'by Dec · −1.2 pp'], base: ['24.6%'] }, T) + insight({ p: 'forecast', asof: 'as of Oct 22', t: 'Saturday traffic +15%, more than the schedule covers', s: 'The Brain expects 1,180–1,260 sales; the schedule covers about 1,050', v: '$7–11k', est: 1, loss: 1, vs: 'at risk Saturday', btn: 'Add Saturday hours', tag: 'Saturday, seen on Wednesday' }, T + 3200), (T) => table({ rows: [['Blue Dream 3.5g', 'Wicker Park', '1 day left', 'No order open'], ['Mango gummies 100mg', 'Lakeview', '1 day left', 'No order open'], ['Wedding Cake 3.5g', 'Wicker Park', '2 days left', 'On order, arrives Tue'], ['Sour Diesel pre-roll 1g', 'Lakeview', '3 days left', 'No order open']], k: [['Cash in inventory', '$2.90M', '$500k over', '$2.40M limit'], ['Stock-out rate by class', '3.1%', '1.1 pp over', '2.0% limit'], ['Aged stock $', '$386k', '$136k over', '$250k limit'], ['Received vs. sold', '83.0%', '−21.0 pp', 'vs prior 3 weeks']] }, T) + insight({ p: 'task', asof: 'as of today, 6:00 am', t: 'Orders for 4 vendors drafted; 2 need your approval', s: 'Heartland delivers Tuesday, so its order is due today', v: '$14k', vs: 'cash in the 2 orders', btn: 'Approve the orders', tag: 'Orders written before the shelf runs empty' }, T + 2400), (T) => slots(T) + insight({ p: 'opportunity', asof: 'as of Oct 22', t: 'Online conversion 2.1% vs 3.4% at peers: delivery slots full', s: '60% of drop-off is at delivery slots: full from 4 pm 5 days a week', v: '$9–14k', est: 1, vs: 'to gain a month', btn: 'Add delivery slots', tag: 'The missed window, before it’s missed' }, T + 2000), (T) => gauge(T) + insight({ p: 'risk', asof: 'as of this morning', t: 'Lab results expire in 6 days: 9 products, 3 bestsellers', s: 'Without new results they come off the menu on Oct 28', v: '$9.6k', loss: 1, vs: 'at risk in 14 days', btn: 'Request lab results', tag: 'Caught six days early' }, T + 2200), ] Object.assign(STAGES, { c1: io, c2: learned, c3: market, c4: att, c5: plan, c6: why, c7: predict }) const INS = [ { p: 'benchmark', asof: 'as of Oct 22', t: 'Baskets hold 1.3 fewer items than at peers', s: 'Accessories go in 27% of baskets vs 38% at peers', v: '$18–26k', est: 1, vs: 'to gain a month', btn: 'Suggest add-ons' }, { p: 'task', asof: 'as of today, 6:00 am', t: '4 campaign drafts are ready; 1 weak journey paused', s: 'The paused journey converted 3 per 1,000 vs 15 at benchmark', v: '$9–14k', est: 1, vs: 'to gain in 30 days', btn: 'Review 4 drafts' }, { p: 'risk', asof: 'as of Oct 22', t: '412 top customers haven’t visited in 45+ days', s: 'Nobody has messaged them in 90 days', v: '$60–100k', est: 1, vs: 'to win back in 60 days', btn: 'Review win-back draft' }, { p: 'risk', asof: 'as of this morning', t: 'Only 48% of Newark baskets are tied to a customer', s: 'Guest checkout is on by default; two budtenders rarely look customers up', v: '$3–6k', est: 1, vs: 'to gain a month', btn: 'Prompt sign-ups' }, null, { p: 'opportunity', asof: 'as of Oct 22', t: 'Concentrates 9% of sales vs 14% at peers', s: '4 of the state’s top-10 brands are not on your menu', v: '$12–20k', est: 1, vs: 'a month after 90 days', btn: 'Add 4 top brands' }, { p: 'forecast', asof: 'as of Oct 22', t: 'Saturday traffic +15%, more than the schedule covers', s: 'The Brain expects 1,180–1,260 sales; the schedule covers about 1,050', v: '$7–11k', est: 1, loss: 1, vs: 'at risk Saturday', btn: 'Add Saturday hours' }, { p: 'task', asof: 'as of today, 6:00 am', t: 'Orders for 4 vendors drafted; 2 need your approval', s: 'Heartland delivers Tuesday, so its order is due today', v: '$14k', vs: 'cash in the 2 orders', btn: 'Approve the orders' }, { p: 'opportunity', asof: 'as of Oct 22', t: 'Online conversion 2.1% vs 3.4% at peers: delivery slots full', s: '60% of drop-off is at delivery slots: full from 4 pm 5 days a week', v: '$9–14k', est: 1, vs: 'to gain a month', btn: 'Add delivery slots' }, { p: 'risk', asof: 'as of this morning', t: 'Lab results expire in 6 days: 9 products, 3 bestsellers', s: 'Without new results they come off the menu on Oct 28', v: '$9.6k', loss: 1, vs: 'at risk in 14 days', btn: 'Request lab results' }, ] INS.forEach((n, k) => { STAGES['m' + k] = n ? (T) => insight(n, T, 'solo') : (T) => chat({ lines: ['Net sales −11% vs expected Tue–Thu · $38k', '412 top-20% customers not seen in 45+ days · $60–100k', 'Evanston: 11,400 adults not customers yet · $120–180k'] }, T, 'solo') }) // ── mount and play ── // spec order 0:48 connects, 0:55 learns, 0:58 market, 1:03 insights, 1:09 explains, 1:13 action plan, 1:19 gains const SCENE = ['c1', 'c2', 'c3', 'c4', 'c6', 'c5', 'c7'] const FR = window.FR || [] FR.forEach((f, i) => { const st = $(`.stage[data-k="${SCENE[i]}"]`), vp = f.stage && f.stage.closest('.vs-viewport'); if (!st || !vp) return st.dataset.scene = i; st.innerHTML = '
'; const box = st.firstChild; box.appendChild(vp) f.box = box; f.vp = vp; f.crop = null; f.t = 0; f.done = false; f.free = ['c1', 'c2', 'c3'].includes(SCENE[i]) // the cards keep streaming }) // the part of the 1920×1080 frame the interface uses (title hidden), measured on the scene's last pose const measure = (f) => { f.stage.style.transform = 'scale(1)' const sr = f.stage.getBoundingClientRect(), k = sr.width / 1920; if (!k) return null let x0 = 1920, y0 = 1080, x1 = 0, y1 = 0 for (const u of [.25, .4, .55, .7, .85, .97]) { f.render(f.DUR * u); $$('*', f.stage).forEach((e) => { if (e.closest('[class$="-title"],.vs-title,canvas,svg.sb-brain:not(.sb-lock)') || e.children.length > 6) return const r0 = e.getBoundingClientRect(), cs = getComputedStyle(e); let r = { left: r0.left, top: r0.top, right: r0.right, bottom: r0.bottom } // only the part a clipping parent inside the scene actually shows for (let q = e.parentElement; q && q !== f.stage; q = q.parentElement) { const o = getComputedStyle(q).overflow; if (o === 'visible') continue; const c = q.getBoundingClientRect(); r = { left: Math.max(r.left, c.left), top: Math.max(r.top, c.top), right: Math.min(r.right, c.right), bottom: Math.min(r.bottom, c.bottom) } } r.width = r.right - r.left; r.height = r.bottom - r.top; if (r.width < 4 || r.height < 4 || (r.width / k > 1700 && r.height / k > 900) || +cs.opacity < .05 || cs.visibility === 'hidden') return x0 = Math.min(x0, (r.left - sr.left) / k); y0 = Math.min(y0, (r.top - sr.top) / k); x1 = Math.max(x1, (r.right - sr.left) / k); y1 = Math.max(y1, (r.bottom - sr.top) / k) }) } f.render(0) const pad = 36; x0 = Math.max(0, x0 - pad); y0 = Math.max(0, y0 - pad); x1 = Math.min(1920, x1 + pad); y1 = Math.min(1080, y1 + pad) return x1 > x0 && y1 > y0 ? { x: x0, y: y0, w: x1 - x0, h: y1 - y0 } : { x: 0, y: 0, w: 1920, h: 1080 } } const fit = (f) => { const W = f.box.clientWidth; if (!W) return f.vp.style.width = '1920px'; if (!f.crop) f.crop = measure(f) || { x: 0, y: 0, w: 1920, h: 1080 } const c = f.crop, s = W / c.w f.vp.style.width = (1920 * s) + 'px'; f.vp.style.marginLeft = (-c.x * s) + 'px'; f.vp.style.marginTop = (-c.y * s) + 'px'; f.box.style.height = (c.h * s) + 'px'; f.stage.style.transform = `scale(${s})` f.render(f.t) } // each scene plays once and stops on its fullest moment, so nothing on it disappears again (the cards in the first one keep streaming) const HOLD = { c4: 5.25, c6: 4, c5: 4.6, c7: 5.5 } const run = (f) => { if (f.raf || f.done) return; const t0 = performance.now() - f.t * 1000 const step = (now) => { if (!f.on) { f.raf = 0; return } const e = (now - t0) / 1000 if (!f.free && e >= f.hold) { f.t = f.hold; f.render(f.t); f.done = true; f.raf = 0; return } f.t = e; f.render(f.t); f.raf = requestAnimationFrame(step) } f.raf = requestAnimationFrame(step) } FR.forEach((f) => { if (!f.box) return new ResizeObserver(() => fit(f)).observe(f.box) f.hold = HOLD[f.box.parentElement.dataset.k] ?? f.DUR * .6 if (reduce) { f.t = f.free ? f.DUR * .6 : f.hold; f.done = true; return } new IntersectionObserver(([e]) => { f.on = e.isIntersecting; if (f.on) run(f) }, { threshold: .15 }).observe(f.box) }) // glints on the brain, as on the film's figures: comets with an 8-step white tail run along the contour, fading in and out. // A canvas sits over the svg inside its parent, so it follows every transform the scene puts on the brain. const glint = (svg, n = 6) => { if (!svg || reduce) return const host = svg.parentElement; if (getComputedStyle(host).position === 'static') host.style.position = 'relative' const cv = document.createElement('canvas'); cv.setAttribute('aria-hidden', 'true'); cv.className = 'glc' cv.style.cssText = 'position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;display:block;transform:none'; svg.after(cv) const g = cv.getContext('2d'), NS = 'http://www.w3.org/2000/svg', hsh = (i, k) => { const x = Math.sin(i * 127.1 + k * 311.7) * 43758.5453; return x - Math.floor(x) } const probe = document.createElementNS(NS, 'path'); probe.setAttribute('fill', 'none'); svg.appendChild(probe) const VBW = svg.viewBox.baseVal && svg.viewBox.baseVal.width || 197 const PL = [...svg.querySelectorAll('path')].filter((p) => p !== probe && (p.getAttribute('stroke') || 'none') !== 'none').flatMap((p) => (p.getAttribute('d').match(/M[^M]*/g) || []).map((d) => { probe.setAttribute('d', d) const Ln = probe.getTotalLength(), m = Math.max(2, Math.round(Ln / 2)), pts = [], cum = [0] for (let i = 0; i <= m; i++) { const q = probe.getPointAtLength(Ln * i / m); pts.push([q.x, q.y]); if (i) cum.push(cum[i - 1] + Math.hypot(q.x - pts[i - 1][0], q.y - pts[i - 1][1])) } return { pts, cum, L: cum[m] } })).filter((q) => q.L > 24) probe.setAttribute('d', 'M0 0') const at = (pl, s) => { s = Math.max(0, Math.min(pl.L, s)); let k = 1; while (k < pl.cum.length - 1 && pl.cum[k] < s) k++; const f = (s - pl.cum[k - 1]) / ((pl.cum[k] - pl.cum[k - 1]) || 1); return [pl.pts[k - 1][0] + (pl.pts[k][0] - pl.pts[k - 1][0]) * f, pl.pts[k - 1][1] + (pl.pts[k][1] - pl.pts[k - 1][1]) * f] } let on = false, raf = 0, bw = 0 const draw = (now) => { raf = on ? requestAnimationFrame(draw) : 0 const sr = svg.getBoundingClientRect(), lw = svg.clientWidth || 1, sc = sr.width / lw; if (!sr.width) return const hr = host.getBoundingClientRect(), w = lw, h = sr.height / sc, pad = w * .14, x = (sr.left - hr.left) / sc - pad, y = (sr.top - hr.top) / sc - pad, cw = w + 2 * pad, ch = h + 2 * pad Object.assign(cv.style, { left: x + 'px', top: y + 'px', width: cw + 'px', height: ch + 'px' }) const d = Math.min(devicePixelRatio || 1, 2) * sc, W = Math.round(cw * d) if (Math.abs(W - bw) > bw * .08) { bw = W; cv.width = W; cv.height = Math.round(ch * d) } const dd = cv.width / cw; g.setTransform(dd, 0, 0, dd, 0, 0); g.clearRect(0, 0, cw, ch); g.lineCap = 'round' const k = w / VBW, P = (q) => [pad + q[0] * k, pad + q[1] * k], T = now / 1000 for (let c = 0; c < n; c++) { const D = 1.1 + hsh(c, 41) * .8, ph = T / D + hsh(c, 42), sl = Math.floor(ph), u = ph - sl, pl = PL[Math.floor(hsh(sl * 13 + c, 43) * PL.length)] const run = Math.min(pl.L, 150), s0 = hsh(sl * 7 + c, 44) * (pl.L - run), tail = 46, head = s0 + u * (run + tail), fade = Math.min(1, u * 6, (1 - u) * 5) const t0 = Math.max(s0, head - tail), t1 = Math.min(s0 + run, head); if (t1 - t0 < 1) continue const pts = []; for (let q = 0; q <= 16; q++) pts.push(P(at(pl, t0 + (t1 - t0) * q / 16))) const A = pts[0], B = pts[pts.length - 1], lg = g.createLinearGradient(A[0], A[1], B[0], B[1]) lg.addColorStop(0, 'rgba(255,255,255,0)'); lg.addColorStop(1, `rgba(255,255,255,${(.95 * fade).toFixed(3)})`) g.strokeStyle = lg; g.lineWidth = 6.2 * k * .7; g.beginPath(); pts.forEach((p, i) => i ? g.lineTo(p[0], p[1]) : g.moveTo(p[0], p[1])); g.stroke() } } new IntersectionObserver(([e]) => { on = e.isIntersecting; if (on && !raf) raf = requestAnimationFrame(draw) }).observe(svg) } glint($('.mark svg')) { const c = $('.stage[data-k="c1"] .c1-sph canvas'); if (false && c && window.SweedSphere) SweedSphere(c, { nodes: 190, threshold: .33, radius: .29, signals: 0, glow: false, comets: 5, pale: true, spin: .06, tail: .2, cdur: 3.2 }) } glint($('.stage[data-k="c2"] .f2-brain > .sb-brain')) // «Generic AI answers questions»: the Sweed Brain background (the film's field: nodes, links by distance, glints running link to link) ;(() => { const band = $('.genband'), cv = band && $('.gnet', band); if (!cv) return const g = cv.getContext('2d'), hsh = (i, k) => { const x = Math.sin(i * 127.1 + k * 311.7) * 43758.5453; return x - Math.floor(x) } let W = 0, H = 0, N = [], on = false, raf = 0 const size = () => { const r = cv.getBoundingClientRect(), d = Math.min(devicePixelRatio || 1, 2); W = r.width; H = r.height; cv.width = Math.round(W * d); cv.height = Math.round(H * d); g.setTransform(d, 0, 0, d, 0, 0) const n = Math.round(Math.min(110, Math.max(36, W * H / 17000))) N = Array.from({ length: n }, (_, i) => ({ x: hsh(i, 1) * W, y: hsh(i, 2) * H, ph: hsh(i, 3) * 6.28, r: hsh(i, 4) < .12 ? 2.6 : 1 + hsh(i, 5) * 1.2, hub: hsh(i, 4) < .12 })) if (!raf) draw(performance.now()) } const LK = 175, TEAL = '84,200,212' const draw = (now) => { raf = on && !reduce ? requestAnimationFrame(draw) : 0; const T = now / 1000 g.clearRect(0, 0, W, H) const P = N.map((n) => [n.x + Math.sin(T * .22 + n.ph) * 22, n.y + Math.cos(T * .18 + n.ph) * 16]) g.lineWidth = 1 for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) { const dx = P[i][0] - P[j][0], dy = P[i][1] - P[j][1]; if (dx > LK || dx < -LK) continue; const d = Math.hypot(dx, dy); if (d >= LK) continue g.strokeStyle = `rgba(${TEAL},${(.34 * (1 - d / LK)).toFixed(3)})`; g.beginPath(); g.moveTo(P[i][0], P[i][1]); g.lineTo(P[j][0], P[j][1]); g.stroke() } N.forEach((n, i) => { const [x, y] = P[i] if (n.hub) { const rg = g.createRadialGradient(x, y, 0, x, y, 14); rg.addColorStop(0, `rgba(${TEAL},.35)`); rg.addColorStop(1, `rgba(${TEAL},0)`); g.fillStyle = rg; g.fillRect(x - 14, y - 14, 28, 28) } g.fillStyle = n.hub ? 'rgba(190,245,245,.95)' : `rgba(${TEAL},.8)`; g.beginPath(); g.arc(x, y, n.r, 0, 6.283); g.fill() }) // glints: a short comet runs link after link, about five hops, then fades g.lineCap = 'round' for (let k = 0; k < 9; k++) { const D = 1.6 + hsh(k, 6) * 1.1, ph = T / D + hsh(k, 7), sl = Math.floor(ph), u = ph - sl let a = Math.floor(hsh(sl * 31 + k, 8) * P.length); const th = hsh(sl * 17 + k, 9) * 6.283, dxp = Math.cos(th), dyp = Math.sin(th), pts = [P[a]] for (let hop = 0; hop < 5; hop++) { let best = -1, bs = .2 for (let m = 0; m < P.length; m++) { if (m === a) continue; const sx = P[m][0] - P[a][0], sy = P[m][1] - P[a][1], l = Math.hypot(sx, sy); if (l >= LK || !l) continue; const dt = (sx * dxp + sy * dyp) / l; if (dt > bs) { bs = dt; best = m } } if (best < 0) break; a = best; pts.push(P[a]) } if (pts.length < 2) continue const seg = []; let L = 0; for (let i = 1; i < pts.length; i++) { const l = Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]); seg.push(l); L += l } const tail = 90, head = u * (L + tail), at = (q) => { q = Math.max(0, Math.min(L, q)); let i = 0; while (i < seg.length - 1 && q > seg[i]) { q -= seg[i]; i++ } const f = seg[i] ? Math.min(1, q / seg[i]) : 0; return [pts[i][0] + (pts[i + 1][0] - pts[i][0]) * f, pts[i][1] + (pts[i + 1][1] - pts[i][1]) * f] } const fade = Math.min(1, u * 6, (1 - u) * 5) for (let q = 0; q < 8; q++) { const s0 = head - tail * (1 - q / 8), s1 = head - tail * (1 - (q + 1) / 8); if (s1 < 0 || s0 > L) continue; const p0 = at(s0), p1 = at(s1) g.strokeStyle = q > 5 ? `rgba(255,255,255,${(fade * (q + 1) / 8).toFixed(3)})` : `rgba(170,240,240,${(fade * (q + 1) / 8).toFixed(3)})`; g.lineWidth = 1.2 + 2 * (q + 1) / 8; g.beginPath(); g.moveTo(p0[0], p0[1]); g.lineTo(p1[0], p1[1]); g.stroke() } if (head <= L) { const hp = at(head), rg = g.createRadialGradient(hp[0], hp[1], 0, hp[0], hp[1], 9); rg.addColorStop(0, `rgba(255,255,255,${fade.toFixed(3)})`); rg.addColorStop(1, 'rgba(170,240,240,0)'); g.fillStyle = rg; g.fillRect(hp[0] - 9, hp[1] - 9, 18, 18) } } } new ResizeObserver(size).observe(cv) new IntersectionObserver(([e]) => { on = e.isIntersecting; if (on && !raf) raf = requestAnimationFrame(draw) }).observe(band) })() // «Generic AI answers questions»: the logo, then each line, come up calmly one after another; then a light passes over «Sweed Brain» ;(() => { const gen = $('.genband .gen'); if (!gen || reduce) return gen.classList.remove('rv'); [...gen.children].forEach((el, i) => el.style.setProperty('--d', (i * 280) + 'ms')) gen.style.setProperty('--shine', (gen.children.length * 280 + 900) + 'ms') new IntersectionObserver(([e], o) => { if (e.isIntersecting) { gen.classList.add('go'); o.disconnect() } }, { threshold: .35 }).observe(gen) })() glint($('.genlogo svg'), 5) glint($('.gtet .gbrain svg'), 5) glint($('.flow-mark svg'), 5) const beats = $$('.beat,.bcard') beats.forEach((b) => { const st = $('.stage', b); if (st && st.dataset.scene == null) st.innerHTML = '
' + STAGES[st.dataset.k](0) + '
' }) // Brains panel: each Brain's own live screen on top of its panel, everything shown at once ;(() => { const w = $('.bxw'); if (!w) return; if (!w.dataset.v) return $$('.bxv .stage', w).forEach((st) => { st.innerHTML = '
' + STAGES[st.dataset.k](0) + '
'; $$('[data-at]', st).forEach((e) => e.classList.add('on')) }) })() const timers = new WeakMap() const tick = (bars) => { const is = [...bars.children]; const hs = is.map((i) => i.style.getPropertyValue('--h')); hs.shift(); hs.push((.35 + Math.random() * .6).toFixed(2)); is.forEach((i, k) => i.style.setProperty('--h', hs[k])) } const play = (b) => { if (reduce) { $$('[data-at]', b).forEach((e) => e.classList.add('on')); return } $$('[data-at]', b).forEach((e) => setTimeout(() => e.classList.add('on'), +e.dataset.at * .7)) } const seen = new IntersectionObserver((es) => es.forEach((e) => { const b = e.target if (e.isIntersecting && !b.classList.contains('in')) { b.classList.add('in'); play(b) } // the live bars tick only while their beat is on screen const bars = $('[data-live]', b); if (!bars || reduce) return clearInterval(timers.get(b)) if (e.isIntersecting) timers.set(b, setInterval(() => { if (bars.classList.contains('on')) { bars.classList.add('tick'); tick(bars) } }, 1600)) }), { threshold: .3 }) beats.forEach((b) => seen.observe(b)) })()