Pixel Cube Field

group .........
3D and WebGL scenes
markdown ......
/lab/pixel-cube-field.md
human .........
/lab/pixel-cube-field

── WHAT_IT_IS ────────────────────────────────────────────────────────────────────────────────

A grid of RGB-split wireframe cubes that aim at the cursor. Each cube is rasterized the same way as the single Pixel Cube Avatar, twelve edges drawn with an integer Bresenham line into three 8-bit channel buffers with the red and blue passes offset a few degrees from green, and the whole field shares one cell buffer and one canvas. Orientation comes from each cube's offset to the pointer: the cube under the cursor sits head-on and the tilt grows outward, saturating at a set radius, so the grid reads as a lens aimed wherever the mouse is. Cubes are never scaled by distance, so the field stays flat rather than bulging. Every cube eases independently, the fringing widens with how fast each one turned, the focus drifts by itself after three idle seconds, and a click sends a ring of full revolutions outward from the cube you hit. No dependencies.

── BEHAVIOUR ────────────────────────────────────────────────────────────────────────────────

  • * Tilt grows outward, not inward

    The cube under the cursor is the one held head-on and every other cube leans by its offset to it, so the field points at the pointer instead of peaking there. The offset vector is clamped to one radius rather than the angle being clamped, which keeps the lean direction correct at the far corners instead of flattening them.

  • * Flat by construction

    Cubes are never scaled or translated by distance from the focus, only rotated, so the grid reads as a field of turning objects rather than a bulging lens.

  • * One canvas for the whole grid

    Every cube rasterizes into the same three channel buffers and the field is flushed with a single putImageData, so 36 cubes cost one canvas and one rAF loop instead of 36 of each.

  • * Per-cube chroma and easing

    Each cube carries its own rotation, its own half-life easing and its own chroma offset, so they lag into place independently and only the ones actually turning fast tear into full RGB.

  • * The ripple is one full turn

    A click spins each ring by exactly 2 pi on an ease-out, so every cube lands back where it started and the wave leaves no drift behind it.