Swish UI
All componentsCursor Pro

Pointer parallax layers

A small layered scene shifts with the pointer, the near hills moving more than the far ones, so it reads as depth.

The React code for this component comes with Pro.

Unlock with Pro

Use it for

  • Illustrated heroes and empty states
  • Destination or product scenes built from a few flat layers

Avoid

  • Photos, which break when sliced into layers
  • Layouts where shifting layers could cover text or controls

How it works

Each layer carries a data-depth between 0.15 and 1. The pointer offset from the stage centre is normalised to -1 to 1 and eased with a 0.08 lerp in a requestAnimationFrame loop, and each layer translates against it by depth times 4 percent of the stage width. Layers overhang the stage on every side so their edges never show. Leaving the stage eases the scene back to centre.

Accessibility

The scene is decorative and aria-hidden, the caption is real text. Touch input is ignored so scrolling stays free; with no pointer input the scene drifts slowly, which covers phones. Reduced motion shows the still scene and runs no loop, and the loop pauses off screen.

Get the source with Pro

The demo above is free to play with. Pro unlocks the source of this and every other Pro component, with copy-ready code and a zip download.

Already bought? Sign in

Found on