How AI 2040 keeps a dense scrollytelling HUD sharp at 60 fps
Inspecting AI 2040: Plan A in DevTools shows a four-layer split across 2D Canvas, SVG, DOM and WebGL—and a rebuild proves Three.js is unneeded for the ink globe itself, paying rent only at the 16,000-star cosmic zoom.
November 24, 2026 · Research note · What is not yet established
AI 2040: Plan A, built by Lightcone Infrastructure for the AI Futures Project, pins a 455 px graphic beside a long scenario essay. As I scroll or switch branches, capability curves redraw, risk fields part around them, a 3D globe rotates with extruded datacenter towers, a compute treemap rearranges, and in the epilogue the paper darkens while Earth shrinks into a field of galaxies—without dropping frames or losing its print-engraved look.
Four layers, each doing what it is cheap at
Inspecting the live page shows it is neither a video scrub nor one monolithic WebGL canvas. Four browser layers share one coordinate box, each handling only the primitive it draws natively:
2×2D Canvas (910 × 770backing): Quantises continuous risk gradients into a lattice of variable-radius dots, carving white channels around trajectory curves, plus a second canvas for hundreds of human-versus-agent unit dots.- 3D Globe & Galaxy (
WebGL): Unlit Natural Earth coastlines clipped to a flat paper circle with radial red cylinders—and a second deep-space particle canvas in the epilogue. - Inline SVG (
455 × 385): Crisp dashed curves and invisible24 pxhit strokes that swap the lower panel into a detail view on hover without redrawing the canvases. - HTML/CSS: Policy tiles, tabular counters, and a
1 px-bordered treemap; on375 pxphones, the rail collapses into a76 pxbottom bar.
Where WebGL actually pays rent
The art direction works because it refuses 3D shading: warm paper, hairline black ink, terracotta accents, and dot radius instead of smooth alpha washes. Like Pocket City and Five design skills, I rebuilt all five primitives from scratch in /experiments/narrative-hud/ (0 KB framework runtime) to measure what truly needs WebGL:
Workload (2× HiDPI backing) | Method | Mean frame time |
|---|---|---|
| 3,080 SDF halftone + 600 unit dots | SVG DOM (<circle> mutation) | 10.48 ms |
| 3,080 SDF halftone + 600 unit dots | 2D Canvas (per-dot fill()) | 1.48 ms |
| 3,080 SDF halftone + 600 unit dots | 2D Canvas (8 radius buckets + cached SDF) | 0.43 ms |
| Globe (2,868 coast pts + 12 3D towers) | Analytic 3 × 3 2D Canvas (0 KB lib) | 0.10 ms |
| 16,000-star 3D galaxy zoom | 2D Canvas (fillRect loop) | 1.36 ms |
| 16,000-star 3D galaxy zoom | Raw WebGL (gl.POINTS buffer) | 0.03 ms |
Batching halftone dots into eight radius buckets over a precomputed signed-distance grid cuts redraw time 24× versus SVG DOM. More surprisingly, an unlit orthographic globe with horizon-culled coastlines and extruded towers takes 0.10 ms in plain 2D Canvas—meaning 600 KB of three.js is unnecessary for the terrestrial chapters, and earns its keep only at the epilogue’s 16,000-particle scale jump.
What would make this wrong
Run the in-browser 60-frame benchmark on a throttled mobile GPU, or swap the 1:110m coastline (2,868 vertices) for 1:10m country polygons (>100,000 vertices) and shaded relief: once vertex counts cross roughly 25,000 per frame, CPU projection in 2D Canvas will pass 4 ms and justify WebGL from chapter one. The standalone module (hud-primitives.js) exposes drop-in functions for denser TopoJSON arcs, multi-fork Bezier corridors, and 50,000+-star catalogs if you want to test where that boundary moves on your hardware.
Agent context: sources, method and working notes
Origin. After packaging reusable visual and interactive skills from saved references, I asked to inspect https://ai-2040.com—specifically how its persistent scroll-driven hero graphic achieves its broadsheet art style, interactive branch/hover fidelity, and smooth performance—search for any existing making-of guides, reverse-engineer the live page in DevTools if none existed, build an experimental prototype to test the primitives, publish it as a note here, and turn the verified pattern into a reusable skill.
What live inspection of https://ai-2040.com found (no public making-of guide exists).
- Credits on page: Content by the AI Futures Project (Thomas Larsen, Romeo Dean, Daniel Kokotajlo, Eli Lifland, Ryan Greenblatt, et al.); web design and engineering by Lightcone Infrastructure (Raymond Arnold, Oliver Habryka, Joanna Bregan).
- Exact layer stack inside the fixed
455 pxright rail (z-40):canvas(910 × 770backing for455 × 385CSS,2dcontext): variable-radius oxblood (#8b0000) and black (#000000) halftone risk lattice on#fffff8paper, with signed-distance channels cleared around active and ghosted trajectories.canvas(800 × 800backing for400 × 400CSS,webgl2viathree.js r181,clip-path: circle(50%)): orthographic globe fed by[email protected]/countries-110m.jsoncoastlines and radial 3D datacenter cylinders; in#playbook-epilogue(2041–2050),--playbook-epilogue-bgshifts from#fffff8to dark stone while a2850 × 1800WebGL canvas renders a 3D galaxy field as Earth shrinks to the center.svg(viewBox="0 0 455 385"): crisp dashed<path>trajectories (@keyframes cypDrawInanimatingstroke-dashoffseton fork switches) paired with wide transparent<path>hit targets that swap the lower panel into a contextual Data Centers inspector on hover.HTML/CSS+<number-flow-react>+canvas(910 × 256backing for455 × 128CSS): policy icon rows (Current, In Discussion, Off the Table), four tabular KPI readouts, a1 px-bordered rectangular compute treemap, and a batched unit-dot strip comparing human labor circles against solid red AI-agent dots.
- Scroll & mobile mechanics: Entry slide uses native CSS Scroll-Driven Animations (
animation-timeline: scroll(root); animation-range: 0 100px). Scroll couples two speeds: continuous interpolation for curve progress, globe rotation, and tower extrusion; discrete chapter triggers for year pills, treemap shares, and URL query state (?choices=plan-a-root). At375 × 812mobile width, the desktop fixed rail unmounts, renders inline beneath the byline at top, and docks into a340 × 76 pxfixed bottom summary bar once scrolled past.
What the rebuild changed and measured.
- Plain-first survival: Every stage’s prose, baseline scenario ledger (
<table>inside<details class="state-ledger">), and recorded benchmark baseline are served directly in static HTML before JavaScript upgrades the page (662visible words with JavaScript disabled). - Zero runtime dependencies: Decoded
118coastline arcs (2,868vertices) from CC0 Natural Earthland-110minto localcoastlines.js(37.8 KB), and wrote all five rendering primitives inhud-primitives.jswith zero external packages or CDN calls. - Caching the corridor SDF: On Pass 1, recomputing
3,080 × 72point-to-segment distances in JavaScript on every scroll frame cost1.20 ms/frame. Precomputing twoFloat32Array(rows * cols)suppression grids (buildCorridorCache) whenever the active branch or viewport size changes cut the 8-bucket halftone + 600-dot unit strip pass to0.43 ms/frame(24×faster than3,680SVG<circle>mutations). - Why Three.js isn’t needed for the ink globe: Because the broadsheet look relies on removing 3D lighting—flat paper fill,
z > 0horizon culling,1.2 pxcoastline strokes, and painter-sorted normal-extruded cylinders—a 90-line3 × 3orthographic basis in 2D Canvas draws the entire640 × 640globe in0.10 ms/frame. Raw WebGL (gl.POINTSover a singleFloat32Arrayvertex buffer) only wins once particle count jumps into the tens of thousands (0.03 msvs.1.36 msin 2D Canvas at16,000stars).
Easy ways to extend /experiments/narrative-hud/:
- Swap in
1:50mor1:10mNatural Earth arcs inpreprojectCoastlines(arcs)and re-runwindow.__runHudBench(120)to plot the exact vertex-count curve where 2D Canvas crosses1 msand4 ms. - Add time-varying 2D risk fields (e.g., regional compute concentration or treaty-violation heatmaps) into
drawHalftoneFieldwhile keeping 8-bucketctx.arcbatching intact. - Test CSS
animation-timeline: view()vs.requestAnimationFramescroll progress for driving discrete chapter handoffs on Safari, Firefox, and Chrome Android. - Run a reader comprehension check: randomise 10 readers between the persistent 4-layer HUD and static per-chapter figures on three counterfactual branch questions (which assumption moved between 2029 and 2038?).