01.01 · Scroll-Based
Parallax Depth-of-Field
Layers move at their own speed as the focus shifts. Best for cinematic intros.
Scroll it
Scroll inside the box, or press Play and it scrolls for you.
Focus shifts
Far: the sky Near: the front ridgeInside, five layers run from far to near. Scroll the box or press Play: the Focus frame slides toward you, each layer blurs by its distance from it, and dashed outlines show where they started.
All sharp keeps every layer crisp; Focus shifts blurs each layer by its distance from a focus that slides from the sky to the front ridge. Scroll the box or press Play to watch.
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 depth-of-field effect to [your layered scene or illustration]. Split the scene into layers from far to near and hold it in place while the visitor scrolls through a taller section. As they scroll, move each layer by an amount that grows with its nearness, and move a point of sharp focus from the farthest layer to the nearest: blur each layer by how far it sits from that focus. Ease the layers toward the scroll position on every frame by a share of the distance left, exponential in the time since the last frame, so a wheel's jumps turn into smooth movement at the same pace on every screen. If the visitor has reduced motion turned on, keep the layers still and only shift the focus.
Your settings
Replace the words in brackets with your own scene.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.