All answers · Motion and code · 55 questions
Performance and reduced motion, answered.
This page answers the questions people ask when an animated website has to stay fast and comfortable for everyone. It is for designers, developers and AI builders who want motion that passes Core Web Vitals and respects visitors who prefer less movement.
What are Core Web Vitals?
Core Web Vitals are three metrics Google uses to describe real-world page experience: Largest Contentful Paint for loading, Interaction to Next Paint for responsiveness and Cumulative Layout Shift for visual stability. Good values are LCP at or under 2.5 seconds, INP at or under 200 milliseconds and CLS at or under 0.1, judged at the 75th percentile of real page loads, separately for mobile and desktop.
What is a good Largest Contentful Paint score?
A good Largest Contentful Paint is 2.5 seconds or less at the 75th percentile of page loads. Between 2.5 and 4 seconds needs improvement, and over 4 seconds is poor. LCP measures when the largest image, video poster or text block in the viewport finishes rendering. On animated sites the LCP element is usually the hero headline or the hero poster image.
What is a good Interaction to Next Paint score?
A good Interaction to Next Paint is 200 milliseconds or less at the 75th percentile. Between 200 and 500 milliseconds needs improvement, and over 500 milliseconds is poor. INP measures the delay from a click, tap or key press until the next frame is painted, across the whole visit, and reports one of the slowest interactions. Heavy JavaScript on the main thread is the usual cause of poor INP.
What is a good Cumulative Layout Shift score?
A good Cumulative Layout Shift is 0.1 or less at the 75th percentile. Between 0.1 and 0.25 needs improvement, and over 0.25 is poor. CLS adds up unexpected movements of visible content, grouped into short windows, and reports the worst window. Images without dimensions, late-loading fonts, injected banners and animations that change layout properties are the common causes.
What does the 75th percentile mean for Core Web Vitals?
The 75th percentile is the value that three out of four page loads match or beat. Google assesses Core Web Vitals at this point so a page passes only when most visitors, including many on slower phones and networks, get a good experience. A page with a fast median but a slow quarter of visits can still fail. Mobile and desktop are assessed separately.
What is the difference between lab data and field data?
Lab data comes from a test run in a controlled setting, such as Lighthouse on your computer, while field data comes from real visitors' browsers on their own devices and networks. Lab tests are repeatable and good for debugging, but they show one device once. Field data shows the real spread, and Core Web Vitals are judged on field data at the 75th percentile.
How do I measure Core Web Vitals on my own site?
Use the open source web-vitals JavaScript library to collect LCP, INP and CLS from real visitors and send them to your analytics. PageSpeed Insights shows Chrome UX Report field data for pages with enough traffic plus a Lighthouse lab run. Search Console groups URLs by status, and the Chrome DevTools Performance panel shows live metrics while you test. Check phone and desktop separately.
Did INP replace First Input Delay?
Yes. Interaction to Next Paint replaced First Input Delay as a Core Web Vital in March 2024. FID measured only the input delay of the first interaction. INP measures the full time from input to the next paint for all clicks, taps and key presses during a visit, so it catches slow handlers and slow rendering that FID missed. Scrolling and hovering are not counted as interactions.
Do animations hurt Core Web Vitals?
They can, but they do not have to. Hero entrances that keep the headline invisible can delay LCP, animations that change layout properties can add CLS, and heavy animation scripts can block the main thread and hurt INP. Animate transform and opacity, render the hero content visibly as HTML, load animation libraries after first paint, and keep work out of input handlers.
Which CSS properties are cheapest to animate?
Transform and opacity are the cheapest properties to animate. Browsers can usually animate them on the compositor without recalculating layout or repainting, so they stay smooth even when the main thread is busy. Properties such as width, height, top, left, margin and padding trigger layout, and color or box-shadow changes trigger paint, which costs more on every frame.
Why should I animate transform instead of top and left?
Changing top or left moves the element in the layout, so the browser recalculates layout and repaints on every frame. Animating transform: translate() moves the painted layer without touching layout, which the browser can often run on the compositor thread. The visual result is the same, but transform stays smooth on phones and does not cause layout shift for surrounding content.
What does will-change do in CSS?
The will-change property tells the browser that an element is about to change a property, such as transform or opacity, so it can prepare in advance, often by promoting the element to its own compositor layer. That can remove a stutter at the start of an animation. Each extra layer uses GPU memory, so apply will-change only to elements that are about to animate.
Should I add will-change to every animated element?
No. Overusing will-change creates many compositor layers, which use memory and can make the page slower, especially on phones. Add it to a few elements that animate often or that stutter when an animation starts, and remove it with JavaScript when the animation ends if it only runs once. MDN describes will-change as a last resort for existing performance problems.
What is layout thrashing?
Layout thrashing happens when JavaScript alternates between reading layout values and writing styles in a loop, forcing the browser to recalculate layout many times in one frame. Reads such as offsetHeight, getBoundingClientRect and scrollTop force a fresh layout when styles changed since the last one. The result is long frames and janky animation, often inside scroll handlers.
How do I avoid layout thrashing in animations?
Batch all layout reads first, then all style writes, instead of interleaving them. Cache measurements such as element sizes and update them only on resize, not on every scroll. Use IntersectionObserver and ResizeObserver instead of measuring in scroll events, and apply changes inside requestAnimationFrame. Animating transform instead of layout properties also removes most forced layouts.
Why use requestAnimationFrame instead of setInterval for animation?
requestAnimationFrame runs your callback right before the browser paints the next frame, matched to the display's refresh rate, and passes a timestamp you can use to keep speed constant on 60 Hz and 120 Hz screens. It is generally paused in background tabs and hidden iframes, which saves battery. setInterval runs on its own timer, drifts out of step with painting and keeps running in the background.
What is the main thread and why does it matter for animation?
The main thread is where the browser runs your JavaScript, handles input, calculates styles and layout, and paints. It can do only one thing at a time, so a long script blocks taps, scrolling handlers and animation frames. Keep main-thread work short, move heavy calculations to a Web Worker, and prefer CSS transform and opacity animations, which browsers can often run on a separate compositor thread.
What is a long task in web performance?
A long task is any piece of main-thread work that runs for more than 50 milliseconds without a break. While it runs, the browser cannot respond to input or paint frames, so long tasks cause dropped animation frames and poor Interaction to Next Paint. Find them in the Chrome DevTools Performance panel, then split the work, defer it, or move it to a Web Worker.
Do CSS animations run off the main thread?
Partly. CSS animations and transitions of transform and opacity can usually run on the compositor thread, so they keep playing smoothly while JavaScript is busy. Animations of other properties, such as width, color or box-shadow, need the main thread for layout or paint on every frame. JavaScript-driven animations, including those from animation libraries, set values on the main thread, though the resulting transform changes still composite cheaply.
Are CSS scroll-driven animations faster than JavaScript scroll effects?
Often, yes. CSS scroll-driven animations use animation-timeline with scroll() or view() to tie keyframes to scroll position, with no scroll listener, and when they animate transform or opacity the browser can run them off the main thread. Chromium browsers and Safari 26 support them, while Firefox has not shipped them on by default, so keep a static or JavaScript fallback with @supports.
Should scroll event listeners be passive?
Yes. Pass { passive: true } to addEventListener for scroll, wheel and touch listeners that never call preventDefault. A passive listener tells the browser it can scroll right away without waiting for your code, which keeps scrolling smooth on phones. Chrome already treats document-level wheel and touch listeners as passive by default. Inside the handler, store the scroll value and do the work in requestAnimationFrame.
Does a fade-in hero animation delay LCP?
It can. Chrome does not count elements with opacity 0 as Largest Contentful Paint candidates, so a headline that starts invisible and fades in only counts once it becomes visible. A long entrance animation or one that waits for a script pushes LCP later. Start the hero text visible or nearly visible, keep entrances short, and run them with CSS so they do not wait for JavaScript to load.
Do transform animations cause Cumulative Layout Shift?
No. Changing transform does not move an element's layout position, so it is not counted as a layout shift. Animating top, left, margin, width or height does move layout boxes and can add CLS when surrounding content jumps. Layout shifts within 500 milliseconds of a user input are also excluded, so an accordion opening on click does not count against CLS.
How do I improve INP on an animated website?
Keep event handlers short and give the browser a chance to paint quickly after each tap or key press. Ship less JavaScript, split animation libraries and 3D code out of the main bundle, avoid starting heavy work inside click handlers, and break long tasks into smaller pieces, for example by yielding with setTimeout or scheduler.yield where supported. Test on a mid-range Android phone, where INP problems show most.
What does the prefers-reduced-motion media query do?
prefers-reduced-motion is a CSS media feature that reports whether the visitor turned on a reduced-motion setting in their operating system or browser. It has two values: no-preference and reduce. When it matches reduce, the site should remove, reduce or replace non-essential motion, such as parallax, large scaling, spinning and auto-playing loops. It is supported in all current major browsers.
How do I use prefers-reduced-motion in CSS?
Add motion inside @media (prefers-reduced-motion: no-preference) so only visitors without the setting get it, or override motion inside @media (prefers-reduced-motion: reduce). The first pattern is safer because a browser that ignores the query gets the calm version. Replace travel, scaling and parallax with a short fade or an instant change rather than removing feedback completely.
How do I detect prefers-reduced-motion in JavaScript?
Use const mq = window.matchMedia('(prefers-reduced-motion: reduce)') and read mq.matches before you start any animation loop, scroll effect or autoplaying video. Then listen with mq.addEventListener('change', handler), because visitors can switch the setting while the page is open. When it matches, stop loops but draw one still frame, so a canvas does not go blank.
How do I support reduced motion in GSAP?
Use gsap.matchMedia() with a condition such as reduceMotion: '(prefers-reduced-motion: reduce)'. Inside the callback, build the full animations when the condition is false and a simpler version, such as quick fades or the final state, when it is true. GSAP reverts animations and ScrollTriggers created in a matchMedia callback when the query stops matching, so the page follows the setting live.
How do I support reduced motion in Motion for React?
Motion offers a useReducedMotion hook that returns true when the visitor prefers reduced motion, so you can swap movement for opacity changes. You can also wrap the app in MotionConfig with reducedMotion="user", which disables transform and layout animations for those visitors while keeping opacity and color transitions. Test both states, because a layout animation that is switched off should still land in the right final state.
Should reduced motion remove all animation?
No. Reduced motion means remove, reduce or replace non-essential motion, not remove all feedback. Keep short fades, color changes and state changes that tell the visitor something happened. Remove movement across the screen, large zooms, parallax, spinning, scroll-jacking and anything that loops. The page should still look finished and work fully, just calmer.
Is setting every animation duration to zero a good reduced-motion fix?
Not on its own. A blanket rule that sets every animation and transition duration to near zero is a common shortcut, but it can break code that waits for an animationend or transitionend event, it does nothing for JavaScript, canvas or WebGL loops, and it removes harmless feedback such as fades. Be specific: replace each motion with a calm alternative and stop scripted loops with matchMedia.
How do visitors turn on reduced motion on their devices?
On macOS it is under System Settings, Accessibility, Display, Reduce motion, and on iPhone and iPad under Settings, Accessibility, Motion, Reduce Motion. On Windows 11, turning off Animation effects under Accessibility, Visual effects sets it. On Android, the option is usually called Remove animations in the accessibility settings. Browsers pass these settings to websites through prefers-reduced-motion.
How do I test prefers-reduced-motion in Chrome DevTools?
Open DevTools, open the Rendering panel from the More tools menu or the Command Menu, and set Emulate CSS media feature prefers-reduced-motion to reduce. The page then behaves as if the visitor turned on the setting, without changing your operating system. Reload and scroll the whole page, and check that canvases show a still frame and videos show their poster instead of going blank.
What does WCAG 2.2.2 Pause, Stop, Hide require?
WCAG Success Criterion 2.2.2 Pause, Stop, Hide, at Level A, requires a way to pause, stop or hide moving, blinking or scrolling content that starts automatically, lasts more than five seconds and is shown alongside other content. Background videos, looping canvas animations, marquees and auto-advancing sliders usually qualify. It applies even when the visitor has not turned on reduced motion.
What does WCAG 2.3.3 Animation from Interactions require?
WCAG Success Criterion 2.3.3 Animation from Interactions, at Level AAA, says motion animation triggered by an interaction must be possible to turn off, unless the animation is essential to the function or the information. Scroll-triggered parallax and elements that fly in as you scroll are typical examples. Honoring prefers-reduced-motion is the common way to meet it.
What does WCAG say about flashing animations?
WCAG Success Criterion 2.3.1 Three Flashes or Below Threshold, at Level A, says content must not flash more than three times in any one-second period, unless the flashes are below the general flash and red flash thresholds. Flashing can trigger seizures in people with photosensitive epilepsy. Avoid strobe effects, rapid light changes in hero videos and fast flicker in shader backgrounds.
What are vestibular disorders and why do they matter for web animation?
Vestibular disorders affect the inner ear and brain systems that control balance and spatial orientation. For people with them, large on-screen motion such as parallax, zooming, spinning and scroll-linked movement can cause dizziness, nausea, headaches or migraines that last well after they leave the page. That is why operating systems offer a reduce motion setting and why sites should honor prefers-reduced-motion.
Which web animations are most likely to cause motion sickness?
Large-scale motion is the main trigger: parallax layers moving at different speeds, full-screen zooms, spinning or rotating scenes, scroll-jacking that moves the page differently from the input, and camera flights through 3D scenes. Small, short fades and color changes rarely cause trouble. Under prefers-reduced-motion, replace the large movements with stills or fades.
How do I make parallax scrolling safe for motion-sensitive visitors?
Turn parallax off when prefers-reduced-motion is set to reduce, and keep it subtle for everyone else. Parallax can be a problem for people with vestibular disorders, because layers moving at different speeds create a sense of motion that can cause dizziness or nausea. Content must stay readable and usable with the parallax switched off.
Do website animations drain phone battery?
Yes. Continuous animation keeps the CPU and GPU busy, and canvas, WebGL and video loops cost the most. Pause loops when the tab is hidden or the element is off-screen, cap the device pixel ratio for canvases, render on demand when nothing moves, and avoid running several heavy effects at once. A phone that gets warm is a sign the page is doing too much work.
Can a website detect low power mode or battery saver?
Not reliably. No standard cross-browser API reports iOS Low Power Mode or Android battery saver, and the Battery Status API exists only in Chromium browsers. Instead, measure frame times with requestAnimationFrame and step quality down when frames stay slow, honor prefers-reduced-motion and data saving hints, and pause work that is off-screen. Some browsers also throttle animation frames in power-saving modes.
How do I make animations adapt to slow or low-end devices?
Measure instead of guessing. Track the time between requestAnimationFrame callbacks, and when the average stays high, lower the pixel ratio first, then turn off the costliest extras such as bloom, shadows and extra particles. Only step quality down, never back up, so the page does not oscillate. Hints such as navigator.hardwareConcurrency and the Chromium-only navigator.deviceMemory can set a starting level.
How heavy should an animated website be?
There is no official limit, but a useful budget for a marketing page with a hero effect is a hero poster under about 150 KB, under about 200 KB of compressed JavaScript before the first interaction, a hero video under about 3 MB on phones and a 3D model under about 2 MB. These are suggested starting points, not a standard. AnimatedWebs template cards show each live demo's page weight.
How do web fonts affect performance and layout shift?
Web fonts add downloads that can delay text and cause layout shift when the fallback font is swapped for the web font. Use WOFF2, subset fonts to the characters you need, limit the number of weights, and use font-display: swap or optional. Match the fallback font's metrics with size-adjust, ascent-override and descent-override in @font-face, so the swap does not move text.
Should I preload web fonts?
Preload only the one or two fonts used above the fold, such as the hero headline font, with link rel="preload" as="font" type="font/woff2" and the crossorigin attribute, which font preloads need even for same-origin files. Preloading too many files competes with the hero image and scripts and can slow LCP. Self-hosting fonts on your own domain avoids an extra connection.
How do I make the hero image load fast for LCP?
Serve the hero image in WebP or AVIF at the size it displays, with srcset for different screens, and set width and height so space is reserved. Add fetchpriority="high" to the LCP image and never lazy-load it. Keep it in the HTML rather than injecting it with JavaScript, so the browser finds it early. For a video hero, the poster image follows the same rules.
How do I load animation libraries without slowing the first paint?
Render the headline, copy and a poster as plain HTML first, then load heavy libraries such as three.js or large animation bundles with a dynamic import() after the first paint or when the section nears the viewport. Use requestIdleCallback with a timeout where supported, or a short timer, so effects still start on busy devices. Keep the poster visible until the effect is ready to fade in.
How does AnimatedWebs measure template performance?
AnimatedWebs publishes real-visitor Core Web Vitals for its templates on the /performance page: the 75th percentile of LCP, INP and CLS, split into phone and desktop, over the last 28 days, with the number of reports behind each figure. Each visitor's browser reports its own metrics, collected with cookieless analytics and no personal data. The page also shows which demos have reduced-motion handling and pause controls in their code.
Why do some AnimatedWebs templates show not enough data for performance?
AnimatedWebs prints not enough data, with the report count, when a template has too few real-visitor reports for a metric, rather than a number one slow connection could swing. The figures come from real visits over the last 28 days, so newer or less visited templates fill in over time. When a full-screen demo has enough reports, its numbers are shown and labeled as demo figures.
Does AnimatedWebs check its templates for reduced-motion support?
Yes. The AnimatedWebs performance page reads each demo's own source code and reports whether it found prefers-reduced-motion handling and whether it found a control labeled Pause. Detected means the scan found the code, and not detected means the scan found nothing. A text scan cannot prove how well the feature works, so test a demo yourself with reduced motion emulated.
Does reduced motion detected mean an AnimatedWebs template is fully accessible?
No. On the AnimatedWebs performance page, reduced motion detected means a scan found prefers-reduced-motion handling in the demo's code, not that every section handles it well. Found in code does not prove it works well, and not detected does not prove it is missing. Turn on reduced motion in your browser, scroll the whole demo, and check for a reachable pause control before you ship.
Are AnimatedWebs templates fast on phones?
It varies by template, which is why AnimatedWebs publishes real-visitor phone and desktop Core Web Vitals on its /performance page, including figures that are not flattering. Heavy WebGL scenes and scroll films cost more than CSS-only pages. Each template card shows the live demo's page weight, and build prompts ask for posters, pixel ratio caps and calm reduced-motion states. Check the current numbers before choosing.
How can I check an AnimatedWebs template's speed before I use it?
Open the template's live demo on a phone and on desktop, then look up its row on the AnimatedWebs /performance page for real-visitor LCP, INP and CLS at the 75th percentile with sample sizes. The template card shows the demo's page weight. You can also run Lighthouse on the full-screen demo and emulate reduced motion in DevTools.