Mesh gradient

Colour blobs that drift and melt into each other.

Preview

Installation

pnpm add astro-dither

Or copy the source into your project: npx astro-dither add effect

Usage

---
import { DitherEffect } from "astro-dither";
---

<DitherEffect effect="mesh" />

Four blobs weighted across the palette range wander slowly. size sets each blob's reach and sway how far they roam, so small values freeze the mesh and large ones smear it.

The props group like this:

Shape: size, sway. Colour: palette, blob by blob.

Examples

Wide melt

Large size and sway blend the palette into one soft wash.

Confetti

Small size keeps each blob distinct over the paper colour.

Props

PropTypeDefaultDescription
sizenumber0.42Each blob's radius. 0.1 to 1.
swaynumber0.15How far the blobs wander. 0 to 0.5.
palettestring[]the effect's2 to 8 colours, paper first, brightest last. transparent works.
cellnumber2Size of one dither cell in CSS pixels, 1 to 8.
matrix2 | 4 | 8 | "noise"8The Bayer threshold size, or noise for a random look.
speednumber1Playback speed. 0 draws one still frame.
classstringundefinedClasses on the surface element, for size and position.

Notes

  • Decorative and aria-hidden. Put real text on top of it, not inside it.
  • With reduced motion it draws one still frame at 3s and stops.
  • It pauses when scrolled out of view or when the tab is hidden.
  • It shares one WebGL context with every other ordered effect on the page.