← Ziding Zhang

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


Three side-by-side snapshots from the rebuilt broadsheet HUD: 2029 shows three dashed capability branches carving white channels through a terracotta halftone dot field; 2038 shows an unlit orthographic ink globe with extruded terracotta compute cylinders above a 1px treemap and unit-dot strip; 2045 shifts to dark stone as Earth shrinks to a speck amid 16,000 spiral-galaxy stars.
Three stages from my rebuilt broadsheet HUD: a 2029 fork carving signed-distance channels through 3,080 halftone dots, a 2038 orthographic ink globe with normal-extruded towers, and a 2045 cosmic zoom across 16,000 WebGL stars.

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:

  1. 2× 2D Canvas (910 × 770 backing): 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.
  2. 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.
  3. Inline SVG (455 × 385): Crisp dashed curves and invisible 24 px hit strokes that swap the lower panel into a detail view on hover without redrawing the canvases.
  4. HTML/CSS: Policy tiles, tabular counters, and a 1 px-bordered treemap; on 375 px phones, the rail collapses into a 76 px bottom 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)MethodMean frame time
3,080 SDF halftone + 600 unit dotsSVG DOM (<circle> mutation)10.48 ms
3,080 SDF halftone + 600 unit dots2D Canvas (per-dot fill())1.48 ms
3,080 SDF halftone + 600 unit dots2D 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 zoom2D Canvas (fillRect loop)1.36 ms
16,000-star 3D galaxy zoomRaw 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 px right rail (z-40):
    1. canvas (910 × 770 backing for 455 × 385 CSS, 2d context): variable-radius oxblood (#8b0000) and black (#000000) halftone risk lattice on #fffff8 paper, with signed-distance channels cleared around active and ghosted trajectories.
    2. canvas (800 × 800 backing for 400 × 400 CSS, webgl2 via three.js r181, clip-path: circle(50%)): orthographic globe fed by [email protected]/countries-110m.json coastlines and radial 3D datacenter cylinders; in #playbook-epilogue (2041–2050), --playbook-epilogue-bg shifts from #fffff8 to dark stone while a 2850 × 1800 WebGL canvas renders a 3D galaxy field as Earth shrinks to the center.
    3. svg (viewBox="0 0 455 385"): crisp dashed <path> trajectories (@keyframes cypDrawIn animating stroke-dashoffset on fork switches) paired with wide transparent <path> hit targets that swap the lower panel into a contextual Data Centers inspector on hover.
    4. HTML/CSS + <number-flow-react> + canvas (910 × 256 backing for 455 × 128 CSS): policy icon rows (Current, In Discussion, Off the Table), four tabular KPI readouts, a 1 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). At 375 × 812 mobile width, the desktop fixed rail unmounts, renders inline beneath the byline at top, and docks into a 340 × 76 px fixed 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 (662 visible words with JavaScript disabled).
  • Zero runtime dependencies: Decoded 118 coastline arcs (2,868 vertices) from CC0 Natural Earth land-110m into local coastlines.js (37.8 KB), and wrote all five rendering primitives in hud-primitives.js with zero external packages or CDN calls.
  • Caching the corridor SDF: On Pass 1, recomputing 3,080 × 72 point-to-segment distances in JavaScript on every scroll frame cost 1.20 ms/frame. Precomputing two Float32Array(rows * cols) suppression grids (buildCorridorCache) whenever the active branch or viewport size changes cut the 8-bucket halftone + 600-dot unit strip pass to 0.43 ms/frame (24× faster than 3,680 SVG <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 > 0 horizon culling, 1.2 px coastline strokes, and painter-sorted normal-extruded cylinders—a 90-line 3 × 3 orthographic basis in 2D Canvas draws the entire 640 × 640 globe in 0.10 ms/frame. Raw WebGL (gl.POINTS over a single Float32Array vertex buffer) only wins once particle count jumps into the tens of thousands (0.03 ms vs. 1.36 ms in 2D Canvas at 16,000 stars).

Easy ways to extend /experiments/narrative-hud/:

  1. Swap in 1:50m or 1:10m Natural Earth arcs in preprojectCoastlines(arcs) and re-run window.__runHudBench(120) to plot the exact vertex-count curve where 2D Canvas crosses 1 ms and 4 ms.
  2. Add time-varying 2D risk fields (e.g., regional compute concentration or treaty-violation heatmaps) into drawHalftoneField while keeping 8-bucket ctx.arc batching intact.
  3. Test CSS animation-timeline: view() vs. requestAnimationFrame scroll progress for driving discrete chapter handoffs on Safari, Firefox, and Chrome Android.
  4. 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?).

Have an answer, a counterexample, or a story? See Talk to me for open questions and live trials.

Credits: Ziding Zhang. Browser inspection, zero-dependency rebuild, benchmarks and write-up by a Gemini agent under my direction. AI 2040: Plan A is by the AI Futures Project, designed and engineered by Raymond Arnold, Oliver Habryka and Joanna Bregan at Lightcone Infrastructure. Coastlines from Natural Earth (CC0, 1:110m).