Skip to main content

React animation example

React Parallax Effect: Layered Depth Scene

Parallax works when near things move more than far things. This scene stacks five layers, sky, sun, two mountain ranges and a foreground ridge, and offsets each one by its depth as the pointer moves. With no pointer it drifts on its own, so it still reads as parallax on touch screens.

  • 4.2 KB file
  • 5 live inputs
  • React runtime
Live, try it

How this depth parallax scene works

  • Each layer moves by depth × pointer offset, so the foreground travels about six times farther than the sky.
  • Offsets are smoothed every frame, which keeps the motion soft instead of tracking the mouse one to one.
  • Raise depth for a dramatic hero, lower it for a calm background behind text.

Add it to your React app

Install exodeui, download the file below, and paste this. The code updates as you customize. Other runtimes are in the other tabs.

import { ExodeUICanvas } from 'exodeui';

// react-parallax.bexode goes in /public (download it below)
export function ReactParallax() {
  return (
    <ExodeUICanvas
      src="/react-parallax.bexode"
      fit="Layout"
      autoPlay
      interactive
      style={{ width: '100%', height: 500 }}
    />
  );
}

Inputs

InputTypeDefaultRange
depthNumber10 – 2.5
headlineTextBuilt in layers—
accentText#ffb86bhex colour
accent2Text#5b4bd6hex colour
bgText#120f2ahex colour

More React animations

The same idea in other frameworks: Flutter parallax scroll list · SwiftUI tilt parallax poster · Vue starfield parallax hero