All answers · Motion and code · 55 questions

Scroll animation, answered.

Plain, correct answers about animating websites on scroll, from one-line CSS reveals to pinned stories and scrubbed image sequences. For designers and developers who want scroll effects that stay smooth on phones.

What is scroll animation on a website?

Scroll animation is motion on a web page that responds to scrolling. It comes in two forms: animations that start when an element scrolls into view, such as a fade-in, and animations whose progress is tied to the scroll position, such as parallax, a pinned product story or a video that scrubs forward and backward. It is built with CSS scroll-driven animations, IntersectionObserver or libraries like GSAP ScrollTrigger.

Scroll animation guideScroll animation templates

What is the difference between scroll-triggered and scroll-linked animation?

A scroll-triggered animation starts when the page reaches a point, then plays on its own clock at a fixed duration, regardless of how fast the visitor keeps scrolling. A scroll-linked animation has no clock: its progress maps directly to scroll position, so it moves forward when you scroll down, backward when you scroll up and stops when you stop. Fade-in reveals are triggered. Parallax, progress bars and scrubbed sequences are linked.

Scroll animation guideGSAP answers

How do CSS scroll-driven animations work?

CSS scroll-driven animations run a normal @keyframes animation on scroll progress instead of on time. You define the keyframes as usual, then set animation-timeline to scroll() to follow how far a scroll container has moved, or to view() to follow one element as it crosses the viewport. animation-range picks which part of that journey plays the keyframes. No JavaScript runs on the scroll path, so the browser can keep the motion smooth.

Scroll animation guidePerformance answers

Which browsers support CSS animation-timeline?

CSS scroll-driven animations, including animation-timeline with scroll() and view(), shipped in Chromium browsers such as Chrome and Edge from version 115 and in Safari from version 26. Firefox has had an implementation behind a configuration flag rather than on by default. Support changes, so check a current compatibility table before relying on it, and wrap the rules in @supports (animation-timeline: view()) so other browsers show the finished state.

Scroll animation guideHTML and CSS templates

What is the difference between scroll() and view() in CSS?

scroll() creates an anonymous scroll progress timeline that tracks how far a scroll container has scrolled, from top to bottom, which suits reading progress bars and page-wide effects. view() creates an anonymous view progress timeline that tracks a single element as it enters, crosses and leaves the visible area of its scroller, which suits reveals and per-element parallax. scroll() accepts a scroller such as root, nearest or self and an axis; view() accepts an axis and an inset.

Scroll animation guideScroll animation templates

What does animation-range do in CSS?

animation-range sets which part of a scroll or view timeline plays the animation. With view timelines you can use named ranges: entry is the element coming into view, exit is it leaving, contain is the stretch where it is fully visible, and cover is the whole journey. Percentages refine them, so animation-range: entry 0% entry 60% finishes a reveal when the element is 60 percent of the way into the viewport.

Scroll animation guideReduced motion guide

How do I add a fallback for browsers without scroll-driven animations?

Put the scroll-driven rules inside @supports (animation-timeline: view()) or @supports (animation-timeline: scroll()), and make the default, unsupported state the finished design with every element visible. Unsupported browsers then simply show the page without the effect. If the effect is essential, load a small JavaScript fallback with IntersectionObserver or GSAP ScrollTrigger only when CSS.supports() returns false. Never hide content by default and rely on the animation to reveal it.

Scroll animation guideGSAP answers

How do I use IntersectionObserver for scroll reveals?

Create an IntersectionObserver with a callback, observe each element you want to reveal, and when an entry reports isIntersecting, add a class such as is-in that runs a CSS transition, then call unobserve on that element so the work stops. Set the hidden starting state only after JavaScript adds a class to the html element, so visitors without scripts still see the content. One observer can watch hundreds of elements efficiently.

Scroll animation guideMotion components

What do rootMargin and threshold mean in IntersectionObserver?

threshold is how much of the target must be visible before the callback fires: 0 means any pixel, 0.5 means half, 1 means all of it, and an array fires at each value. rootMargin grows or shrinks the area used for the check, written like CSS margins. A rootMargin of 0px 0px -10% 0px makes elements count as visible only once they are a little way above the bottom edge, so reveals happen where people actually see them.

