01.07 · Scroll-Based

Scroll-Triggered Animation

Animations start, follow and pin at set scroll points. Best for landing pages.

Scroll it

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

Fades in
Fades in on arrival
This text fades in as it scrolls into the box, and hides again once it has gone.
Follows the scroll
The square turns, grows and changes color as you scroll.
Pinned
Step 1 of 3
Held in place
The card stops here while the page keeps scrolling.
Steps
Scroll on to light up the dots, one at a time.
That's the end · scroll back up to see each zone again

Copy the prompt

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

Add scroll-triggered animations to [the sections of your page]. Split the page into zones and work out from the scroll position whether each zone is still ahead, on screen or already passed. Fade a zone's content in when the zone arrives and hide it again when it has gone. Tie another animation's progress to how far the visitor has scrolled through its zone, so it plays forward and back with the scroll. Pin one card in place while its text steps through a few stages, and light up a row of dots in steps. Leave some space after the last zone so it can finish. If the visitor has reduced motion turned on, show content without fading it.

Replace the words in brackets with your own sections.

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

  • Landing pages
  • Product pages
  • Feature sections

Avoid on

  • Short pages
  • Forms