OPUS/UI

Navigation

Dither Field

1-bit (or 3-tone) ordered dithering of drifting noise through a 2×2, 4×4 or 8×8 Bayer matrix at a chunky pixel size. The pointer is a soft spotlight.

webglpointerretropixel6 files · 640 locdeps: clsx, tailwind-merge

Installation

With the shadcn CLI, pointing at this platform’s registry:

npx shadcn@latest add https://opusui.131199999.xyz/r/dither-field.json

Or offline, straight from your opus55 checkout (copies every file it needs):

node ../tailwind_component/opus55/scripts/add.mjs dither-field

Usage

import { DitherField } from "@/components/opus/backgrounds/dither-field";

<DitherField color="#d4ff4f" pixel={3} matrix={8} className="absolute inset-0" />

API

PropTypeDefaultDescription
color / backgroundstring—Ink and paper colours.
midtonestring—Optional third tone for a 3-level dither.
pixelnumber3Dither pixel size (CSS px).
matrix2 | 4 | 88Bayer matrix size.
biasnumber0Brightness offset.
speednumber1Time multiplier. 0 freezes the animation; the pointer stays live.
interactivebooleantrueReact to the pointer (tracked on window, so overlaid content never blocks it).
classNamestring—Classes for the wrapper. Use `absolute inset-0` to fill a relative parent.
childrenReactNode—Optional content rendered above the canvas.

Notes

  • Renders with WebGL2 into a single full-screen triangle — no three.js, no textures, no dependencies.
  • Pauses automatically when scrolled off-screen or when the tab is hidden; resumes on return.
  • prefers-reduced-motion: reduce renders one still frame and ignores the pointer.
  • A CSS gradient fallback paints instantly and stays if WebGL2 is unavailable.

Command palette