# Plasma

Classic plasma: overlapping sine waves that flow into each other, dithered in two colours or a whole palette.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. The dithercn agent skill, for building any dither on the engine, is at [/.well-known/agent-skills/dithercn/SKILL.md](/.well-known/agent-skills/dithercn/SKILL.md).

<ComponentPreview src="examples/plasma-demo.tsx" size="full" align="stretch" controls="plasmaControls">
  <PlasmaDemo />
</ComponentPreview>

## Installation [#installation]

<InstallBlock name="plasma" />

## Usage [#usage]

```tsx
import { Plasma } from "@/components/dithercn/plasma";

export function Hero() {
  return (
    <section className="relative isolate min-h-[480px]">
      <Plasma className="absolute inset-0 -z-10" />
      <h1>Your headline</h1>
    </section>
  );
}
```

Plasma fills its box, so give it a size with `className`. Four sine waves, one of them circling the centre, add up to a pattern that never repeats. A slow noise warp bends it so it doesn't look mechanical. By default it runs from `--dither-paper` through `--chart-5` to `--dither-ink`.

## Examples [#examples]

### Through a palette [#through-a-palette]

Pass any number of colours from paper to ink. More `bands` cycle through the palette more often, and blue noise swaps the Bayer grid for an even grain.

<ComponentPreview src="examples/plasma-palette.tsx" size="full" align="stretch">
  <PlasmaPalette />
</ComponentPreview>

### Behind a headline [#behind-a-headline]

`intensity` caps the brightest tone, so the crests never reach full ink and the text stays readable. A smaller `scale` and more `warp` give fewer, softer shapes.

<ComponentPreview src="examples/plasma-headline.tsx" size="lg" align="stretch">
  <PlasmaHeadline />
</ComponentPreview>

### Coarse and still [#coarse-and-still]

Large cells, the 2×2 matrix and only four `levels` give hard contour bands like an old demo-scene effect. `animate={false}` holds one frame.

<ComponentPreview src="examples/plasma-coarse.tsx" size="lg" align="stretch">
  <PlasmaCoarse />
</ComponentPreview>

## Props [#props]

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `scale` | `number` | `1` | Size of the pattern. Higher values pack more waves in. |
| `warp` | `number` | `0.3` | How far slow noise bends the waves, from 0 (pure sines) to 1. |
| `bands` | `number` | `1.5` | How many times the colours cycle across one wave. |
| `intensity` | `number` | `1` | The brightest tone, from 0 to 1. Lower it to put text on top. |
| `palette` | `[DitherColor, DitherColor, ...DitherColor[]]` | `["--dither-paper", "--chart-5", "--dither-ink"]` | Colours from paper to ink: palette names such as "blue", CSS variable names, or any CSS colour. |
| `matrix` | `"bayer2" \| "bayer4" \| "bayer8" \| "blue-noise"` | `"bayer4"` | The threshold pattern. See Dither engine. |
| `levels` | `number` | `All the matrix can draw` | Tones the plasma snaps to before dithering. Lower values give hard contour bands. |
| `cell` | `number` | `--dither-cell` | Size of one dither cell in CSS pixels. |
| `speed` | `number` | `1` | How fast the waves move. |
| `animate` | `boolean` | `true` | false draws one still frame. |
| `className` | `string` | `–` | Size and position. The plasma fills this box. |

## Notes [#notes]

* The plasma is decorative and hidden from assistive technology. Put real text on top of it, not inside it.
* With reduced motion turned on, it draws one still frame and stops.
* It pauses when scrolled out of view or when the tab is hidden, and releases its WebGL context when far offscreen. Without WebGL it shows soft CSS blobs in the same colours.
* One draw per frame at 30 fps, at one pixel per dither cell. See [Performance](/docs/engine/performance).