talira

ScrollMagic

Lightweight library for scroll-driven interactions and events

open sourceMITfree

ScrollMagic tells you where an element is relative to the viewport as the user scrolls and fires events when that changes, as a small wrapper around IntersectionObserver and ResizeObserver. It doesn't animate anything itself: you use its scroll-position data for class toggles, animations, lazy loading, parallax and the like. Version 3 is zero-dependency, TypeScript-native, SSR-safe, works with any scroll container horizontally or vertically, has a plugin system and works with any framework.

Problems it solves

  • trigger animations when an element scrolls into view
  • scroll-based class toggles and parallax without a heavy library
  • know how far an element has scrolled through the viewport

Features

  • scroll-position data and events
  • IntersectionObserver and ResizeObserver based
  • zero dependencies
  • TypeScript and SSR safe
  • any scroll container, horizontal or vertical
  • plugin system

Limitations

  • Version 3 is a rewrite: v2's API lives on the v2-stable branch, and npm's latest release is still v2.12

Alternatives

The same job

These do what ScrollMagic does.

  1. Lenis Lightweight smooth-scroll library that runs on the browser's native scroll

Compare ScrollMagic with the top 3