Scroll animation guideFast sites on phones

Should I use scroll event listeners or IntersectionObserver?

Use IntersectionObserver whenever you only need to know when an element enters or leaves view. It reports visibility changes asynchronously, so you avoid reading layout on every scroll event, which is a common source of jank. Scroll listeners are still fine for continuous values, but mark them passive, read scroll position once per frame inside requestAnimationFrame, and avoid calling getBoundingClientRect on many elements each time.

Scroll animation guidePerformance answers

How do I pin a section while the page scrolls?

For a simple pin, use CSS position: sticky with a top value inside a tall parent: the element sticks while its parent scrolls past. For a pinned scene where animation plays during the pin, use GSAP ScrollTrigger with pin: true, a start such as "top top" and an end such as "+=2000", plus scrub so the animation follows the scroll. ScrollTrigger adds spacing after the pinned element so following content waits until the scene ends.

GSAP answersScroll animation templates

Should I use position sticky or ScrollTrigger pin?

Use position: sticky when you only need an element to stay in place while its container scrolls past: it is pure CSS, costs nothing and works everywhere modern. Use ScrollTrigger pin when you need the pin tied to an animation timeline, precise start and end points, automatic spacing, or pinning that sticky cannot do, such as when an ancestor has overflow hidden, which breaks sticky. Many scroll stories combine sticky layouts with CSS or GSAP animations inside.

GSAP answersScroll animation guide

How do I make a parallax scroll effect?

Move layers at different speeds as the page scrolls. The modern CSS way is a view() timeline that animates translateY on a background layer across its journey, so it moves slower or faster than the content. With GSAP, tween the layer's yPercent with a ScrollTrigger set to scrub: true and ease: "none". Keep distances modest, animate only transform, and disable or reduce the effect under prefers-reduced-motion.

Scroll animation templatesReduced motion guide

Is parallax scrolling bad for accessibility?

Parallax can be a problem for people with vestibular disorders, because layers moving at different speeds from the scroll input can cause dizziness or nausea, especially when large areas move. It is not banned, but it should be subtle and honor prefers-reduced-motion by switching to a static layout. WCAG 2.3.3, Animation from Interactions, at level AAA, asks that motion triggered by interaction can be disabled unless it is essential.

Reduced motion guideAccessibility

How do I build horizontal scrolling on a vertical page?

Pin a section and translate a wide inner track sideways as the visitor scrolls down. With GSAP, set pin: true and scrub: true on the section's ScrollTrigger, tween the track's x to minus its scrollWidth minus the viewport width with ease: "none", and set end to that same distance so speed feels natural. Use invalidateOnRefresh so the distance recalculates on resize. Native horizontal swiping with scroll-snap is a lighter option on phones.

GSAP answersScroll animation templates

Is horizontal scrolling bad for UX?

Horizontal scrolling is fine as a deliberate, short sequence, such as a pinned gallery or a timeline, but bad when it hides essential content or when visitors cannot tell more content exists. Show a clear hint like a partly visible next card, keep the sequence short, make it reachable by keyboard, and make sure the page never scrolls sideways by accident. On phones, a native swipe carousel often works better than a scroll-converted track.

Scroll animation templatesFast sites on phones

What is smooth scrolling and should I use it?

Smooth scrolling interpolates the scroll position so wheel input glides to a stop instead of jumping in steps. CSS scroll-behavior: smooth only affects programmatic and anchor jumps. Libraries such as Lenis smooth wheel scrolling itself, which makes scroll-linked animations feel steadier. Use it when the design depends on scrubbed scenes or WebGL tied to scroll. Skip it on content-heavy pages, and keep native touch scrolling on phones.

Scroll animation guideGSAP templates

What is Lenis?

