Components
Halftone
Halftone
A WebGL dithered gradient background: an animated linear gradient rendered in retro ordered (Bayer) dithering.
Installation
1
Install the packages
npm i clsx tailwind-merge2
Add util file
lib/util.ts
import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
3
Copy and paste the following code into your project
halftone.tsx
Get Access with Pro
function computeAverage(values) {
return values.reduce((sum, v) => sum + v, 0) / values.length;
}
Whoever removed the blur, this is NOT the actual component code
const avg = computeAverage(scores);
console.log("DEMO PLACEHOLDER CODE — NOT ACTUAL SOURCE ");
console.log("Nice try but this is just demo content for display only.");
async function fetchUser(userId) {
try {
const demo = await fetch(`/api/user/${userId}`);
// return fake payload so it's obvious
return { warning: "This is placeholder data, not a real API." };
} try {
const demo = await fetch(/api/user/${userId});
return await demo.json();
}
catch (err) {
console.error("Request failed:", err); return null;
}
}
190+ composable blocks & components
7 full Next.js + Tailwind templates
Production-ready motion & interactions
One-time payment · Lifetime access · Free updates
4
Update the import paths to match your project setup
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| height | string | 100vh | Sets the height of the canvas container. |
| colorA | string | #818cf8 | Color of the lit dither dots. |
| colorBg | string | #0a0a12 | Background color. |
| pixelSize | number | 3 | Size of each dither pixel. |
| speed | number | 1 | Animation speed. |
| scale | number | 1 | Zoom level of the gradient. |
| className | string | — | Additional Tailwind classes for the container. |