Back to Explore
THE PLAYGROUND · SCROLL & NAVIGATION

Scroll-linked Scaling

An image changes size in step with scrolling.

Scroll-linked ScalingScroll & Navigation · An image changes size in step with scrolling.
SCROLL
FIELD NOTES
Dolomite mountain landscape
Find your rhythmA moment worth noticing.
Make space for ideasA moment worth noticing.
Follow the feelingA moment worth noticing.
Stay curiousA moment worth noticing.
Keep exploringA moment worth noticing.
SCROLL INSIDE PREVIEW · 600 ms
1import { useState } from "react";2import { motion } from "motion/react";3 4const surface = { width: 100, height: 100, borderRadius: 16, background: "#b8ed79", display: "grid", placeItems: "center", color: "#141714" };5 6export default function ScrollScaleDemo() {7  const [scroll, setScroll] = useState(0);8  return <div onScroll={e => setScroll(e.currentTarget.scrollTop)} style={{height: 260, overflowY: "auto"}}>9    <header style={{position: "sticky", top: 0, background: "#202420", height: 40, color: "white"}}>Field notes</header>10    <motion.div style={surface} animate={{scale: 1+Math.min(scroll/500,.5)*1}}>Image</motion.div>11    {[0,1,2,3,4,5,6].map(n => <motion.div key={n} style={{...surface, width: 260, height: 80, margin: 12}} >Note {n+1}</motion.div>)}12  </div>;13}

Install: npm install motion. Link scale directly to scroll progress, not a timer. This compact example illustrates the core technique; the styled playground contains additional presentation details.