Back to library
INTERACTION_130

Scroll Controlled Frame Sequence.

Scroll scrubs through an image sequence like a film strip. Frame 0 painted before the trigger; mapping progress to frame index and painting on requestAnimationFrame once scroll progress through the pinned section.

CATEGORY
Scroll
COMPLEXITY
Advanced
TECH
CSS + JS
PLATFORM
Both
PERFORMANCE
Heavy
LIVE PLAYGROUND
CSS / CSS
/* Scroll Controlled Frame Sequence — Scroll scrubs through an image sequence like a film strip. */
.scroll-frame-sequence {
  --dur: scroll-linked;
  --ease: linear;
  --stagger: 60ms;
  will-change: transform, opacity;
}

.scroll-frame-sequence > * {
  opacity: 0;
  transform: translateY(14px);
  animation: scroll-frame-sequence-in var(--dur) var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* frame 0 painted -> mapping progress to frame index and painting on requestAnimationFrame */
@keyframes scroll-frame-sequence-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-frame-sequence > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
React / TSX
import { useEffect, useRef } from "react";

/** Scroll Controlled Frame Sequence — trigger: scroll progress through the pinned section */
export function ScrollControlledFrameSequence({ children }: { children: React.ReactNode }) {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
      el.dataset["state"] = "in";
      return;
    }
    const io = new IntersectionObserver(
      ([entry]) => {
        if (entry?.isIntersecting) {
          el.dataset["state"] = "in";
          io.unobserve(el);
        }
      },
      { threshold: 0.2 },
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <div ref={ref} className="scroll-frame-sequence" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

INTERACTION_128CSS + JS

Pinned Product Showcase

The product mockup is pinned while its features annotate in turn.

Scroll / MediumView
INTERACTION_129CSS + JS

Horizontal Scroll Section

Vertical scrolling drives a horizontal panel track.

Scroll / MediumView
INTERACTION_015CSS + JS

Scroll Reveal

Content fades and rises as it enters the viewport.

Scroll / LightView
INTERACTION_016CSS + JS

Blur Reveal

Content sharpens from blur as it enters view.

Scroll / MediumView