Skip to content
Uxelith
Prov1.0.0Backgrounds

Dither Lens

A picture in two inks, dithered like an old screen or newsprint, with a lens that shows the real colours wherever the pointer goes while the dots ripple out around it.

Installs with Uxelith ProHow
Licence
Pro
Packages
2
Updated
5 Nov 2026
Live

Installation

Usage

example.tsx
import { DitherLens } from "@/components/dither-lens"

export function Hero() {
  return (
    <DitherLens text="Signal." y={0.42} className="flex min-h-[32rem] flex-col items-center justify-end px-6 pb-12 text-center">
      <p className="text-muted-foreground">Move your pointer to see through.</p>
    </DitherLens>
  )
}

Props

PropTypeDefaultDescription
textstring"Signal."The headline in the picture, in your page's font. Also real text on the page, for screen readers and search engines.
srcstring—A photo to dither instead of the headline (same origin or served with CORS).
colors[string, string]["var(--background)", "var(--primary)"]The two inks, dark then light. Any CSS colour.
pattern"bayer" | "dots" | "lines""bayer"An ordered dither, newspaper dots, or engraved lines.
cellnumber4Size of one dot, 2–12 CSS pixels.
sizenumber1Size of the lens, 0.5–1.6.
ynumber0.45Where the headline sits, from 0 (top) to 1 (bottom).
autoplaybooleantrueWhen nobody is near, the lens wanders slowly over the picture.
interactivebooleantrueThe lens follows the pointer on a spring; pressing opens it wider.
momentnumber—Holds the lens still where it wanders to at this moment, in seconds.
captureRefRef<DitherLensHandle>—capture(width, height) resolves a PNG at any size: wallpapers, social cards, a 4K hero.
...propsHTMLAttributes<HTMLDivElement>—Children sit above the picture and stay interactive.

Accessibility

  • The headline is real text in the page (visually hidden), so screen readers and search engines read it; the canvas and its still are decorative and hidden from assistive technology.
  • With prefers-reduced-motion the lens rests over the headline, the dots stay still and the pointer is ignored.
  • It pauses off-screen and in hidden tabs, and frees its GPU memory when removed.
  • Without WebGL2, on a software renderer, or on a device that can't hold a smooth frame rate, it shows the picture without the effect.

Changelog

  1. v1.0.0Latest

    First release.

More in Backgrounds

All 9 in Backgrounds
  • BackgroundsPro

    ASCII Field

    Your headline or a photo drawn in characters, like a terminal: near the pointer the letters ripple and warm up, and a press sends a wave across the field.

  • BackgroundsFree

    Fluid Ink

    Ink that flows like a real fluid behind your content: stir it with the pointer, press to burst colour, and watch it curl and fade. A WebGL fluid simulation in your theme colours, with no libraries.

  • BackgroundsPro

    Glass Lens

    A liquid glass orb follows the pointer and bends the page behind it: your headline magnifies through it, the rim splits light into colour, and pressing swells the glass. WebGL, in your theme, with no libraries.