01.02 · Scroll-Based

Parallax Scrolling

Far layers move slower than near ones as you scroll. Best for hero scenes.

Scroll it

Scroll inside the box, or press Play and it scrolls for you.

With parallax

Sky
Hills
Trees
Grass

Try it

Change a setting, then scroll again or press Play.

Depth

Deep spreads the layers' speeds; Flat moves them as one.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add a parallax scene to [your hero section or illustration]. Split the scene into layers from far to near, such as sky, hills, trees and ground, and hold it in place while the visitor scrolls through a taller section. As they scroll, move each layer by its own amount, as the settings choose; usually the farthest layer barely moves and the nearest moves most, which makes the flat picture feel deep. Base the movement on how far through the section the visitor has scrolled, so it starts and stops at the same place every time. If the visitor has reduced motion turned on, keep every layer still. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Hero scenes
  • Landing pages
  • Story sections

Avoid on

  • Text-heavy pages
  • Forms