StealThis .dev

Stagger Fade-in on Scroll

Grid of cards that fade and slide in with a stagger when they enter the viewport. GSAP ScrollTrigger batch.

Open in Lab
gsap scrolltrigger
Targets: JS HTML

Code

Stagger Fade-in on Scroll

A grid of cards that stagger-animate into view as they enter the viewport. Uses ScrollTrigger.batch() — the most performant way to stagger multiple elements without creating one ScrollTrigger per element.

How it works

ScrollTrigger.batch() collects elements that enter the viewport within the same animation frame and fires a single onEnter callback with all of them at once:

ScrollTrigger.batch(".card", {
  onEnter: (batch) =>
    gsap.from(batch, {
      opacity: 0, y: 40,
      stagger: 0.1,
      duration: 0.6,
      ease: "power2.out"
    }),
  start: "top 88%"
});

Why batch() over individual ScrollTriggers

  • One RAF call handles all elements entering together
  • Prevents the “wave” effect when many elements enter simultaneously
  • Significantly less memory and CPU overhead on large grids