Lerp

Parallax depth layers

Demo

Three flat layers travel by different amounts to suggest depth without WebGL.

How it works

Scroll · Background· 16 sites

Reference: CSS transforms, MDN contributors

How it works

Three flat layers travel by different amounts to suggest depth without WebGL.In 5 steps.

Depth is a difference in speed, not a blur filter. Keep the reading layer stable and move only decorative planes. A shallow range is enough to separate the planes without making a phone feel like a camera ride.

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

    Separate the planes

    Place decorative shapes in independent absolute layers; keep semantic text in normal reading order.

  2. 02

    Read native progress

    Use the section scroll range as the input. No wheel interception or eased touch position.

  3. 03

    Write independent transforms

    Multiply the centered progress by the depth range and each layer coefficient. Overscan the artwork so edges cannot appear.

  4. 04

    Flatten the still

    Reduced motion centers every layer and removes the extra scroll runway.

  5. 05

    Dispose cleanly

    Call destroy() when the view unmounts to disconnect resize and preference observers, remove scroll listeners and cancel pending frames.

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

Three flat layers travel by different amounts to suggest depth without WebGL.

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

Three transform writes per active scroll frame, no canvas and no per-frame geometry reads. Keep the layers modest rather than viewport-sized high-resolution images; the text never moves. 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 gives a readable still or ordinary document flow, without an automatic loop. Live preference changes are respected. The scroll region is keyboard-focusable; touch remains native. Keep essential information outside decorative layers and do not add live announcements for motion.

Source

Source, credited

Original teaching implementation and CSS artwork, informed by the credited CSS transforms 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.