Backgrounds

Voronoi Shatter

Lit cells that fracture apart under the pointer and knit back together behind it. The seam is drawn from the gap between the two nearest seeds rather than the distance to the nearest one, so it holds an even width right through the vertices where three cells meet — and the shatter displaces the space rather than the seeds, so no cell ever swaps neighbours mid-fracture.

Install

bun add ogl

Then copy 2 files into your project:

  • components/registry/voronoi-shatter/voronoi-shatter.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
densitynumber9Cells across the frame. The 3×3 neighbour search runs per pixel regardless, so this changes the look and not the cost — the only knob here that is free.
driftnumber0.28How far each seed orbits its resting point, in cell widths. An orbit rather than a translation: it is bounded by construction, so the seed can never leave its own cell and the lattice cannot tear however high this goes.
seamWidthnumber0.06Thickness of the lit boundary. Widened by the local derivative before it is thresholded, so a seam running diagonally across a pixel is filtered rather than stepped.
seamGlownumber0.6Bloom carried from the seam out into the cells. This is what makes the cells read as panes with light behind them rather than as flat tiles with a line between them.
shatternumber0.45How hard the field is pushed apart under the pointer. At 0 the surface is intact and the component is an ambient cell field; past about 1.2 the near cells stretch far enough to read as smears rather than as panes.
shatterRadiusnumber0.35Reach of the push, as a fraction of frame height. Falls off on a Gaussian — a linear falloff has a hard outer edge that reads as a second circular seam nobody asked for.
cellContrastnumber0.35How much cell-to-cell brightness varies. Keyed to the seed's own hash rather than to the search order, so a cell holds its shade for the whole session instead of flickering as the seeds move past each other.
seamColorstring (hex)"#e9d5ff"The boundaries, and the bloom they cast into the cells.
cellColorstring (hex)"#a855f7"What a fully-lit cell grades toward from the background.
backgroundColorstring (hex)"#08050e"The field behind the cells. Its own material rather than a themed surface, for the same reason every full-bleed background here is.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Pulse
A gentle repeating scale or opacity change to draw attention.
Hover effect
Visual change when the cursor moves over an element.
Interpolation / Tween
Generating all the in-between frames between a start and end value, so motion is continuous.
Hardware acceleration
Animating transform and opacity lets the GPU keep motion smooth.
Reduced motion
Respecting the user's prefers-reduced-motion setting by toning down or removing motion.

Related Components

Appears In