Purpose: Sync image sequences to scroll position for cinematic product reveals
Last Updated: 2026-01-07
Map scroll position to video frames. As user scrolls, play through image sequence like a scrubbing timeline. Creates illusion of 3D animation controlled by scroll.
Formula: scrollProgress (0→1) → frameIndex (0→N) → canvas.drawImage()
useScroll hookconst { scrollYProgress } = useScroll({ target: containerRef })
const frameIndex = useTransform(scrollYProgress, [0, 1], [0, 119])
useEffect(() => {
ctx.drawImage(images[Math.round(frameIndex)], 0, 0)
}, [frameIndex])
Why canvas? 10x faster than swapping <img src>. DOM updates are slow.
Apple AirPods Pro - Production example