# Voronoi

> Animate a field of organic cells with crisp edges, an optional edge glow, and gentle shading.

Source: https://www.honestui.com/docs/shaders/voronoi

<ComponentPreview name="voronoi-demo" />

## Overview [#overview]

Voronoi divides the surface into cells, one around each of many slowly wandering points, so the pattern reads like cracked glaze, cell tissue, or a stained-glass network. Edges keep an even width at any scale, can glow softly into the cells, and cells can darken toward their borders so they look slightly raised. With `jitter` at 0 the cells form a square grid; at 1 they are fully organic.

Close, low-contrast cell colors with a single bright edge color work well as a quiet technical background. A palette of distinct colors with thin dark edges reads as stained glass. Raise `scale` for a fine mesh behind dense content, or lower it for a few large cells in a hero.

## Installation [#installation]

<CommandBlock commands="[&#x22;honestui&#x22;]" />

## Usage [#usage]

```tsx
import { Voronoi } from "honestui/shaders"

<div className="h-80">
  <Voronoi
    className="size-full"
    colors={["#16181d", "#21252e"]}
    edgeColor="#5eead4"
    scale={6}
  />
</div>
```

## Accessibility [#accessibility]

Voronoi is decorative: the canvas is hidden from assistive technology, and text or actions belong in normal HTML above it. Bright, glowing edges compete with overlaid text, so test contrast across the moving pattern, or lower `glow` and `edgeWidth` behind content. Animation pauses while the effect is offscreen, while the document is hidden, and when the user prefers reduced motion; a still frame is rendered instead. Use `paused` for your own control, and give the container a background for when WebGL is unavailable.

## API Reference [#api-reference]


  ### `colors`

type: `string[]` · default: `[&#x22;#16181d&#x22;, &#x22;#1c1f26&#x22;, &#x22;#21252e&#x22;, &#x22;#262a35&#x22;]`

Cell colors, up to 8. Each cell picks one at random.

  ### `edgeColor`

type: `string` · default: `&#x22;#5eead4&#x22;`

Color of the edges between cells and of the glow.

  ### `edgeWidth`

type: `number` · default: `1.5`

Edge width in CSS pixels. 0 hides the edges.

  ### `glow`

type: `number` · default: `0.35`

Glow that spreads from the edges into the cells, from 0 to 1.

  ### `shading`

type: `number` · default: `0.5`

Darkens cells toward their edges for a raised look, from 0 to 1.

  ### `scale`

type: `number` · default: `6`

Number of cells across the shorter side of the container.

  ### `jitter`

type: `number` · default: `0.85`

How far each cell's center wanders, from 0 (a square grid) to 1 (fully organic).

  ### `distortion`

type: `number` · default: `0.25`

Bends the whole pattern with a slow wave.

  ### `speed`

type: `number` · default: `0.5`

Animation speed. Changing it never makes the cells jump.

  ### `seed`

type: `number` · default: `1`

Changes the cell layout and color picks while keeping the same look.

  ### `paused`

type: `boolean` · default: `false`

Renders a static frame instead of animating.

  ### `className`

type: `string`

Class for sizing and positioning the container.