Lenis is an open-source JavaScript smooth scroll library. It smooths wheel and trackpad scrolling while keeping the page's native scroll, so position: sticky, scroll position APIs and IntersectionObserver keep working. By default it leaves touch scrolling native on phones. You create an instance, run it on each animation frame or with its autoRaf option, and tune feel with options such as lerp or duration. Lenis is often paired with GSAP ScrollTrigger.

GSAP templatesScroll animation templates

How do I use Lenis with GSAP ScrollTrigger?

Drive Lenis from the GSAP ticker and update ScrollTrigger on every Lenis scroll. The usual setup is lenis.on("scroll", ScrollTrigger.update), then gsap.ticker.add((time) => lenis.raf(time * 1000)), then gsap.ticker.lagSmoothing(0). This keeps one animation loop, so pinned and scrubbed scenes stay in sync with the smoothed scroll. Do not also enable Lenis autoRaf in this setup, or the page runs two loops.

GSAP answersGSAP templates

Does smooth scrolling hurt accessibility?

It can if done badly. Problems include broken keyboard scrolling, anchor links and find-in-page that land in the wrong place, scroll that keeps moving after the user stops, and screen readers losing track of focus. A well configured library that keeps native scroll avoids most of these. Turn smoothing off when prefers-reduced-motion is set, keep keyboard and touch scrolling native, and test anchor links and Tab navigation.

Reduced motion guideAccessibility

What is scroll storytelling?

Scroll storytelling is a page structure where scrolling advances a narrative: sections pin in place, visuals change as copy arrives, and a product, map or film develops step by step with the reader's scroll. It is common in product launches, case studies, data journalism and brand stories. AnimatedWebs groups these pages in its scroll animation collection, with pinned chapters, scrubbed image sequences, horizontal tracks and 3D product reveals.

Scroll animation templatesScroll film templates

How do I plan a scroll story before building it?

Write the story as a list of beats first: what the visitor should understand at each step, the one visual change that shows it, and the copy that goes with it. Then decide which beats pin, how much scroll distance each gets and where the visitor can leave with a call to action. Keep the first beat readable without scrolling. Sketching beats on a timeline before coding saves rework once animations are tied to scroll.

Scroll animation guidePrompting for better motion

Why is my scroll animation janky?

Scroll jank usually comes from making the browser recalculate layout or repaint large areas on every frame. Common causes: animating top, left, height or width; reading layout with getBoundingClientRect inside scroll handlers; heavy filters or shadows on big elements; too many elements animating at once; huge images decoding mid-scroll; and two systems fighting over the same element's transform. Animate transform and opacity, read layout once, and profile in the DevTools Performance panel.

Fast sites on phonesPerformance answers

Which CSS properties should I animate on scroll?

Animate transform and opacity on scroll whenever possible. Transform covers translate, scale and rotate, and the browser can usually composite it without layout or paint. Opacity is equally cheap. clip-path and filter are acceptable on small elements but cost more over large areas. Avoid scroll-linking width, height, margin, padding, top, left or box-shadow, because each scroll frame then forces layout or repaint work.

Scroll animation guideReduced motion and performance

Does will-change improve scroll animation performance?

Sometimes, if used sparingly. will-change: transform hints that an element will move, so the browser can promote it to its own layer ahead of time and avoid a stutter when motion starts. Applied to many elements, it wastes GPU memory and can make performance worse, especially on phones. Add it only to the few elements that animate continuously, or set it just before an animation and remove it after.

Fast sites on phonesPerformance answers

Why do scroll animations break on mobile?

Mobile breaks scroll animations in a few predictable ways. The address bar shows and hides as you scroll, which changes the viewport height and can make pinned sections jump or recalculate. Momentum scrolling fires positions quickly, exposing heavy work. Weaker GPUs drop frames on effects that run fine on laptops. Fix it with small viewport units such as svh, shorter scroll ranges, lighter effects, and testing on a real phone.

Fast sites on phonesScroll animation templates

How do I fix 100vh problems on mobile scroll pages?

Use the newer viewport units instead of vh. svh is the small viewport height with browser toolbars shown, lvh is the large height with them hidden, and dvh updates as toolbars move. For full-screen heroes and pinned scenes, svh avoids content being cut off, while dvh can cause layout to resize during scroll. GSAP users can also set ScrollTrigger.config({ ignoreMobileResize: true }) to skip refreshes when only the toolbar changes.

