Pixelate
Pixelate an image or procedural field, with optional glitch bursts, channel split, scanlines, and a sharp lens under the pointer.
Overview
Pixelate samples its source once per block, so the picture reads as large pixels. On top of that sit independent layers you can mix:
- Glitch fires short random bursts: bands of rows shift sideways, the red and blue channels split, and a few blocks invert. At 0 the effect is perfectly still.
- Color split keeps a constant red and blue offset, like a misaligned print or a cheap lens.
- Scanlines darken alternate lines for a display look.
- Color levels posterizes each channel to a small palette.
- Reveal sharpens a soft circle under the pointer, so people can look through the pixels.
Without src, Pixelate works on a slow procedural field.
The playground uses free Unsplash photographs by Martin Péchy and Marc Wieland.
Installation
Usage
Image with a reveal lens
import { Pixelate } from "honestui/shaders"
<Pixelate
alt="Blue and orange apartment buildings against a clear sky."
className="h-80 rounded-xl"
pixelSize={14}
reveal
src="https://images.unsplash.com/photo-1553933420-77617bac448e?auto=format&fit=crop&w=1600&q=85"
/>Glitch
<Pixelate className="h-80 rounded-xl" pixelSize={6} glitch={0.5} colorSplit={1.5} scanlines={0.3} />Remote image hosts must allow cross-origin use so WebGL can read the pixels. Glitches need a render loop, so a Pixelate with glitch above 0 keeps drawing while it is visible.
Accessibility
Glitch bursts flash and jump. Keep glitch low on large areas, never pair it with content people must read, and avoid it entirely near text or controls; rapid flashing can trigger seizures or migraines. When the user prefers reduced motion, glitches and the procedural field stop and one still frame shows. The pointer reveal is optional decoration and has no keyboard equivalent, so do not hide information behind it.
In image mode, write alt text for the image's purpose, or an empty string when it is decorative. The original image shows until the canvas is ready and remains in the accessibility tree afterwards.