Lerp

Grain and noise overlay

Demo

A tiny cached texture adds film grain without regenerating pixels on every frame.

How it works

Background· 10 sites

Reference: Canvas image data, MDN contributors

How it works

A tiny cached texture adds film grain without regenerating pixels on every frame.In 5 steps.

Texture should support the image, not compete with the words. Generate a small monochrome tile once, repeat it over a decorative surface, and move the cached layer in discrete steps. Keep the copy above the grain and offer a static version.

The controls below are authored demonstration values, not measurements of the linked sites. The stored fits currently describe scroll smoothing and intro curves, not this effect's geometry; see each site's spec sheet for those separately measured values and fit errors.

  1. 01

    Generate once

    Fill a small image buffer with seeded luminance noise so the texture is repeatable and cheap to capture.

  2. 02

    Cache the tile

    Use the canvas as a data URL for a repeating background; never run random pixel generation in the frame loop.

  3. 03

    Move only the overlay

    Overscan the texture and translate it between a few deterministic offsets. This intentionally stepped texture is not smooth object motion.

  4. 04

    Separate the reading layer

    Keep text and controls above the grain. Reduced motion freezes the offsets while keeping the material.

  5. 05

    Dispose cleanly

    Call destroy() on unmount to disconnect observers, remove preference and visibility listeners and cancel the pending frame. The cached texture goes with the removed subtree.

Code

The code

The engine is the file the demo above runs, framework-agnostic; the Svelte and React tabs wire it into a component.

Pro

Copy the engine, React or Svelte version.

Unlock code with Pro

US$60/year or US$8/month. Cancel anytime.

Prompt

Prompt pack

A tiny cached texture adds film grain without regenerating pixels on every frame.

1 prompts in Pro Generated 25 Sep 2026

  • Build it with a coding agentA framework-independent implementation brief with authored controls.

Pro opens every prompt, with the measured values filled in and ready to paste into your coding agent.

Unlock prompts with Pro

US$60/year or US$8/month. Cancel anytime.

Performance & accessibility

Performance

The only pixel work is a small one-time tile. Subsequent updates change transform on a bounded overlay at a deliberately low texture cadence; opacity and scale change only when the controls change. Avoid a full-screen SVG turbulence filter or new random pixels every frame. The demo targets a frame budget suitable for phone displays; profile on the target device rather than treating an unloaded desktop frame counter as a guarantee. The host pauses the demo off screen. The standalone engine removes its observers and listeners on destroy.

Reduced motion

Reduced motion keeps the texture but freezes it. Live preference changes are respected. The Animate texture control also stops movement. The entire background is aria-hidden and cannot receive pointer events; text remains above it with stable contrast. Check contrast against the lightest part of the underlying artwork.

Source

Source, credited

Original teaching implementation and CSS artwork, informed by the credited Canvas image data documentation and the library's linked site observations. No source site's code or assets are reproduced. A site link describes the observed visual pattern, not proof that the site uses this engine or browser API.

Seen in the library

Sites using this effect.