Dither Shader
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
A photo re-rendered with animated ordered (Bayer) dithering on canvas.
Code
"use client";
import { DitherShader } from "@/lab/aceternity/ui/dither-shader";
import { Fit } from "./_fit";
export default function DitherShaderDemo() {
return (
<Fit width={680} height={460} max={1.3}>
<div className="flex h-full w-full items-center justify-center">
<div className="relative overflow-hidden rounded-2xl border border-neutral-200 dark:border-neutral-800">
<DitherShader
src="https://images.unsplash.com/photo-1493246507139-91e8fad9978e?q=80&w=1400&auto=format&fit=crop"
gridSize={2}
ditherMode="bayer"
colorMode="grayscale"
invert={false}
animated
animationSpeed={0.02}
primaryColor="#000000"
secondaryColor="#f5f5f5"
threshold={0.5}
className="h-96 w-[600px]"
/>
</div>
</div>
</Fit>
);
}
Prompt
Build "Dither Shader", a canvas animation. What it does: A photo re-rendered with animated ordered (Bayer) dithering on canvas. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS. Technique: an HTML canvas, a requestAnimationFrame loop. It sits on a light background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/dither-shader (Aceternity UI, Aceternity UI licence (free component)).