Fast sites on phonesGSAP answers

How do I make an image sequence animation on scroll?

Export the animation as numbered frames, preload them as images, and draw the right frame onto a canvas based on scroll progress. With GSAP, tween a frame counter from 0 to the last index with scrub on a pinned ScrollTrigger, and in onUpdate call drawImage for the rounded frame. Use WebP or AVIF frames, size the canvas for devicePixelRatio, and draw only when the frame index changes.

Scroll animation templates3D product animation templates

How many frames should a scroll image sequence use?

Most scroll image sequences use somewhere around 60 to 200 frames, balancing smoothness against download size. More frames look smoother on slow scrolls but every frame is a separate image to download and decode. Serve smaller frames and fewer of them on phones, compress them as WebP or AVIF, and load the first frame immediately so the hero appears fast, then fetch the rest in the background.

Fast sites on phonesScroll film templates

Should I use a video or an image sequence for scroll scrubbing?

Use an image sequence on a canvas when you need frame-exact, smooth scrubbing in both directions on every browser. Use video when the clip is long and download size matters, but encode it so every frame is a keyframe, or seeking stutters. Video seeking backward is less reliable across browsers. Many AnimatedWebs scroll templates avoid the problem by using image sequences on a canvas or drawing footage live with three.js.

Scroll-scrubbed video hero guideScroll animation templates

How do I encode a video for scroll scrubbing?

Encode the video so every frame is a keyframe, which lets the browser seek to any frame instantly. With ffmpeg and H.264, a keyframe interval of 1, set with -g 1, does this. Strip audio, keep the resolution modest, and add -movflags +faststart so playback can begin before the file finishes downloading. The file gets larger than a normal encode, so keep the clip short and offer a smaller version for phones.

Scroll-scrubbed video hero guideVideo background answers

What is a scroll-scrubbed video hero?

A scroll-scrubbed video hero is a top section where a short video plays forward as you scroll down and backward as you scroll up, frame by frame, usually pinned while headline copy appears over it. It turns a product shot or brand film into an interactive opening. AnimatedWebs calls pages built this way scroll film websites and groups them in their own collection, many with a live demo.

Scroll film templatesScroll-scrubbed video hero guide

How do I make a reading progress bar with CSS only?

Fix a thin bar to the top of the page, set transform-origin to the left, and animate transform from scaleX(0) to scaleX(1) with animation-timeline: scroll(root block). Write the animation shorthand first and animation-timeline after it, because the shorthand resets the timeline. Hide the bar by default and show it inside @supports (animation-timeline: scroll()), so browsers without support never show a stuck bar.

Scroll animation guideHTML and CSS templates

Can I reveal elements on scroll with CSS only?

Yes, in browsers that support scroll-driven animations. Define keyframes that go from opacity 0 and a small translateY to the final state, apply them with animation-timeline: view(), and set animation-range: entry 0% entry 60% so the reveal completes as the element enters. Use animation-fill-mode both. Wrap it in @supports so unsupported browsers show the elements normally, or add an IntersectionObserver fallback.

Scroll animation guideMotion components

How do I respect reduced motion in scroll animations?

Check prefers-reduced-motion and give those visitors a calm version. In CSS, put scroll-driven rules inside @media (prefers-reduced-motion: no-preference). In GSAP, create scroll scenes inside gsap.matchMedia() with the same condition so they are skipped and cleaned up. Replace pinned, scrubbed or parallax sequences with simple fades or the final state, and turn off smooth scrolling. Content must stay complete in the reduced version.

Reduced motion guidePerformance answers

Do scroll animations affect SEO?

Scroll animations do not hurt SEO when the text is in the HTML from the start and the page stays fast. Google renders pages with a tall viewport rather than scrolling like a person, so content hidden until a scroll event may be missed if it is only inserted later by script. Elements merely faded in are still in the markup. Watch Largest Contentful Paint: a hero headline hidden at opacity 0 until a script runs can delay it.

