Canvas
Dithered Image
OGL WebGL dithered image renderer with Bayer, halftone and void-and-cluster threshold maps.
Preview
WebGL dithered image with Bayer, halftone, and void-and-cluster threshold maps.
Attributes
Installation
pnpm dlx motion-blocks add dithered-image Usage
---import "@/components/motion-blocks/dithered-image-element.ts";--- <motion-dithered-image image="/path/to/image.jpg" dither-map="bayer4x4" pixel-size="1" color="#6c87bc" 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 | "#6c87bc" |
background-color Background color for the dithered image. | string | "#17181A" |
threshold Brightness threshold offset (-1 to 1). | number | 0.0 |

