Dither

Paper's animated dither shapes: sphere, warp, wave, ripple, swirl and dots.

Preview

Installation

pnpm add astro-dither

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

Usage

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

<Dither shape="sphere" size={2} speed={0.4} />

The original Paper dithering shader, driving six shape families. It runs in its own WebGL context per element and takes colour, pattern and motion props straight from the Paper API.

Props

PropTypeDefaultDescription
shape"sphere" | "warp" | "wave" | "ripple" | "swirl" | "dots""sphere"The Paper dithering shape.
type"random" | "2x2" | "4x4" | "8x8""4x4"The threshold pattern.
sizenumber2Pattern scale.
speednumber0.4Animation speed.
scalenumber1Overall zoom.
colorBackstring"#000000"Paper colour.
colorFrontstring"#00b2ff"Ink colour.
colorHighlightstringcolorFrontBright edge colour.
pxSizenumber2Dither cell size in pixels.
classstringundefinedClasses on the element.

Notes

  • Decorative surfaces render aria-hidden. Put real text on top, not inside them.
  • With reduced motion it draws one still frame and stops.
  • It pauses when scrolled out of view or when the tab is hidden.