All examples

Scroll story

Layers move at different depths while the sky changes color as you scroll.

scrollInputuseAnimatedCSSinterpolate

Preparing the example…

How it works

  1. scrollInput({ progressY }) writes the scroller's progress from 0 to 1 into one value.
  2. Each layer interpolates that value to its own distance, so the parallax is pure calc().
  3. The sky color is not a calc() expression, so useAnimatedCSS gives it its own variable.
  4. Chapter titles fade in and out over their own part of the progress.

More examples

Search

Type to search the documentation.