The showcase prompt, Opus 5.5
agent
+8:57reasoning
I'm building a single self-contained HTML file: the page opens on "what models do you use?", the source code floods into a 3D citadel where each tower is one of your real projects, and it shows off a raw WebGL engine with no libraries. After that I'll render a video of it for platforms that can't embed HTML.
Write~/showcase-iso-TI9oBhZi/run/citadel/index.html
input
~/showcase-iso-TI9oBhZi/run/citadel/index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Citadel - what models I use</title> <meta name="description" content="What models I use, and what they're doing right now. A citadel built from its own source code."> <meta property="og:title" content="Citadel - what models I use"> <meta property="og:description" content="Every glyph in this scene is a character of the page's own source. One file, no libraries, written by Claude Opus 5.5."> <meta property="og:image" content="preview.png"> <meta name="twitter:card" content="summary_large_image"> <style> :root{--ink:#ebe5da;--dim:#8f8a82;--faint:#57534d;--opus:#ed875c;--sonnet:#5cd9c7;--fable:#b78fff;--astra:#78adff;--sol:#f9d161;--you:#fff7e6;--clav:#99eb6b; --mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,"DejaVu Sans Mono",monospace;--serif:"Iowan Old Style","Palatino Linotype",Palatino,"Book Antiqua",Georgia,serif} *{box-sizing:border-box} html,body{margin:0;height:100%;overflow:hidden;color:var(--ink);font:11.5px/1.45 var(--mono); background:radial-gradient(130% 80% at 50% 78%,#151a24 0%,#0a0c11 48%,#040406 100%);-webkit-font-smoothing:antialiased;user-select:none;-webkit-user-select:none;touch-action:none} canvas{position:fixed;inset:0;width:100%;height:100%;display:block} #gl{z-index:1}#fx{z-index:2;pointer-events:none} #sun{position:fixed;left:0;top:0;z-index:0;width:520px;height:520px;margin:-260px 0 0 -260px;border-radius:50%;pointer-events:none;opacity:0; background:radial-gradient(circle,rgba(214,74,46,.55) 0,rgba(176,52,36,.42) 9%,rgba(140,38,30,.16) 24%,rgba(90,24,24,.06) 44%,transparent 66%)} .ui{position:fixed;z-index:3;opacity:0} #head{left:22px;top:18px;max-width:46vw} .eyebrow{letter-spacing:.32em;font-size:10px;color:var(--dim)} .eyebrow b{color:var(--opus);font-weight:500} h1{font:400 clamp(19px,2.35vw,34px)/1.12 var(--serif);margin:.35em 0 0;letter-spacing:-.005em} h1 em{color:var(--dim);font-style:italic} #roster{right:20px;top:18px;width:300px} .rh,.lh{display:flex;justify-content:space-between;letter-spacing:.24em;font-size:9.5px;color:var(--dim);border-bottom:1px solid #2a2a2c;padding-bottom:5px;margin-bottom:7px} .m{display:grid;grid-template-columns:12px 1fr;column-gap:7px;padding:4px 6px;margin:0 -6px;border-radius:4px;cursor:default} .m:hover{background:rgba(255,255,255,.05)} .m i{width:7px;height:7px;border-radius:50%;margin-top:5px;background:currentColor;box-shadow:0 0 10px currentColor} .m b{font-weight:600;color:var(--ink)}.m b small{color:var(--dim);font-weight:400;font-size:10px;margin-left:5px} .m span{grid-column:2;color:var(--dim);font-size:10.5px;line-height:1.35} #ledger{left:22px;bottom:18px;width:min(560px,52vw)} .lh em{font-style:normal;color:var(--faint);letter-spacing:.06em} #lines{height:146px;overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end} .ln{display:grid;grid-template-columns:62px 84px 1fr;white-space:nowrap;padding:1.5px 0} .ln time{color:var(--faint)}.ln b{font-weight:600;font-size:10px;letter-spacing:.04em;padding-top:1px} .ln span{overflow:hidden;text-overflow:ellipsis;color:#cfc8bc}.ln span em{font-style:normal;color:var(--dim)} .lf{margin-top:7px;color:var(--dim);font-size:10.5px;border-top:1px solid #2a2a2c;padding-top:6px} .lf b{color:var(--you);font-weight:600} #say{position:fixed;z-index:3;left:50%;bottom:clamp(190px,24vh,250px);transform:translateX(-50%);width:min(760px,92vw);text-align:center;pointer-events:none; font:400 clamp(16px,1.75vw,24px)/1.35 var(--serif);text-shadow:0 2px 18px #000,0 0 3px #000;opacity:0} #say b{font-weight:600} #ctl{right:20px;bottom:18px;text-align:right;width:300px} #ctl button{font:inherit;font-size:10.5px;letter-spacing:.12em;color:var(--ink);background:rgba(255,255,255,.04);border:1px solid #39383a;border-radius:3px;padding:6px 10px;margin-left:6px;cursor:pointer} #ctl button:hover{border-color:var(--opus);color:#fff} #colo{margin-top:10px;color:var(--dim);font-size:10px;line-height:1.5} #colo b{color:var(--ink);font-weight:500} #intro{position:fixed;inset:0;z-index:4;display:flex;align-items:center;justify-content:center;pointer-events:none} #q{font:400 clamp(22px,3.7vw,48px)/1.2 var(--mono);letter-spacing:-.01em;padding:0 6vw} #q small{display:block;font-size:11px;letter-spacing:.3em;color:var(--dim);margin-bottom:14px} #cur{display:inline-block;width:.55em;height:1.05em;vertical-align:-.15em;background:var(--opus);margin-left:3px} #cap{position:fixed;z-index:4;left:50%;bottom:9vh;transform:translateX(-50%);padding:9px 16px;background:rgba(4,4,6,.82);border:1px solid #2c2c2e;border-radius:3px; font:12px/1.4 var(--mono);letter-spacing:.06em;white-space:nowrap;opacity:0;pointer-events:none} #cap b{color:var(--opus);font-weight:600} #hint{position:fixed;z-index:4;right:20px;bottom:16px;color:var(--faint);font-size:10px;letter-spacing:.2em;opacity:0;pointer-events:none} #card{position:fixed;z-index:5;width:270px;padding:12px 14px 12px;background:rgba(10,10,13,.94);border:1px solid #333;border-radius:5px;display:none;box-shadow:0 10px 40px rgba(0,0,0,.6)} #card h3{margin:0 0 4px;font:600 15px/1.2 var(--serif)} #card p{margin:0 0 8px;color:#c9c2b6;font-size:11px} #card .by{display:flex;flex-wrap:wrap;gap:5px} #card .by span{font-size:9.5px;letter-spacing:.06em;border:1px solid currentColor;border-radius:9px;padding:1px 7px} #card a{display:inline-block;margin-top:9px;color:var(--opus);text-decoration:none;font-size:10.5px} #card a:hover{text-decoration:underline} #srcnote{position:fixed;z-index:3;left:50%;top:14px;transform:translateX(-50%);padding:7px 14px;background:rgba(4,4,6,.86);border:1px solid #2c2c2e;border-radius:3px;font-size:11px;letter-spacing:.05em;opacity:0;pointer-events:none;white-space:nowrap} #nogl{position:fixed;inset:auto 0 45% 0;text-align:center;color:var(--dim);z-index:4;display:none} @media (max-width:860px){ #roster{display:none} #head{max-width:80vw} #ledger{width:calc(100vw - 40px);bottom:64px} #lines{height:76px}.ln{grid-template-columns:56px 76px 1fr;font-size:10px} #ctl{width:auto;left:20px;right:20px;bottom:14px;text-align:left} #ctl button{margin:0 6px 0 0} #colo{display:none} #say{bottom:auto;top:30vh} } @media (max-height:520px){#lines{height:60px}#roster .m span{display:none}} </style> </head> <body> <div id="sun"></div> <canvas id="gl"></canvas> <canvas id="fx"></canvas> <header id="head" class="ui"> <div class="eyebrow">SEVERIAN · <b>CITADEL</b></div> <h1>What models I use,<br><em>and what they're doing right now.</em></h1> </header> <aside id="roster" class="ui"> <div class="rh"><span>THE ROSTER</span><span>hover</span></div> <div class="m" data-m="opus" style="color:var(--opus)"><i></i><b>Opus 5.5<small>Anthropic</small></b><span>The lead and most project sessions. Builds sites, tools and server kits, and reviews pages.</span></div> <div class="m" data-m="sonnet" style="color:var(--sonnet)"><i></i><b>Sonnet 5.5<small>Anthropic</small></b><span>The chores: rebases, test runs, writing test conversations.</span></div> <div class="m" data-m="fable" style="color:var(--fable)"><i></i><b>Fable 5.2<small>Anthropic</small></b><span>Design collaborator and critic. A visual language, site redesigns, 3D pipeline experiments.</span></div> <div class="m" data-m="astra" style="color:var(--astra)"><i></i><b>GPT-6-Astra<small>via Codex</small></b><span>Every design critique, plus writing and labelling test data.</span></div> <div class="m" data-m="sol" style="color:var(--sol)"><i></i><b>GPT-6.1-Sol<small>via Codex</small></b><span>Reviews code and deployment kits against the claims they make.</span></div> <div class="m" data-m="clav" style="color:var(--clav)"><i></i><b>Claviger<small>Laya-421M, mine</small></b><span>A small open-weights model that triages Discord messages for the agents.</span></div> <div class="m" data-m="you" style="color:var(--you)"><i></i><b>Me</b><span>The gate. I approve every deploy and every public post.</span></div> </aside> <section id="ledger" class="ui"> <div class="lh"><span>SHARED LEDGER</span><em>replay · illustrative</em><span id="clock">09:12:00</span></div> <div id="lines"></div> <div class="lf"><span id="cOpen">23</span> open · <span id="cShip">0</span> shipped · <b id="cWait">0</b> awaiting my approval</div> </section> <nav id="ctl" class="ui"> <button id="bSrc">VIEW SOURCE</button><button id="bSnd">SOUND: OFF</button> <div id="colo"></div> </nav> <div id="say"></div> <div id="srcnote">this is the entire page · scroll to read it · <b>rebuild</b> to put it back</div> <div id="intro"><div id="q"><small>SOMEONE ASKS</small><span id="qt"></span><i id="cur"></i></div></div> <div id="cap"></div> <div id="hint">CLICK TO SKIP</div> <div id="card"></div> <div id="nogl">This piece needs WebGL. The roster above is the short answer.</div> <noscript><p style="position:fixed;top:40%;width:100%;text-align:center">This piece is made of its own JavaScript, so it needs JavaScript.</p></noscript> <script> /* CITADEL - every glyph in the scene is a character of this file. One file. No libraries, no images, no fonts, no network. */ (() => { 'use strict'; const SRC = '<!doctype html>\n' + document.documentElement.outerHTML; const QS = new URLSearchParams(location.search); const CAPTURE = QS.has('capture'); const REDUCED = matchMedia('(prefers-reduced-motion: reduce)').matches; const TAU = Math.PI * 2, DEG = Math.PI / 180; const $ = s => document.querySelector(s); const clamp = (x, a, b) => x < a ? a : x > b ? b : x; const lerp = (a, b, t) => a + (b - a) * t; const smooth = (a, b, x) => { const t = clamp((x - a) / (b - a), 0, 1); return t * t * (3 - 2 * t); }; const ease = t => t < .5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; const rng = seed => () => { seed = seed + 0x6D2B79F5 | 0; let t = Math.imul(seed ^ seed >>> 15, 1 | seed); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; const G = rng(1729), D = rng(4077); const pick = (a, r = D) => a[Math.floor(r() * a.length)]; const int = (a, b) => a + Math.floor(D() * (b - a + 1)); /* ---------------------------------------------------------------- the cast */ const C = { opus:[.93,.53,.36], sonnet:[.36,.85,.78], fable:[.72,.56,1], astra:[.47,.68,1], sol:[.98,.82,.38], clav:[.6,.92,.42], you:[1,.97,.9] }; const TAG = { opus:'OPUS 5.5', sonnet:'SONNET 5.5', fable:'FABLE 5.2', astra:'GPT-6-ASTRA', sol:'GPT-6.1-SOL', clav:'CLAVIGER', you:'SEVERIAN' }; const NAME = { opus:'Opus 5.5', sonnet:'Sonnet 5.5', fable:'Fable 5.2', astra:'GPT-6-Astra', sol:'GPT-6.1-Sol', clav:'Claviger', you:'Severian' }; const rgb = (c, a = 1) => `rgba(${c.map(v => Math.round(v * 255)).join(',')},${a})`; const STONE = [.84, .78, .69]; const tint = (c, k) => STONE.map((s, i) => lerp(s, c[i], k)); const ALL = ['opus', 'sonnet', 'astra', 'sol']; const T = [ { slug:'lead', name:'The lead session', a:0, d:0, r:1.05, h:9.2, roof:3.0, cap:'spire', base:tint(C.opus,.5), by:['opus'], desc:'Coordinates every other session through one shared to-do ledger. Each session owns exactly one project.' }, { slug:'from-avalon', name:'from-avalon.com', a:30, d:4.5, r:.8, h:6.4, roof:1.7, by:['opus','fable',...ALL.slice(1)], url:'https://from-avalon.com', desc:'Home of Avalon, an online creative community.', tasks:['rebuild the member gallery grid','lazy-load the archive images','fix nav focus states','new events page'] }, { slug:'into-bloom', name:'Into Bloom', a:100, d:4.5, r:.62, h:5.2, roof:1.5, by:['opus','fable',...ALL.slice(1)], desc:'An Avalon collab site.', tasks:['seasonal palette pass','submission form validation','collab credits page'] }, { slug:'hearthwynd', name:'Hearthwynd', a:168, d:4.5, r:.66, h:5.8, roof:1.6, by:['opus','fable',...ALL.slice(1)], desc:'An Avalon collab site.', tasks:['map page, mobile first','lore index search','contrast pass for accessibility'] }, { slug:'design-lang', name:'Design language', a:232, d:4.5, r:.6, h:4.6, roof:1.3, base:tint(C.fable,.32), by:['opus','fable','astra'], desc:'A visual language for my sites, built from a decal pack, worked out with Fable 5.2.', tasks:['token sheet from the decal pack','type scale study','icon set consistency pass'] }, { slug:'trackers', name:'Project trackers', a:318, d:4.5, r:.55, h:4.2, roof:1.2, by:ALL, url:'https://citadel.severian.dev/projects', desc:'Public trackers for every project, synced from the ledger.', tasks:['sync trackers from the ledger','status badges per project'] }, { slug:'desktop-buddies', name:'Desktop Buddies', a:345, d:7.3, r:.58, h:3.6, roof:1.2, by:ALL, desc:'An open-source desktop pet maker.', tasks:['sprite import for GIF sheets','tray menu fix on Windows','release notes draft'] }, { slug:'scene-convert', name:'Scene Convert', a:62, d:7.3, r:.5, h:3.2, roof:1.0, by:ALL, desc:'A converter for image-scene files.', tasks:['batch mode for scene files','round-trip test fixtures','CLI help text'] }, { slug:'claviger', name:'Claviger', a:132, d:7.3, r:.55, h:3.9, roof:1.2, base:tint(C.clav,.35), by:['clav','opus','sonnet','astra'], url:'https://huggingface.co/finis-est/Laya-421M-Claviger-v0', desc:'Laya-421M, a small open-weights model of mine that triages Discord messages for the agents.', tasks:['eval run on held-out messages','threshold tuning for "urgent"','model card update'] }, { slug:'3d-pipeline', name:'3D pipeline', a:205, d:7.3, r:.62, h:4.4, roof:1.3, base:tint(C.fable,.25), by:['opus','fable','sonnet'], desc:'A 3D model pipeline. Fable 5.2 runs experiments on it.', tasks:['retopology step','texture bake queue','export presets'] }, { slug:'talos', name:'talos.severian.dev', a:262, d:7.3, r:.5, h:3.5, roof:1.1, by:['opus','astra','sonnet'], url:'https://talos.severian.dev', post:true, desc:'Where I post write-ups.', tasks:['write-up draft: one ledger, many sessions','write-up: how review pages work'] }, { slug:'baldanders', name:'baldanders.severian.dev', a:300, d:7.3, r:.5, h:3.3, roof:1.0, by:['opus','sonnet'], url:'https://baldanders.severian.dev', post:true, desc:'Redacted agent transcripts, in public.', tasks:['redact a transcript batch','index new transcripts'] }, { slug:'gate', name:'Severian (me)', a:0, d:10.5, r:1.0, h:2.5, roof:0, cap:'flat', base:tint(C.you,.7), by:['you'], desc:'The gate. Sessions show me their work on private review pages, and I approve every deploy and every public post.' }, { slug:'astra', name:'GPT-6-Astra, via Codex', a:-112, d:10.5, r:.62, h:3.6, roof:1.1, base:tint(C.astra,.55), by:['astra'], desc:'A watchtower on the outer wall. Every design critique, plus writing and labelling test data.' }, { slug:'sol', name:'GPT-6.1-Sol, via Codex', a:112, d:10.5, r:.62, h:3.6, roof:1.1, base:tint(C.sol,.55), by:['sol'], desc:'A watchtower on the outer wall. Reviews code and deployment kits against the claims they make.' }, ]; const LEAD = 0, GATE = 12, ASTRA = 13, SOL = 14, CLAV = 8; const PROJ = [1,2,3,4,5,6,7,8,9,10,11]; for (const t of T) { t.x = Math.sin(t.a * DEG) * t.d; t.z = Math.cos(t.a * DEG) * t.d; t.base = t.base || tint(C.opus, .14); t.top = t.h + (t.cap === 'flat' ? .5 : t.roof + .25); t.anchor = [t.x, t.h + .2, t.z]; t.act = { c:[1,1,1], a:0, until:0 }; t.flash = 0; t.hl = 0; t.hlT = 0; t.busy = false; } const CROWN = [0, T[0].h + T[0].roof + 1.9, 0]; /* ------------------------------------------- read this file into glyphs */ const WRAP = 96; const gC = [], gRow = [], gCol = []; { let row = 0, col = 0; for (const ch of SRC) { if (ch === '\n') { row++; col = 0; continue; } if (col >= WRAP) { row++; col = 4; } if (ch === '\t') { col += 2; continue; } if (ch === ' ' || ch === '\r') { col++; continue; } let k = ch.charCodeAt(0); if (k < 33 || k > 126) k = 42; gC.push(k - 33); gRow.push(row); gCol.push(col); col++; } } const NG = gC.length; /* ---------------------------------------- build the citadel out of them */ const WR = 10.5, WH = 1.25, STARS = 1400; function scene(s, emit) { const lh = s * 1.5; for (let rad = 1.5; rad < 16; rad += 1.15) { // ground: a dial const n = Math.round(TAU * rad / (s * 2.6)); for (let k = 0; k < n; k++) { const a = k / n * TAU; emit(0, Math.sin(a) * rad, 0, Math.cos(a) * rad, 0, 0, rad / 16, 15, s * 1.3); } } for (let i = 1; i < T.length; i++) { // roads: every session connects to the lead const t = T[i], L = Math.hypot(t.x, t.z), ux = t.x / L, uz = t.z / L; for (let r = 1.35; r < L - t.r - .15; r += s * 1.7) emit(0, ux * r, 0, uz * r, 0, 0, r / 16, 15, s * 1.35); } for (const [fr, sg] of [[WR + .2, 1], [WR - .2, -1]]) { // curtain wall with merlons const n = Math.round(TAU * fr / s); for (let y = 0; y < WH + (sg > 0 ? lh * 2.5 : 0); y += lh) for (let k = 0; k < n; k++) { const a = k / n * TAU, aw = Math.min(a, TAU - a); if (aw < .09) continue; if (y >= WH && (Math.floor(k / 4) & 1)) continue; emit(1, Math.sin(a) * fr, y, Math.cos(a) * fr, Math.sin(a) * sg, Math.cos(a) * sg, y / WH, 15, s * 1.55); } } T.forEach((t, id) => tower(t, id, s, emit)); } function tower(t, id, s, emit) { const lh = s * 1.5, H = t.h + t.roof + (t.cap === 'spire' ? 2 : 0), sz = s * 1.55; let ring = 0, rr = t.r; for (let y = 0; y < t.h; y += lh, ring++) { rr = t.r * (1 - .09 * y / t.h); const n = Math.max(8, Math.round(TAU * rr / s)); const win = t.h > 3 && y > .7 && y < t.h - .5 && (ring % 6 === 2 || ring % 6 === 3); const ws = Math.max(5, Math.round(n / 6)); for (let k = 0; k < n; k++) { const a = k / n * TAU, nx = Math.sin(a), nz = Math.cos(a); emit(win && k % ws === 0 ? 4 : 2, t.x + nx * rr, y, t.z + nz * rr, nx, nz, y / H, id, sz); } } const cr = rr * 1.16; for (let j = 0; j < 2; j++) { // cornice const n = Math.round(TAU * cr / s); for (let k = 0; k < n; k++) { const a = k / n * TAU; emit(2, t.x + Math.sin(a) * cr, t.h + j * lh, t.z + Math.cos(a) * cr, Math.sin(a), Math.cos(a), (t.h + j * lh) / H, id, sz); } } if (t.cap === 'flat') { // crenellated keep const n = Math.round(TAU * cr / s); for (let j = 2; j < 5; j++) for (let k = 0; k < n; k++) { if (Math.floor(k / 3) & 1) continue; const a = k / n * TAU; emit(2, t.x + Math.sin(a) * cr, t.h + j * lh, t.z + Math.cos(a) * cr, Math.sin(a), Math.cos(a), 1, id, sz); } return; } const y0 = t.h + 2 * lh; // roof cone for (let y = 0; y < t.roof; y += lh * .8) { const r2 = cr * 1.04 * (1 - y / t.roof), n = Math.max(1, Math.round(TAU * r2 / s)); for (let k = 0; k < n; k++) { const a = k / n * TAU + y; emit(2, t.x + Math.sin(a) * r2, y0 + y, t.z + Math.cos(a) * r2, Math.sin(a), Math.cos(a), (y0 + y) / H, id, sz); } } if (t.cap === 'spire') for (let y = 0; y < 2; y += s * .9) emit(2, t.x, y0 + t.roof + y, t.z, 0, 0, (y0 + t.roof + y) / H, id, sz); } const NP = Math.min(NG, 72000); let S = .1; { let lo = .015, hi = .5; // pick a glyph pitch so the citadel uses the whole file for (let i = 0; i < 24; i++) { S = (lo + hi) / 2; let n = 0; scene(S, () => n++); if (n > NP - STARS) lo = S; else hi = S; } S = hi; } const pts = []; scene(S, (...a) => pts.push(a)); for (let i = 0; i < STARS; i++) { const az = G() * TAU, el = Math.asin(.04 + G() * .96) , r = 90; pts.push([3, Math.cos(el) * Math.sin(az) * r, Math.sin(el) * r * .7 + 2, Math.cos(el) * Math.cos(az) * r, 0, 0, G(), 15, 0]); } const P = pts.length; const ATTR = new Float32Array(P * 11), START = new Float32Array(P * 2); pts.forEach((p, j) => { const o = j * 11, g = j % NG; ATTR[o] = p[1]; ATTR[o+1] = p[2]; ATTR[o+2] = p[3]; ATTR[o+3] = p[7]; ATTR[o+4] = p[6]; ATTR[o+5] = G(); ATTR[o+6] = p[0]; ATTR[o+7] = gC[g]; ATTR[o+8] = p[4]; ATTR[o+9] = p[5]; ATTR[o+10] = p[8]; }); /* -------------------------------------------------------------- webgl */ const cv = $('#gl'), fx = $('#fx'), ctx = fx.getContext('2d'); const gl = cv.getContext('webgl', { antialias:false, alpha:true, premultipliedAlpha:true, preserveDrawingBuffer:CAPTURE }); const VS = ` precision highp float; attribute vec3 aPos; attribute vec4 aMeta; attribute vec4 aX; attribute vec2 aStart; uniform mat4 uVP; uniform vec2 uRes; uniform vec3 uCam; uniform float uCell, uScroll, uBuild, uTime, uProj, uWallA, uDpr; uniform vec4 uCol[16]; uniform vec4 uAct[16]; uniform vec4 uFx[16]; varying vec3 vCol; varying float vA; varying vec2 vCell; void main(){ int id = int(aMeta.x + .5); float hn = aMeta.y, rnd = aMeta.z, kind = aMeta.w, ch = aX.x; bool isTower = kind > 1.5 && (kind < 2.5 || kind > 3.5); float d = kind < .5 ? hn * .14 : kind < 1.5 ? .1 + hn * .07 : kind < 3.5 && kind > 2.5 ? .62 + rnd * .2 : .15 + aPos.y / 13. * .5; float e = clamp((uBuild * 1.12 - d - rnd * .06) / .3, 0., 1.); e = e * e * (3. - 2. * e); vec4 clip = uVP * vec4(aPos, 1.); vec3 ndc = clip.xyz / max(clip.w, .001); vec2 sp = vec2(aStart.x, aStart.y - uScroll); vec2 sN = vec2(sp.x / uRes.x * 2. - 1., 1. - sp.y / uRes.y * 2.); float arc = sin(3.14159 * e); vec2 p = mix(sN, ndc.xy, e) + arc * vec2(cos(rnd * 44.), sin(rnd * 37.)) * (.12 + .3 * rnd); float z = mix(0., ndc.z, e); float pxEnd = kind > 2.5 && kind < 3.5 ? (1. + rnd * 2.2) * uDpr : aX.w * uProj / max(clip.w, .001); gl_PointSize = clamp(mix(uCell * 1.15, pxEnd, e), 1., 72.); if (clip.w < .2 && e > .5) { gl_Position = vec4(9., 9., 9., 1.); vA = 0.; return; } gl_Position = vec4(p, z, 1.); vec3 base; float al; if (kind < .5) { base = vec3(.32, .42, .56); al = .5 * (1. - hn * .65); } else if (kind < 1.5){ base = vec3(.66, .6, .52) * (.8 + .3 * hn); al = .55; } else if (kind < 2.5){ base = uCol[id].rgb * (.62 + .5 * hn); al = .72; } else if (kind < 3.5){ base = vec3(.75, .82, 1.); al = (.25 + .5 * fract(rnd * 13.)) * (.65 + .35 * sin(uTime * (.7 + rnd * 2.) + rnd * 60.)); } else { base = vec3(1., .74, .4) * (1.3 + .25 * sin(uTime * 3. + rnd * 30.)); al = .95; } if (isTower) { vec4 act = uAct[id]; vec4 f = uFx[id]; float band = exp(-pow((hn - f.x) * 6., 2.)); base = mix(base, act.rgb, act.a * .55) + act.rgb * act.a * band * 1.4 + vec3(f.y) * .9 + f.z * .45; al = min(1., al + act.a * .2 + f.y * .4 + f.z * .25); if (act.a * band > .35) ch = mod(ch + floor(uTime * 24. + rnd * 90.), 94.); } if (e > .04 && e < .96) ch = mod(ch + floor(uTime * 30. + rnd * 90.), 94.); float lit = 1.; if (dot(aX.yz, aX.yz) > .01) { float f = dot(aX.yz, normalize(uCam.xz - aPos.xz)); lit = .16 + .84 * smoothstep(-.35, .75, f); } float fog = clamp(1.35 - length(uCam - aPos) / 60., .3, 1.); if (kind > 2.5 && kind < 3.5) fog = 1.; vec3 code = vec3(.5, .56, .66); float c = aX.x; if (c == 90. || c == 92. || c == 7. || c == 8. || c == 58. || c == 60.) code = vec3(.93, .53, .36); else if (c == 1. || c == 6. || c == 63.) code = vec3(.36, .85, .78); else if (c > 14.5 && c < 24.5) code = vec3(.98, .82, .38); else if (c == 27. || c == 29. || c == 14.) code = vec3(.72, .56, 1.); code *= .75 + .4 * rnd; vCol = mix(code, base * lit * fog, e); vA = mix(uWallA, al, e) * (e > 0. && e < 1. ? .6 + .4 * abs(1. - 2. * e) : 1.); vCell = vec2(mod(ch, 16.), floor(ch / 16.)); }`; const FS = ` precision mediump float; uniform sampler2D uAtlas; varying vec3 vCol; varying float vA; varying vec2 vCell; void main(){ float a = texture2D(uAtlas, (vCell + gl_PointCoord) / vec2(16., 8.)).a * vA; if (a < .01) discard; gl_FragColor = vec4(vCol * a, a); }`; let prog, U = {}; function compile() { const sh = (type, src) => { const s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s); if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(s)); return s; }; prog = gl.createProgram(); gl.attachShader(prog, sh(gl.VERTEX_SHADER, VS)); gl.attachShader(prog, sh(gl.FRAGMENT_SHADER, FS)); gl.linkProgram(prog); if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(prog)); gl.useProgram(prog); for (const n of ['uVP','uRes','uCam','uCell','uScroll','uBuild','uTime','uProj','uWallA','uDpr','uCol','uAct','uFx','uAtlas']) U[n] = gl.getUniformLocation(prog, n); const b = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, b); gl.bufferData(gl.ARRAY_BUFFER, ATTR, gl.STATIC_DRAW); const at = (n, size, off) => { const l = gl.getAttribLocation(prog, n); gl.enableVertexAttribArray(l); gl.vertexAttribPointer(l, size, gl.FLOAT, false, 44, off); }; at('aPos', 3, 0); at('aMeta', 4, 12); at('aX', 4, 28); startBuf = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, startBuf); const ls = gl.getAttribLocation(prog, 'aStart'); gl.enableVertexAttribArray(ls); gl.vertexAttribPointer(ls, 2, gl.FLOAT, false, 0, 0); // glyph atlas, drawn at runtime: 94 printable ASCII characters const at2 = document.createElement('canvas'); at2.width = 512; at2.height = 256; const a = at2.getContext('2d'); a.fillStyle = '#fff'; a.textAlign = 'center'; a.textBaseline = 'middle'; a.font = '600 25px ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace'; for (let i = 0; i < 94; i++) a.fillText(String.fromCharCode(33 + i), (i % 16) * 32 + 16, Math.floor(i / 16) * 32 + 17); const tex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, tex); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, at2); gl.generateMipmap(gl.TEXTURE_2D); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.uniform1i(U.uAtlas, 0); const col = new Float32Array(64); T.forEach((t, i) => col.set([...t.base, 1], i * 4)); gl.uniform4fv(U.uCol, col); gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE); gl.disable(gl.DEPTH_TEST); } let startBuf, ok = !!gl; if (ok) try { compile(); } catch (e) { console.error(e); ok = false; } if (!ok) $('#nogl').style.display = 'block'; /* ------------------------------------------------------- layout & math */ let W = 0, H = 0, dpr = 1, cw = 0, chh = 0, cellH = 10, wallRows = 0, maxScroll = 0; function resize() { dpr = Math.min(window.devicePixelRatio || 1, 2); cw = innerWidth; chh = innerHeight; W = Math.round(cw * dpr); H = Math.round(chh * dpr); cv.width = fx.width = W; cv.height = fx.height = H; // lay the source out as a wall of text: newspaper columns, the rest waits below the fold cellH = clamp(chh / 74, 8, 12.5); let cellW = cellH * .6; if (WRAP * cellW > cw - 24) { cellW = (cw - 24) / WRAP; cellH = cellW / .6; } const blockW = WRAP * cellW + cellH * 2.2; const ncol = Math.max(1, Math.floor((cw - 20) / blockW)); const rows = Math.max(10, Math.floor((chh - cellH * 2) / cellH)); const x0 = (cw - ncol * blockW) / 2 + cellH; wallRows = rows; let maxY = 0; for (let j = 0; j < P; j++) { const g = j % NG, r = gRow[g], blk = Math.floor(r / rows), c = blk % ncol, page = Math.floor(blk / ncol); const y = cellH * 1.5 + ((r % rows) + page * rows) * cellH; START[j * 2] = (x0 + c * blockW + gCol[g] * cellW + cellW / 2) * dpr; START[j * 2 + 1] = y * dpr; if (y > maxY) maxY = y; } maxScroll = Math.max(0, maxY - chh + cellH * 3); if (ok) { gl.bindBuffer(gl.ARRAY_BUFFER, startBuf); gl.bufferData(gl.ARRAY_BUFFER, START, gl.STATIC_DRAW); } } const FOV = 38 * DEG; function persp(asp) { const f = 1 / Math.tan(FOV / 2), n = .1, fr = 400, nf = 1 / (n - fr); return [f / asp,0,0,0, 0,f,0,0, 0,0,(fr + n) * nf,-1, 0,0,2 * fr * n * nf,0]; } function lookAt(e, c) { let zx = e[0]-c[0], zy = e[1]-c[1], zz = e[2]-c[2], l = Math.hypot(zx, zy, zz); zx /= l; zy /= l; zz /= l; let xx = zz, xy = 0, xz = -zx; l = Math.hypot(xx, xz); xx /= l; xz /= l; const yx = zy * xz - zz * xy, yy = zz * xx - zx * xz, yz = zx * xy - zy * xx; return [xx,yx,zx,0, xy,yy,zy,0, xz,yz,zz,0, -(xx*e[0]+xy*e[1]+xz*e[2]), -(yx*e[0]+yy*e[1]+yz*e[2]), -(zx*e[0]+zy*e[1]+zz*e[2]), 1]; } function mul(a, b) { const o = new Array(16); for (let i = 0; i < 4; i++) for (let j = 0; j < 4; j++) { let s = 0; for (let k = 0; k < 4; k++) s += a[k * 4 + j] * b[i * 4 + k]; o[i * 4 + j] = s; } return o; } let VP = null, EYE = [0, 0, 0], PROJ_PX = 1; function project(p) { const x = VP[0]*p[0] + VP[4]*p[1] + VP[8]*p[2] + VP[12], y = VP[1]*p[0] + VP[5]*p[1] + VP[9]*p[2] + VP[13], w = VP[3]*p[0] + VP[7]*p[1] + VP[11]*p[2] + VP[15]; return [(x / w * .5 + .5) * cw, (.5 - y / w * .5) * chh, w]; } /* ---------------------------------------------------------- the camera */ const cam = { az:.32, el:.27, dist:27, user:false, idle:0, drag:null }; function fitDist() { const asp = cw / chh, hf = 2 * Math.atan(Math.tan(FOV / 2) * asp); return Math.max(27, 12.6 / Math.tan(hf / 2)); } /* -------------------------------------------------- timeline & state */ const TL = { type0:.3, typeDt:.048, wall:1.9, build:3.45, buildDur:4.6, ui:7.4, sim:7.0, say:[8.2, 11.6, 15.0, 18.4, 21.8], sayDur:3.35 }; const QTEXT = 'what models do you use?'; let mode = 'intro', build = 0, buildTarget = 1, scroll = 0, uiA = 0, tPrev = 0, Tn = 0, tOff = 0; if (REDUCED || QS.has('skip')) tOff = TL.ui + .5; /* -------------------------------------------------------- simulation */ const sim = { t:0, open:23, ship:0, wait:0, next:14, clock:9 * 3600 + 12 * 60 }; const queue = [], pulses = [], bursts = []; const after = (dt, fn) => queue.push({ t:sim.t + dt, fn }); const lines = $('#lines'); function stamp() { const s = Math.floor(sim.clock + sim.t * 14); const p = n => String(n).padStart(2, '0'); return `${p(Math.floor(s / 3600) % 24)}:${p(Math.floor(s / 60) % 60)}:${p(s % 60)}`; } function log(m, who, text) { const el = document.createElement('div'); el.className = 'ln'; el.innerHTML = `<time>${stamp()}</time><b style="color:${rgb(C[m])}">${TAG[m]}</b><span><em>${who}</em> ${text}</span>`; el._b = Tn; lines.appendChild(el); while (lines.children.length > 9) lines.firstChild.remove(); } function work(i, m, dur) { const a = T[i].act; a.c = C[m]; a.until = sim.t + dur; } function flash(i, k = 1) { T[i].flash = Math.max(T[i].flash, k); } function bez(a, b, lift, u) { const v = 1 - u, mx = (a[0] + b[0]) / 2, my = (a[1] + b[1]) / 2 + lift, mz = (a[2] + b[2]) / 2; return [v*v*a[0] + 2*v*u*mx + u*u*b[0], v*v*a[1] + 2*v*u*my + u*u*b[1], v*v*a[2] + 2*v*u*mz + u*u*b[2]]; } function send(a, b, m, dur, done, o = {}) { const L = Math.hypot(a[0] - b[0], a[2] - b[2]); pulses.push({ a:a.slice(), b:b.slice(), c:C[m], t:0, dur, lift:o.lift ?? 1 + L * .32, w:o.w || 1, done }); } function burst(p, m, k = 1) { bursts.push({ p:p.slice(), c:C[m], t:0, k }); } // movers: Fable drifts between the design towers; Sonnet runs drones of chores function mover(m, home, r, ph, label) { return { m, c:C[m], pos:home.slice(), home, anchor:home, r, ph, path:null, trail:[], label }; } const fable = mover('fable', [T[4].x, T[4].top + 1.3, T[4].z], .8, 0, 'FABLE 5.2'); const drones = [0, 1, 2].map(i => mover('sonnet', [0, 4.2 + i * .9, 0], 1.75 + i * .25, i * 2.1, i ? '' : 'SONNET 5.5')); function moveTo(mv, dest, dur, done) { mv.path = { a:mv.pos.slice(), b:dest, t:0, dur, lift:1 + Math.hypot(mv.pos[0] - dest[0], mv.pos[2] - dest[2]) * .2, done }; } function stepMover(mv, dt) { if (mv.path) { const p = mv.path; p.t = Math.min(1, p.t + dt / p.dur); mv.pos = bez(p.a, p.b, p.lift, ease(p.t)); if (p.t >= 1) { mv.path = null; mv.anchor = p.b; p.done && p.done(); } } else { const a = sim.t * 1.3 + mv.ph, an = mv.anchor; const tgt = [an[0] + Math.cos(a) * mv.r, an[1] + Math.sin(a * 1.7) * .15, an[2] + Math.sin(a) * mv.r]; mv.pos = mv.pos.map((v, i) => lerp(v, tgt[i], 1 - Math.exp(-dt * 6))); } mv.trail.push(mv.pos.slice()); if (mv.trail.length > 16) mv.trail.shift(); } const CHORES = () => pick(['rebase onto main · clean', `test run · ${int(120, 480)} passed`, 'lint + format · no diffs', 'lockfile bump · tests green', `rebased ${int(2, 6)} commits · CI green`]); const FABLE_SAYS = { site: ['critique: header rhythm is too even, try 3:5', 'critique: the palette loses contrast at night', 'note: halve the decal density, let it breathe', 'proposal: one accent colour per page', 'critique: the hero image fights the type'], 'design-lang': ['tokens: six spacing steps, not nine', 'critique: icon strokes drift between 1.5 and 2px', 'study: decal edges as a border system'], '3d-pipeline': ['experiment: decal-to-mesh projection, run 14', 'experiment: lower-poly retopo keeps the silhouette', 'experiment: baked AO vs realtime, side by side'], }; const ASTRA_SAYS = ['design critique: the CTA reads as secondary', 'design critique: spacing drifts below 400px', 'design critique: footer outweighs the content', 'design critique: focus ring invisible on dark']; const SOL_OK = () => pick([`claims check: ${(n => `${n}/${n}`)(int(6, 14))} hold`, 'claims check: deploy kit matches its docs', 'claims check: rollback works as documented']); const SOL_FLAG = [['claims check: README says "zero config", kit needs 2 env vars · flagged', 'fixed: docs list both env vars'], ['claims check: "works offline", but one font loads from a CDN · flagged', 'fixed: font is self-hosted now'], ['claims check: healthcheck path differs from the docs · flagged', 'fixed: healthcheck path aligned']]; function storyBuild(i, gap = 7.4) { const t = T[i]; t.busy = true; sim.open++; send(CROWN, t.anchor, 'opus', 1.3, () => { log('opus', `lead → ${t.slug}`, pick(t.tasks)); work(i, 'opus', gap); flash(i, .5); sfx('opus', i); after(gap * .35, () => chore(i)); after(gap + .1, () => review(i)); }); } function review(i) { const t = T[i]; send(t.anchor, T[GATE].anchor, 'opus', 1.5, () => { log('opus', t.slug, `review page ready → Severian`); sim.wait++; flash(GATE, .7); burst(T[GATE].anchor, 'opus', .7); sfx('ping'); after(1.5 + D() * 1.3, () => approve(i)); }); } function approve(i) { const t = T[i], g = T[GATE].anchor; sim.wait--; if (D() < .2 && !t.redo) { t.redo = true; log('you', 'me', `changes requested · ${t.slug}`); sfx('sol', 2); send(g, t.anchor, 'you', 1.3, () => { work(i, 'opus', 3.6); after(3.7, () => review(i)); }); return; } t.redo = false; t.busy = false; sim.ship++; sim.open--; log('you', 'me', `✓ approved ${t.post ? 'public post' : 'deploy'} · ${t.name}`); flash(GATE, 1); flash(i, 1); burst(g, 'you', 2.2); sfx('you'); send(g, [g[0] + (D() - .5) * 14, 26, g[2] + 18], 'you', 2.4, null, { lift:4, w:1.7 }); } function chore(i) { const dr = drones.find(d => !d.busy); if (!dr) return; const t = T[i]; dr.busy = true; moveTo(dr, [t.x, t.top + .5, t.z], 1.1, () => { log('sonnet', t.slug, CHORES()); work(i, 'sonnet', 1.6); sfx('sonnet', i); dr.r = .55; after(2.4, () => { dr.r = 1.75 + drones.indexOf(dr) * .25; moveTo(dr, dr.home, 1.4, () => dr.busy = false); }); }); } function critiqueFable(i) { const t = T[i]; if (fable.path) return; moveTo(fable, [t.x, t.top + 1.2, t.z], 2.2, () => { log('fable', t.slug, pick(FABLE_SAYS[t.slug] || FABLE_SAYS.site)); work(i, 'fable', 3.4); flash(i, .4); sfx('fable', i); }); } function critiqueAstra(i) { const t = T[i]; send(T[ASTRA].anchor, t.anchor, 'astra', 1.6, () => { log('astra', t.slug, pick(ASTRA_SAYS)); work(i, 'astra', 2.6); sfx('astra', i); }); } function claims(i) { const t = T[i]; t.busy = true; send(T[SOL].anchor, t.anchor, 'sol', 1.6, () => { work(i, 'sol', 2.4); sfx('sol', i); if (D() < .45) { const [f, fix] = pick(SOL_FLAG); log('sol', t.slug, f); after(2.4, () => { work(i, 'opus', 3); log('opus', t.slug, fix); sfx('opus', i); t.busy = false; }); } else { log('sol', t.slug, SOL_OK()); t.busy = false; } }); } function triage() { const n = int(3, 6), a = pick(PROJ.filter(i => i !== CLAV)), b = pick(PROJ.filter(i => i !== CLAV && i !== a)), c = T[CLAV]; for (let k = 0; k < n; k++) after(k * .18, () => { const ang = D() * TAU; send([Math.sin(ang) * 30, 9 + D() * 6, Math.cos(ang) * 30], c.anchor, 'clav', 1.2 + D() * .4, k === n - 1 ? () => { const tot = int(9, 48); log('clav', 'claviger', `triaged ${tot} Discord messages → ${T[a].slug}, ${T[b].slug}`); work(CLAV, 'clav', 2); sfx('clav', 8); after(.4, () => { send(c.anchor, T[a].anchor, 'clav', 1.2, () => flash(a, .4)); send(c.anchor, T[b].anchor, 'clav', 1.4, () => flash(b, .4)); }); } : null, { lift:3, w:.6 }); }); } function testdata() { if (D() < .5) send(T[ASTRA].anchor, T[CLAV].anchor, 'astra', 1.8, () => { log('astra', 'claviger', `labelled ${int(80, 400)} test messages`); work(CLAV, 'astra', 2); sfx('astra', 8); }); else { const dr = drones.find(d => !d.busy); if (!dr) return; dr.busy = true; const t = T[CLAV]; moveTo(dr, [t.x, t.top + .5, t.z], 1.2, () => { log('sonnet', 'claviger', `wrote ${int(12, 60)} test conversations`); work(CLAV, 'sonnet', 1.8); sfx('sonnet', 8); after(2, () => moveTo(dr, dr.home, 1.4, () => dr.busy = false)); }); } } function director() { const free = PROJ.filter(i => !T[i].busy); if (!free.length) return; const r = D(); if (r < .33) storyBuild(pick(free)); else if (r < .47) critiqueFable(pick([1, 2, 3, 4, 4, 9, 9])); else if (r < .59) critiqueAstra(pick([1, 2, 3, 4, 5, 6, 10])); else if (r < .71) claims(pick(free)); else if (r < .83) triage(); else if (r < .93) chore(pick(PROJ)); else testdata(); } // the opening few seconds are choreographed to the captions; after that the director improvises const SCRIPT = [[.3, () => storyBuild(1, 7.6)], [1.1, () => storyBuild(3, 9.5)], [3.6, () => chore(2)], [4.6, () => critiqueFable(2)], [7.6, () => critiqueAstra(4)], [8.4, () => claims(6)], [11.6, () => triage()]]; SCRIPT.forEach(([t, f]) => queue.push({ t, fn:f })); function simulate(dt) { sim.t += dt; for (let i = 0; i < queue.length;) { if (queue[i].t <= sim.t) { queue.splice(i, 1)[0].fn(); } else i++; } if (sim.t > sim.next) { director(); sim.next = sim.t + 1.5 + D() * 1.7; } for (const t of T) { const a = t.act, on = sim.t < a.until ? 1 : 0; a.a = lerp(a.a, on, 1 - Math.exp(-dt * (on ? 4 : 1.6))); t.flash *= Math.exp(-dt * 2.6); } for (let i = pulses.length - 1; i >= 0; i--) { const p = pulses[i]; p.t += dt / p.dur; if (p.t >= 1) { pulses.splice(i, 1); burst(p.b, Object.keys(C).find(k => C[k] === p.c), .6 * p.w); p.done && p.done(); } } for (let i = bursts.length - 1; i >= 0; i--) { bursts[i].t += dt; if (bursts[i].t > 1.2) bursts.splice(i, 1); } stepMover(fable, dt); drones.forEach(d => stepMover(d, dt)); } /* ------------------------------------------------------------- sound */ let AC = null, out = null, sound = false; function initAudio() { AC = new (window.AudioContext || window.webkitAudioContext)(); out = AC.createGain(); out.gain.value = .0001; const comp = AC.createDynamicsCompressor(); out.connect(comp); comp.connect(AC.destination); const dl = AC.createDelay(), fb = AC.createGain(), lp = AC.createBiquadFilter(); dl.delayTime.value = .37; fb.gain.value = .42; lp.frequency.value = 1900; out.connect(dl); dl.connect(lp); lp.connect(fb); fb.connect(dl); lp.connect(comp); const pf = AC.createBiquadFilter(), pg = AC.createGain(); pf.type = 'lowpass'; pf.frequency.value = 340; pg.gain.value = .045; pf.connect(pg); pg.connect(comp); [73.42, 110, 146.83, 220].forEach((f, i) => { const o = AC.createOscillator(), g = AC.createGain(); o.type = i % 2 ? 'sawtooth' : 'triangle'; o.frequency.value = f; o.detune.value = (i - 1.5) * 7; g.gain.value = i ? .45 : .9; o.connect(g); g.connect(pf); o.start(); }); const lfo = AC.createOscillator(), lg = AC.createGain(); lfo.frequency.value = .06; lg.gain.value = 160; lfo.connect(lg); lg.connect(pf.frequency); lfo.start(); AC._pad = pg; } function setSound(on) { sound = on; if (on && !AC) initAudio(); if (AC) { AC.resume(); out.gain.setTargetAtTime(on ? .55 : .0001, AC.currentTime, .25); AC._pad.gain.setTargetAtTime(on ? .045 : 0, AC.currentTime, .4); } $('#bSnd').textContent = 'SOUND: ' + (on ? 'ON' : 'OFF'); } const SCALE = [293.66, 329.63, 369.99, 440, 493.88, 587.33, 659.25, 739.99, 880, 987.77, 1174.66]; function tone(f, type, dur, vol, delay = 0) { if (!sound || !AC) return; const t = AC.currentTime + delay, o = AC.createOscillator(), g = AC.createGain(); o.type = type; o.frequency.value = f; g.gain.setValueAtTime(0, t); g.gain.linearRampToValueAtTime(vol, t + .012); g.gain.exponentialRampToValueAtTime(.0001, t + dur); o.connect(g); g.connect(out); o.start(t); o.stop(t + dur + .05); } function sfx(k, i = 0) { const f = SCALE[i % SCALE.length]; if (k === 'opus') { tone(f, 'sine', 1.3, .11); tone(f * 2, 'sine', .5, .025, .02); } else if (k === 'sonnet') { tone(f * 2, 'triangle', .16, .05); tone(f * 3, 'triangle', .12, .03, .08); } else if (k === 'fable') { tone(f * 1.5, 'sine', 1.8, .07); tone(f * 2.25, 'sine', 1.2, .035, .15); } else if (k === 'astra') tone(f, 'square', .22, .018); else if (k === 'sol') tone(f / 2, 'square', .3, .022); else if (k === 'clav') [0, .06, .12].forEach((d, j) => tone(f * (2 + j * .5), 'sine', .09, .035, d)); else if (k === 'ping') tone(1174.66, 'sine', .6, .05); else if (k === 'you') { tone(587.33, 'sine', 2.8, .12); tone(587.33 * 2.76, 'sine', 1.1, .035); tone(880, 'sine', 2.4, .07, .14); tone(1318.5, 'sine', 1.8, .04, .28); } else if (k === 'whoosh' && AC && sound) { const n = AC.createBufferSource(), b = AC.createBuffer(1, AC.sampleRate * 3, AC.sampleRate), d = b.getChannelData(0); for (let j = 0; j < d.length; j++) d[j] = Math.random() * 2 - 1; const bp = AC.createBiquadFilter(), g = AC.createGain(), t = AC.currentTime; bp.type = 'bandpass'; bp.Q.value = 4; bp.frequency.setValueAtTime(180, t); bp.frequency.exponentialRampToValueAtTime(2400, t + 2.6); g.gain.setValueAtTime(0, t); g.gain.linearRampToValueAtTime(.16, t + 1.8); g.gain.linearRampToValueAtTime(0, t + 3); n.buffer = b; n.connect(bp); bp.connect(g); g.connect(out); n.start(); } } /* --------------------------------------------------------- overlay fx */ const glowCache = new Map(); function glow(c) { const k = c.join(); if (glowCache.has(k)) return glowCache.get(k); const g = document.createElement('canvas'); g.width = g.height = 64; const x = g.getContext('2d'); const gr = x.createRadialGradient(32, 32, 0, 32, 32, 32); gr.addColorStop(0, rgb(c, 1)); gr.addColorStop(.18, rgb(c, .55)); gr.addColorStop(.5, rgb(c, .12)); gr.addColorStop(1, rgb(c, 0)); x.fillStyle = gr; x.fillRect(0, 0, 64, 64); glowCache.set(k, g); return g; } function dot(p, c, size, a = 1) { const s = project(p); if (s[2] < .2) return null; const px = size * 26 / Math.sqrt(s[2]); ctx.globalAlpha = a; ctx.drawImage(glow(c), s[0] - px, s[1] - px, px * 2, px * 2); ctx.globalAlpha = a; ctx.fillStyle = '#fff'; ctx.beginPath(); ctx.arc(s[0], s[1], Math.max(.8, px * .09), 0, TAU); ctx.fill(); return s; } function label(s, text, c, a, dy = -12) { if (!s || a <= .01) return; ctx.globalAlpha = a; ctx.font = '600 9.5px ui-monospace, Menlo, Consolas, monospace'; ctx.textAlign = 'center'; ctx.fillStyle = 'rgba(0,0,0,.65)'; const w = ctx.measureText(text).width; ctx.fillRect(s[0] - w / 2 - 4, s[1] + dy - 9, w + 8, 13); ctx.fillStyle = rgb(c); ctx.fillText(text, s[0], s[1] + dy + 1); } function drawFx(a) { ctx.setTransform(dpr, 0, 0, dpr, 0, 0); ctx.clearRect(0, 0, cw, chh); if (a <= .01) return; ctx.globalCompositeOperation = 'lighter'; for (const p of pulses) { // messages in flight const u = ease(p.t), N = 18; let prev = null; for (let i = 0; i <= N; i++) { const uu = u - .3 * (1 - i / N); if (uu < 0) continue; const s = project(bez(p.a, p.b, p.lift, uu)); if (s[2] < .2) { prev = null; continue; } if (prev) { ctx.globalAlpha = a * (i / N) * .8; ctx.strokeStyle = rgb(p.c); ctx.lineWidth = (.6 + 1.8 * i / N) * p.w; ctx.beginPath(); ctx.moveTo(prev[0], prev[1]); ctx.lineTo(s[0], s[1]); ctx.stroke(); } prev = s; } dot(bez(p.a, p.b, p.lift, u), p.c, .55 * p.w, a); } for (const b of bursts) { // arrivals const s = project(b.p); if (s[2] < .2) continue; const k = b.t / 1.2, r = (8 + 70 * k) * b.k * 6 / Math.sqrt(s[2]); ctx.globalAlpha = a * (1 - k) * .9; ctx.strokeStyle = rgb(b.c); ctx.lineWidth = 1.4; ctx.beginPath(); ctx.ellipse(s[0], s[1], r, r * .38, 0, 0, TAU); ctx.stroke(); ctx.globalAlpha = a * (1 - k) * .7; const g = r * .6; ctx.drawImage(glow(b.c), s[0] - g, s[1] - g, g * 2, g * 2); } for (const mv of [fable, ...drones]) { // movers with trails let prev = null; mv.trail.forEach((q, i) => { const s = project(q); if (prev && s[2] > .2) { ctx.globalAlpha = a * i / mv.trail.length * .7; ctx.strokeStyle = rgb(mv.c); ctx.lineWidth = mv.m === 'fable' ? 2 : 1.2; ctx.beginPath(); ctx.moveTo(prev[0], prev[1]); ctx.lineTo(s[0], s[1]); ctx.stroke(); } prev = s; }); dot(mv.pos, mv.c, mv.m === 'fable' ? 1 : .45, a); } const breathe = .75 + .25 * Math.sin(Tn * 2.2); const sCrown = dot(CROWN, C.opus, 1.25 * breathe, a); const sGate = dot([T[GATE].x, T[GATE].top + .6, T[GATE].z], C.you, .9 + T[GATE].flash, a); const sA = dot([T[ASTRA].x, T[ASTRA].top + .3, T[ASTRA].z], C.astra, .7, a); const sS = dot([T[SOL].x, T[SOL].top + .3, T[SOL].z], C.sol, .7, a); ctx.globalCompositeOperation = 'source-over'; label(sCrown, 'OPUS 5.5 · LEAD', C.opus, a * .95, -16); label(sGate, 'SEVERIAN · APPROVES', C.you, a * .95, -14); label(sA, 'GPT-6-ASTRA · CODEX', C.astra, a * .85); label(sS, 'GPT-6.1-SOL · CODEX', C.sol, a * .85); label(project(fable.pos), 'FABLE 5.2', C.fable, a * .9, -13); label(project(drones[0].pos), 'SONNET 5.5', C.sonnet, a * .75, -10); for (let i = 1; i < 12; i++) { // project names const t = T[i], s = project([t.x, t.top + .35, t.z]); if (s[2] < .2) continue; const act = Math.max(t.act.a, t.hl, t.flash); ctx.globalAlpha = a * (.42 + .58 * act); ctx.font = '500 9.5px ui-monospace, Menlo, Consolas, monospace'; ctx.textAlign = 'center'; ctx.fillStyle = act > .3 ? rgb(t.act.a > .3 ? t.act.c : C.you) : '#b8b2a8'; ctx.fillText(t.name, s[0], s[1] - 4); } ctx.globalAlpha = 1; } /* ------------------------------------------------------- interaction */ const card = $('#card'); let hover = -1, pinned = false, rosterHl = null; function towerAt(x, y) { let best = -1, bw = 1e9; T.forEach((t, i) => { const a = project([t.x, 0, t.z]), b = project([t.x, t.top, t.z]); if (a[2] < .2 || b[2] < .2) return; const dx = b[0] - a[0], dy = b[1] - a[1], L = dx * dx + dy * dy || 1, u = clamp(((x - a[0]) * dx + (y - a[1]) * dy) / L, 0, 1); const d = Math.hypot(x - a[0] - u * dx, y - a[1] - u * dy), rpx = t.r * 1.2 * PROJ_PX / a[2] + 6; if (d < rpx && a[2] < bw) { bw = a[2]; best = i; } }); return best; } function showCard(i, x, y) { if (i < 0) { card.style.display = 'none'; return; } const t = T[i]; card.innerHTML = `<h3>${t.name}</h3><p>${t.desc}</p><div class="by">${t.by.map(m => `<span style="color:${rgb(C[m])}">${NAME[m]}</span>`).join('')}</div>` + (t.url ? `<a href="${t.url}" target="_blank" rel="noopener">${t.url.replace('https://', '')} ↗</a>` : ''); card.style.display = 'block'; const w = 270, h = card.offsetHeight; card.style.left = clamp(x + 18, 8, cw - w - 8) + 'px'; card.style.top = clamp(y - h / 2, 8, chh - h - 8) + 'px'; } const isUI = e => e.target.closest && e.target.closest('.ui button, #roster, #card, #ledger, #ctl'); addEventListener('pointerdown', e => { if (mode === 'intro' && Tn < TL.ui && !CAPTURE) { tOff += TL.ui + .4 - Tn; return; } if (isUI(e)) return; cam.drag = { x:e.clientX, y:e.clientY, moved:0 }; cam.user = true; }); addEventListener('pointermove', e => { if (cam.drag) { const dx = e.clientX - cam.drag.x, dy = e.clientY - cam.drag.y; cam.drag.moved += Math.abs(dx) + Math.abs(dy); cam.az -= dx * .0055; cam.el = clamp(cam.el + dy * .004, .04, 1.25); cam.drag.x = e.clientX; cam.drag.y = e.clientY; cam.idle = 0; return; } if (mode !== 'live' || pinned || isUI(e)) return; const i = towerAt(e.clientX, e.clientY); if (i !== hover) { hover = i; } showCard(i, e.clientX, e.clientY); document.body.style.cursor = i >= 0 ? 'pointer' : 'grab'; }); addEventListener('pointerup', e => { const d = cam.drag; cam.drag = null; if (d && d.moved < 6 && mode === 'live') { const i = towerAt(e.clientX, e.clientY); pinned = i >= 0; hover = i; showCard(i, e.clientX, e.clientY); } }); addEventListener('wheel', e => { if (mode === 'source') { scroll = clamp(scroll + e.deltaY, 0, maxScroll); e.preventDefault(); return; } if (mode !== 'live') return; cam.dist = clamp(cam.dist * Math.exp(e.deltaY * .001), 12, 70); cam.idle = 0; e.preventDefault(); }, { passive:false }); let touchD = 0; addEventListener('touchmove', e => { if (e.touches.length === 2) { const d = Math.hypot(e.touches[0].clientX - e.touches[1].clientX, e.touches[0].clientY - e.touches[1].clientY); if (touchD) { if (mode === 'source') scroll = clamp(scroll + (touchD - d) * 3, 0, maxScroll); else cam.dist = clamp(cam.dist * touchD / d, 12, 70); } touchD = d; } }, { passive:true }); addEventListener('touchend', () => touchD = 0); document.querySelectorAll('.m').forEach(el => { el.addEventListener('pointerenter', () => rosterHl = el.dataset.m); el.addEventListener('pointerleave', () => rosterHl = null); }); $('#bSnd').onclick = () => setSound(!sound); $('#bSrc').onclick = () => { if (mode === 'live') { mode = 'source'; buildTarget = 0; scroll = 0; card.style.display = 'none'; pinned = false; $('#bSrc').textContent = 'REBUILD'; } else if (mode === 'source') { mode = 'live'; buildTarget = 1; $('#bSrc').textContent = 'VIEW SOURCE'; sfx('whoosh'); } }; addEventListener('keydown', e => { if (e.key === 'v') $('#bSrc').click(); if (e.key === 'm') setSound(!sound); }); addEventListener('resize', resize); /* --------------------------------------------------------- narration */ const SAY = [ { html:`<b style="color:var(--opus)">Opus 5.5</b> runs the citadel: a lead session, and one session for every project.`, hl:['opus'] }, { html:`<b style="color:var(--sonnet)">Sonnet 5.5</b> runs the chores. <b style="color:var(--fable)">Fable 5.2</b> designs, critiques and experiments.`, hl:['sonnet', 'fable'] }, { html:`<b style="color:var(--astra)">GPT-6-Astra</b> and <b style="color:var(--sol)">GPT-6.1-Sol</b>, via Codex, critique the designs and check the code against its claims.`, hl:['astra', 'sol'] }, { html:`My own small model, <b style="color:var(--clav)">Claviger</b>, sorts the Discord. And nothing ships until <b>I</b> approve it.`, hl:['clav', 'you'] }, { html:``, hl:[] }, ]; const sayEl = $('#say'); let sayIdx = -1; /* ------------------------------------------------------------ render */ const actU = new Float32Array(64), fxU = new Float32Array(64); const qt = $('#qt'), cur = $('#cur'), intro = $('#intro'), cap = $('#cap'), hint = $('#hint'), sun = $('#sun'), srcnote = $('#srcnote'); const uis = [...document.querySelectorAll('.ui')]; $('#colo').innerHTML = `Every glyph in this scene is one of the <b>${NG.toLocaleString('en-US')}</b> characters of this page's own source. ` + `One ${(SRC.length / 1024).toFixed(1)} KB file: WebGL renderer, shaders, glyph atlas, simulation, sound and words. No libraries, no images.<br><b>Written by Claude Opus 5.5.</b>`; SAY[4].html = `Every glyph you're looking at is a character of this page's own source code.<br><span style="color:var(--dim)">One file, no libraries. Written by</span> <b style="color:var(--opus)">Claude Opus 5.5</b>.`; function frame(now) { Tn = now + tOff; const dt = clamp(Tn - tPrev, 0, .1); tPrev = Tn; if (!W) resize(); // intro choreography let wallA = 1, camK = 1; if (mode === 'intro') { const typed = clamp(Math.floor((Tn - TL.type0) / TL.typeDt), 0, QTEXT.length); qt.textContent = QTEXT.slice(0, typed); cur.style.opacity = (Tn % .9 < .5 || typed < QTEXT.length) ? 1 : 0; intro.style.opacity = 1 - smooth(TL.wall - .1, TL.wall + .35, Tn); intro.style.transform = `scale(${1 + smooth(TL.wall - .1, TL.wall + .5, Tn) * .08})`; wallA = smooth(TL.wall, TL.wall + .5, Tn) * .95; const sc = clamp(Tn - TL.wall, 0, TL.build + 1.2 - TL.wall); scroll = sc * sc * 24 * cellH; build = ease(clamp((Tn - TL.build) / TL.buildDur, 0, 1)); camK = ease(clamp((Tn - TL.build + .3) / (TL.buildDur + 1.6), 0, 1)); let capT = '', capA = 0; if (Tn > TL.wall + .45 && Tn < TL.build + .7) { capT = `this is the source code of the page you're looking at · <b>${NG.toLocaleString('en-US')}</b> characters`; capA = smooth(TL.wall + .45, TL.wall + .8, Tn) * (1 - smooth(TL.build + .4, TL.build + .7, Tn)); } else if (Tn > TL.build + .7 && Tn < TL.build + TL.buildDur) { capT = `every point of light is one of those characters`; capA = smooth(TL.build + .7, TL.build + 1.1, Tn) * (1 - smooth(TL.build + TL.buildDur - .5, TL.build + TL.buildDur, Tn)); } if (cap._t !== capT) { cap.innerHTML = capT; cap._t = capT; } cap.style.opacity = capA; hint.style.opacity = CAPTURE ? 0 : (Tn > .8 && Tn < TL.ui ? .8 : 0); if (Tn > TL.build + TL.buildDur + 1.3) { mode = 'live'; intro.style.display = 'none'; cap.style.opacity = 0; hint.style.display = 'none'; } } else { build = clamp(build + (buildTarget > build ? 1 : -1) * dt / 2.6, 0, 1); if (mode === 'source' && build > .05) scroll = lerp(scroll, 0, 1 - Math.exp(-dt * 4)); } // camera const fd = fitDist(); if (mode === 'intro') { cam.az = lerp(-1.15, .32, camK); cam.el = lerp(1.0, .27, camK); cam.dist = lerp(fd * 1.75, fd, camK); } else if (!cam.drag) { cam.idle += dt; if (!cam.user || cam.idle > 4) cam.az += dt * .035 * smooth(0, 2, cam.user ? cam.idle - 4 : 2); } const tgt = [0, 3.4, 0], ce = Math.cos(cam.el); EYE = [tgt[0] + cam.dist * ce * Math.sin(cam.az), tgt[1] + cam.dist * Math.sin(cam.el), tgt[2] + cam.dist * ce * Math.cos(cam.az)]; VP = mul(persp(cw / chh), lookAt(EYE, tgt)); PROJ_PX = chh / (2 * Math.tan(FOV / 2)); // simulate once the citadel stands if (Tn > TL.sim) simulate(dt); // highlights: the narration and the roster point at towers let sayHl = null; if (mode !== 'intro' || Tn > TL.say[0]) { const idx = TL.say.findIndex((s, i) => Tn >= s && Tn < s + TL.sayDur + (i === 4 ? 3.2 : 0)); if (idx !== sayIdx) { sayIdx = idx; if (idx >= 0) sayEl.innerHTML = SAY[idx].html; } if (idx >= 0) { const s0 = TL.say[idx], d = TL.sayDur + (idx === 4 ? 3.2 : 0); sayEl.style.opacity = smooth(s0, s0 + .4, Tn) * (1 - smooth(s0 + d - .4, s0 + d, Tn)) * (mode === 'source' ? 0 : 1); sayHl = SAY[idx].hl; } else sayEl.style.opacity = 0; } const hlSet = rosterHl ? [rosterHl] : sayHl || []; T.forEach((t, i) => { const on = (hlSet.length && t.by.some(m => hlSet.includes(m)) && !(hlSet.includes('opus') && !rosterHl && i > 11)) || i === hover ? 1 : 0; t.hl = lerp(t.hl, on, 1 - Math.exp(-dt * 5)); t.band = ((t.band || i * .37) + dt * .55) % 1.4; actU.set([...t.act.c, t.act.a], i * 4); fxU.set([t.band - .2, t.flash, t.hl * .7, 0], i * 4); }); // ui fades const uiTarget = mode === 'source' ? 0 : smooth(TL.ui, TL.ui + 1.2, Tn); uiA = mode === 'intro' ? uiTarget : lerp(uiA, uiTarget, 1 - Math.exp(-dt * 5)); uis.forEach(el => { el.style.opacity = el.id === 'ctl' ? Math.max(uiA, mode === 'source' ? 1 : 0) : uiA; el.style.pointerEvents = uiA > .5 || (el.id === 'ctl' && mode === 'source') ? 'auto' : 'none'; }); srcnote.style.opacity = mode === 'source' ? smooth(.6, .1, build) : 0; for (const el of lines.children) { const age = Tn - el._b; el.style.opacity = Math.min(1, age * 4); el.style.color = age < .6 ? '#fff' : ''; } $('#clock').textContent = stamp(); $('#cOpen').textContent = sim.open; $('#cShip').textContent = sim.ship; $('#cWait').textContent = sim.wait; // the old sun on the horizon const sp = project([-120 * Math.sin(.9), 8, -120 * Math.cos(.9)]); sun.style.opacity = sp[2] > 0 ? .9 * smooth(.3, .9, build) : 0; sun.style.transform = `translate(${sp[0]}px,${sp[1]}px)`; // draw if (ok) { gl.viewport(0, 0, W, H); gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT); gl.uniformMatrix4fv(U.uVP, false, new Float32Array(VP)); gl.uniform2f(U.uRes, W, H); gl.uniform3fv(U.uCam, EYE); gl.uniform1f(U.uCell, cellH * dpr); gl.uniform1f(U.uScroll, scroll * dpr); gl.uniform1f(U.uBuild, build); gl.uniform1f(U.uTime, Tn); gl.uniform1f(U.uProj, H / (2 * Math.tan(FOV / 2))); gl.uniform1f(U.uWallA, wallA); gl.uniform1f(U.uDpr, dpr); gl.uniform4fv(U.uAct, actU); gl.uniform4fv(U.uFx, fxU); gl.drawArrays(gl.POINTS, 0, P); } drawFx(smooth(.82, 1, build) * (mode === 'intro' ? smooth(TL.ui - 1.2, TL.ui, Tn) : 1)); } resize(); if (CAPTURE) { window.__frame = t => frame(t); window.__ready = true; } else { const t0 = performance.now(); const loop = () => { frame((performance.now() - t0) / 1000); requestAnimationFrame(loop); }; requestAnimationFrame(loop); } })(); </script> </body> </html>result, 1 line
File created successfully at: ~/showcase-iso-TI9oBhZi/run/citadel/index.html (file state is current in your context — no need to Read it back)