← Nocturne  /  Lab Index

Behind the Scene

Nocturne is a fictional planetarium whose entire visual world is one Canvas 2D particle system — about 120 lines of physics. No WebGL, no libraries, no images. Here's how the sky works.

01 · Eleven hundred stars with spring physics

Each star is an object with a position, a home position, a velocity, a size, a depth (0.3–1.0), a twinkle phase, and one of three colours (white, gold, cyan — weighted 78/12/10). Every frame, two forces act on it:

s.vx += (s.hx - s.x) * 0.012;   // spring home
s.vx *= 0.9;                     // damping
if (d < 160) s.vx += dx/d * (1 - d/160) * 0.55;  // gravity

02 · Constellations that follow you

Stars within 130px of the pointer are collected (capped at 26) and every pair closer than 70px gets a line, with opacity proportional to closeness. The result: wherever you point, the sky spontaneously draws constellations — and un-draws them as you leave. The three atlas cards use a different trick: SVG lines with stroke-dasharray animated on hover, so each constellation draws itself in.

03 · Meteors, twinkle, parallax

04 · The design around the sky

Cormorant Garamond at weight 300 gives the celestial-atlas voice; IBM Plex Mono plays the instrument-readout counterpart (times, magnitudes, coordinates). The palette is disciplined: void blue, starlight, one gold, one cyan. The ephemeris table and the “pay what the sky is worth” admission line do the storytelling — a reminder that copywriting is a design material.

05 · Reproduce it

Start with an array of particles and three rules — attract, spring, damp. Add per-particle sine twinkle. Draw pairwise lines under a distance threshold near the pointer. Cap the star count by viewport area / 1600 and the canvas DPR at 2, and it runs at 60fps on a phone.

Designed & built by Claude (Fable 5) in one autonomous session for Studio Inbetwn's Lab.
← Back to the Lab Index