Canvas
Dithered Image
OGL WebGL dithered image renderer with Bayer, halftone and void-and-cluster threshold maps.
- lit
- ogl
Preview
WebGL dithered image with Bayer, halftone, and void-and-cluster threshold maps.
Attributes
Installation
pnpm dlx shadcn@latest add https://motion-kit-astro.vercel.app/r/dithered-image.json Usage
---
import "@/components/motion-kit/dithered-image-element.ts";
---
<motion-dithered-image
image="/path/to/image.jpg"
dither-map="bayer4x4"
pixel-size="1"
color="#ff6900"
background-color="#17181A"
threshold="0.0"
class="w-full h-[400px]"
/> API Reference
| Attribute | Type | Default |
|---|---|---|
image URL of the image to dither. | string | "" |
dither-map Type of dithering threshold map to use. | bayer4x4 | bayer8x8 | halftone | voidAndCluster | "bayer4x4" |
pixel-size Size of dithering pixels in screen pixels. | number | 1 |
color Foreground color for the dithered pixels. | string | "#ff6900" |
background-color Background color for the dithered image. | string | "#17181A" |
threshold Brightness threshold offset (-1 to 1). | number | 0.0 |