Fast sites on phonesAnimated website answers

How do I animate a number counter when it scrolls into view?

Put the final number in the HTML so it is correct without JavaScript and for screen readers, then animate a counter from 0 to that value when IntersectionObserver reports the element is visible, using requestAnimationFrame or a GSAP tween on a plain object with snap set to 1. Use font-variant-numeric: tabular-nums so the digits do not shift width. Skip the count-up under prefers-reduced-motion.

Motion componentsUI Library

What is CSS scroll snapping?

CSS scroll snapping makes a scroll container settle on defined positions when scrolling stops. Set scroll-snap-type on the container, such as y mandatory or x proximity, and scroll-snap-align: start or center on its children. mandatory always snaps, proximity snaps only when close. It is native and works with touch, which makes it ideal for carousels and full-screen sections without a JavaScript library.

Scroll animation guideFast sites on phones

Should I combine scroll snap with scroll-linked animations?

Usually not on the same scroller. Mandatory scroll snap jumps between positions, which fights scrubbed timelines that expect smooth progress, and it can conflict with pinning and smooth scroll libraries. If you want snapping in a scroll story, use the snap option in GSAP ScrollTrigger so it lands on timeline labels or progress values, or keep native scroll snap for separate components such as a horizontal carousel.

GSAP answersScroll animation templates

How do I make a 3D scroll animation with three.js?

Render a three.js scene in a fixed or pinned canvas and map scroll progress to scene values such as camera position, model rotation or a material uniform. A GSAP ScrollTrigger with scrub can tween those values directly, since GSAP animates any numeric property. Smooth the input, cap the pixel ratio on phones, and stop rendering when the canvas is off screen. AnimatedWebs has a scroll 3D category of templates built this way.

Scroll 3D templatesAdd three.js to a website

How do I debug where a scroll animation starts and ends?

In GSAP ScrollTrigger, add markers: true to the trigger. It draws labeled start and end lines for the trigger element and the scroller, so you can see exactly where the animation begins and finishes. Remove markers before shipping. For CSS scroll-driven animations, temporarily give the keyframes an obvious change such as a background color and outline the subject, so you can see exactly where each view() range begins and ends.

GSAP answersScroll animation guide

Why does my scroll animation start at the wrong position?

Most often because the layout changed after scroll positions were measured. Images without width and height, web fonts swapping, content loaded later or a pin added above can all shift the page. Give media explicit dimensions, create pinned ScrollTriggers in page order, and call ScrollTrigger.refresh() after late content loads. ScrollTrigger refreshes on window load and resize on its own, but not after content you inject later.

GSAP answersScroll animation guide

How do I run scroll animations inside a scrolling container instead of the page?

Point the animation at the container. In CSS, scroll() with the nearest or self scroller, or a named scroll-timeline-name on the container, tracks that element's scroll. In GSAP ScrollTrigger, set the scroller option to the container element. With IntersectionObserver, pass the container as the root option. The container needs a fixed height and overflow set to auto or scroll.

Scroll animation guideGSAP answers

How do I add scroll animations in React?

Use a library that cleans up properly on unmount. With GSAP, create ScrollTriggers inside the useGSAP hook from @gsap/react, scoped to a container ref, and it reverts them automatically. With Motion, use whileInView for reveals, or useScroll with useTransform to link values to scroll progress. CSS scroll-driven animations also work in React with no hook at all. Avoid storing scroll position in React state on every frame.

GSAP answersNext.js templates

Where can I find scroll animation website templates?

AnimatedWebs has a scroll animation collection with pinned chapters, scroll-scrubbed image sequences and video, horizontal tracks and 3D product reveals, plus separate collections for scroll film websites and 3D product animation. Many have a live demo you can scroll before using them; across the catalog, 629 templates open as a live demo. Each template ships as a build prompt and design system for your AI coding tool.

Scroll animation templatesScroll film templates

What is a scroll film website?

