Neon activity graph
A year of activity drawn as glass blocks in three.js: lit like neon tubes that stutter on with a synthesised hum in the dark theme, and lit by the sun, with traced coloured shadows and caustics, in the light theme. Published on npm with a React component.

At a glance
- TypeScript, three.js, WebGL 2, GLSL, Web Audio, React, Mitsuba 3
- npm: neon-activity-graph
Tags
A component that draws a year of activity, such as GitHub contributions over coding time, as a field of glass blocks: one column a day, two blocks to a column. I designed it for the software page of this site, then made it a library of its own, published on npm with a React component and a demo that shows my own activity, refreshed every six hours.
It is a design problem as much as a rendering one: a familiar picture (the contribution calendar) given a material, a light and a voice, without getting in the way of reading it.
Two themes, one glass
In the dark theme every block holds a neon tube. The tube is a pure emitter: it lights the glass from inside and spills coloured light onto the ground. In the light theme the same glass has its tubes switched off and is lit by the sun instead, so it casts soft, coloured shadows and small caustics. Switching themes is not a recolouring: it is the same object under another light.
Optics
- The sun through the glass is traced on the GPU: a vertex shader splats rays onto the ground with refraction, Fresnel, total internal reflection, the glass's colour absorption and its rounded edges. The ground stores a signed difference to what it would get with no glass, so the shadows are coloured and the caustics are the surplus. A readable CPU version of the same optics is what the tests check.
- The neon's light on the ground cannot be traced live with the rays a page can afford: the result is noise. It is baked instead: I path-traced templates of one block with its tube in Mitsuba 3, for a range of block heights and distances to the ground, and the graph lays the right one under every block, in the tube's colour. The whole set is a 41 KB image embedded in the package.
- Nothing moves, so the picture is accumulated over a few dozen jittered frames (soft shadows and anti-aliasing for free) and the GPU then goes idle.
Neon start-up and sound
When the graph appears in the dark theme, the tubes do not simply turn on: the blocks are cut into a few rectangular circuits, and each stutters and catches like a gas sign warming up. Later, rarely, a small batch of tubes flickers. The sound is synthesised with Web Audio, with no files: a low ballast hum that dies away, soft bell-like clicks as the circuits catch, and a faint hum on the tube under the pointer. It only plays once the visitor has used the page and while the graph is on screen; the light theme, whose tubes are off, is silent.
Theming
Each layer has two tones per theme, for the quietest and the busiest day. Colours can change live: the blocks are rebuilt in place in about a third of a second, while the old picture stays on screen, softened. A per-tube colour function turns the graph into a string of lights. The ground takes the page's own background, so the picture has no seam with the page around it.
The package
- A framework-agnostic core and a React component, with adapters for GitHub's contribution calendar and WakaTime's summaries.
- three.js is a peer dependency loaded on demand; a flat placeholder, seen by the same camera, is drawn at once (and rendered on the server in React), so the scene replaces it in place.
- A layout of four strips for narrow screens, a lighter mode for phones and modest machines, reduced-motion support, keyboard navigation of the days and an announced hover card.
- Released from GitHub Actions through npm Trusted Publishing, with provenance and no stored token.




