Gradient Grain

Pro

Light leaks on film: saturated colour that burns to white under fine grain.

backgroundgradientgrainnoisewebglshaderherofull bleed
Gradient Grain component preview

Overview

Gradient Grain is a React and Tailwind CSS grainy gradient background that looks like light leaking onto film, in Next.js or any React app, drawn in one WebGL pass. Saturated color blooms out of black and burns to white where it is hottest, in mesh, horizon, orbit, or ribbon compositions. Grain can sit still like print or move at 24 fps like film, and the light leans toward the pointer. Drawing stops when it scrolls away or the tab hides, and reduced motion leaves one frame. Use a near black background, since the light screens over it.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add gradient-grain

Usage

Import GradientGrain from @/components/wensity/gradient-grain and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { GradientGrain } from "@/components/wensity/gradient-grain";
export default function Hero() {
return (
<GradientGrain
className="h-[560px] w-full"
variant="horizon"
colors={["#2f0bff", "#4a1dff"]}
background="#020108"
>
<div className="grid h-full place-items-center text-5xl font-semibold text-white">
Light, leaking.
</div>
</GradientGrain>
);
}

Props

PropTypeDefaultDescription
variant"mesh" | "horizon" | "orbit" | "ribbon""mesh"Composition of the light: leaks that cross and burn out low, a glow from the lower corner, a turning ring, or a flowing band.
colorsstring[]AfterglowColours of the light, 1 to 5 hex values. Saturated hues work best: where they meet, they burn to white.
exposurenumber1.6How hot the light burns. Higher values blow the cores out to white.
backgroundstring"#030304"Page colour the light sits on. The light screens over it, so near-black reads best.
grainnumber0.55Grain strength, 0 to 1.
grainSizenumber1.25Size of one grain in CSS pixels. 1 is fine film, 3 and up is coarse riso.
grainMotionbooleanfalseLet the grain move like film at 24 fps instead of sitting still like print.
speednumber1Motion speed of the light. 0 holds it still until the pointer moves.
pullnumber0.5How far the light leans toward the pointer. 0 turns it off.
dprnumber-Render scale. Defaults to the device ratio, capped at 2.
pausedbooleanfalseFreeze on the current frame.
childrenReactNode-Content layered above the gradient, such as hero copy.
  • Split-Flap Display component preview

    Split-Flap Display

    A ceramic and graphite split-flap device that ripples each flap into your message.

  • Interactive 3D Globe component preview

    Interactive 3D Globe

    A 3D Earth lit day and night from the real sun position, wrapped in a soft atmosphere, with smooth drag-to-orbit controls.

  • Animated Code Diff Viewer component preview

    Animated Code Diff Viewer

    Inline or toggled code diffs rendered inside the same polished code block frame, flipping between before and after.

  • Animated Terminal component preview

    Animated Terminal

    A terminal UI with self-typing commands, CRT phosphor glow and scanlines, streaming output that never re-renders a line.

Featured in React animated backgrounds.