A scroll film website is a page whose hero is a short cinematic film that plays forward and backward with the scroll, frame by frame, while chapters of copy pin and change over it. On AnimatedWebs the film is part of the template, made with AI tools and reviewed, so it never looks like a stock clip. The scroll film collection lists these templates, many with live demos.

Scroll film templatesAI disclosure

Are there free scroll animation templates?

Yes. AnimatedWebs has 365 free templates in total, including scroll effects, and a free account copies their full build prompts for personal and commercial sites. Filter the catalog to free items or open the free animated template collection to find scroll-based ones. Pro scroll templates can also be played as live demos before you decide, though there is no free trial of Pro.

Free templatesFree animated templates

Do AnimatedWebs scroll templates work on phones?

Yes. AnimatedWebs states that each scroll template prompt specifies shorter scroll ranges, lighter effects and a calmer version for visitors who prefer less motion. How well the result runs still depends on the code your AI tool writes and the media you use, so test on a real phone. The AnimatedWebs performance page publishes real-visitor Core Web Vitals for demos, split by phone and desktop.

Scroll animation templatesPerformance page

How do I add a scroll animation template to my AI builder?

Open the template on AnimatedWebs, copy its build prompt, and paste it into your AI tool, such as Claude Code, Cursor, Lovable, v0 or Bolt, then replace the copy and media with your own. Coding agents can fetch the prompt directly through the AnimatedWebs MCP server instead. The prompt describes every scroll range, pin and fallback, so the tool writes the code in your project.

Build with AIMCP serverUse with Cursor

What is scroll hijacking and why do people dislike it?

Scroll hijacking is when a page takes over the scroll so one wheel turn jumps a whole section, scrolls sideways, or moves at a speed the user did not choose. People dislike it because it breaks expectations, makes skimming hard, traps keyboard and trackpad users and can cause motion discomfort. Pinned scenes are not hijacking if the scroll still moves at the user's pace. Keep control with the visitor.

Scroll animation guideAccessibility

How long should a pinned scroll section be?

Keep a pinned section to roughly one to three screen heights of scroll for most beats, and only go longer when a sequence really has that many steps. Long pins feel like being stuck, especially on phones where each screen takes a swipe. Set the ScrollTrigger end relative to the content, such as "+=150%", give each change in the sequence comparable distance, and shorten the range on small screens.

Scroll animation templatesFast sites on phones

How do I draw an SVG path as the user scrolls?

Get the path length with getTotalLength(), set stroke-dasharray and stroke-dashoffset to that length so the line is hidden, then animate the offset to zero as the page scrolls. In CSS, apply the keyframes with animation-timeline: view() or scroll(). With GSAP, tween strokeDashoffset with a scrubbed ScrollTrigger, or use the DrawSVG plugin, which handles the math and is free like the rest of GSAP.

GSAP answersScroll animation guide

How do I stagger elements as they scroll into view?

With GSAP, use ScrollTrigger.batch() so elements that enter together animate as a group with a stagger, or give a single tween a stagger value for a list inside one trigger. With CSS, set a custom property such as --i on each item and use it in transition-delay when the reveal class is added. Keep the stagger small, around 50 to 100 milliseconds per item, so long lists still finish quickly.

GSAP answersMotion components

What are named scroll timelines and view timelines in CSS?

Named timelines let one element's scroll drive an animation on a different element. Give a scroller scroll-timeline-name: --page, or a subject view-timeline-name: --card, then set animation-timeline: --page or --card on the element to animate. Names are dashed identifiers. By default only descendants can use a named timeline, so use timeline-scope on a shared ancestor to make it available to siblings or other branches.

Scroll animation guideHTML and CSS templates

How do I test scroll animations on real devices?

Test on at least one mid-range Android phone and one iPhone, not only desktop emulation, since address bar resizing, momentum scrolling and GPU limits only show on real hardware. Use Chrome remote debugging or Safari Web Inspector to profile on the device. Scroll fast and slow, rotate the screen, turn on reduced motion and check every pinned section starts and ends where intended. AnimatedWebs live demos can be tested the same way.

Fast sites on phonesTemplates with live demos