Start a projectBook a free call

+91 81598 63879WhatsApp

UI/UX and frontend

GSAP and Scroll Animation: How to Protect Core Web Vitals

GSAP scroll animation can make a website feel premium, but careless use can damage Core Web Vitals. Here is how to get the effect without the penalty.

AppsBrain Editorial6 minute read
Key takeaways
  • Animation and performance are not enemies. Problems come from heavy scripts, layout-changing effects and content hidden until JavaScript runs.
  • Animate transform and opacity, avoid animating layout properties and keep animation off the critical path.
  • Never hide important content behind an animation that may not run.
  • Respect the reduced-motion preference and test on mid-range phones, not only on your laptop.

Why this question comes up

Scroll-driven animation has become a mark of premium web design. Libraries such as GSAP and its ScrollTrigger plugin make complex, smooth effects possible. But motion has a cost: extra JavaScript, more work for the browser and more ways for things to go wrong.

Google measures real-world page experience through Core Web Vitals: Largest Contentful Paint (LCP), Interaction to Next Paint (INP) and Cumulative Layout Shift (CLS). Good thresholds are LCP within 2.5 seconds, INP at or under 200 milliseconds and CLS at or under 0.1, measured at the 75th percentile of visits. A badly built animated page can fail all three. A well-built one can pass comfortably. The difference is in the details, which is what this guide covers.

Where animation hurts each metric

Understanding the link between motion and metrics tells you what to watch.

MetricHow animation can hurt itHow to prevent it
LCPHero content hidden or delayed until a large script loads and startsRender the main content in HTML and CSS, and let animation enhance it
INPLong-running scripts or scroll handlers that block the main threadUse efficient, batched animations and avoid heavy work on scroll
CLSElements that jump, resize or insert as animations runReserve space, and animate transform and opacity only

Keep the first view fast

Your most important content should not depend on animation. A common mistake is to set the hero heading to invisible in CSS, then reveal it with a script. If the script is slow, blocked or fails, visitors stare at a blank space, and LCP suffers.

Better practices:

  1. Make the main heading, text and image visible in the initial HTML and CSS.
  2. If you animate the entrance, keep it short and start it as early as possible.
  3. Load GSAP with defer, so it does not block rendering.
  4. Preload only what the first view genuinely needs, such as the main font or hero image.
  5. Avoid long preloader screens. A loader that covers the page delays the moment visitors see content, and it frustrates people returning to the site.

Animate the right properties

Browsers can animate some properties very cheaply and others very expensively. Transform (move, scale, rotate) and opacity are handled efficiently, often on the graphics processor. Animating width, height, top, left, margins or font size forces the browser to recalculate layout on every frame, which causes jank and can trigger layout shift.

Practical rules:

  • Prefer transform and opacity for movement and fades
  • Reserve final dimensions for elements before they animate in
  • Avoid animating many elements with complex filters or large shadows
  • Use will-change sparingly and only for elements that need it
  • Remove animations and listeners after they have done their job

Make scroll effects efficient

ScrollTrigger is designed to be efficient, but it can still be misused.

  • Use batch reveals for groups of similar items instead of one trigger each
  • Avoid scrubbed animations on dozens of elements at once
  • Keep pinned sections limited, and test them on small screens
  • Refresh triggers after fonts and images load, so positions are correct
  • Use passive listeners and avoid reading layout values in scroll handlers
  • Disable heavy effects on small or low-power devices where they add little

Remember that smooth scrolling libraries change how the page scrolls and can interfere with accessibility and expected behaviour. Use them with care and test with keyboards and assistive technology.

Respect people and devices

Motion can cause discomfort for some users, and many people set a reduced motion preference in their operating system. Honour it. In CSS use the prefers-reduced-motion media query, and in your script check the same preference before starting animations. Replace large movements with simple fades, or show content immediately.

Also provide a clear path if JavaScript fails. Content should remain readable without animation, which also helps search engines render your page.

Keep the JavaScript budget under control

GSAP itself is compact for what it does, but plugins and custom code add up. To keep the cost down:

  • Load only the plugins you use
  • Self-host files with long cache lifetimes, or use a reliable CDN
  • Split code so pages that need no animation do not load it
  • Audit third-party scripts alongside your own, since they often cause more trouble than animation does

Our guide to Core Web Vitals for business websites explains how to find the biggest causes of slowness first.

Test like a real visitor

A fast laptop on office Wi-Fi hides problems. Test with:

  1. A mid-range Android phone with throttled mobile connection
  2. Lighthouse and WebPageTest in lab conditions
  3. Real-user data in Search Console and the Chrome UX Report, which show what visitors actually experience
  4. The Performance panel in browser developer tools to spot long tasks during scroll
  5. Keyboard navigation and a screen reader to check nothing breaks

Make performance a requirement in your design and development brief. Acceptance criteria such as "LCP under 2.5 seconds on mobile for key pages" prevent motion from being added without checking its cost. This is especially useful when working from Figma designs handed to developers, where animation notes should specify timing and fallback.

Use animation with purpose

Good motion guides attention, shows relationships and gives feedback. It should not delay the visitor's goal. Ask of each effect: does it help someone understand or act? If not, remove it. Restraint also makes the remaining motion more effective.

If you want a website that feels premium and still performs, our website design team builds motion with performance budgets, and you can ask for a speed review of your current site.

Common questions

Does GSAP slow down a website?

Not by itself. Problems arise from loading unnecessary plugins, blocking rendering, hiding content until scripts run, or animating layout properties. Used carefully, GSAP can coexist with good Core Web Vitals scores.

Which CSS properties are best to animate?

Transform and opacity. Browsers can animate them efficiently without recalculating layout. Avoid animating width, height, margins and position values, which are more expensive and can cause layout shift.

How do I stop animations from hurting LCP?

Make your main content visible in the initial HTML and CSS, load animation scripts with defer, avoid long preloaders and make sure the largest element is not hidden until JavaScript runs.

How should I handle users who prefer reduced motion?

Check the prefers-reduced-motion setting in CSS and JavaScript. Replace large movements with simple fades or show content immediately, and make sure the page works fully without animation.

How can I measure the effect of animation on performance?

Use Lighthouse, WebPageTest and browser developer tools for lab data, and Search Console and the Chrome UX Report for real-user data. Test on mid-range phones with throttled connections.

Written by the AppsBrain editorial teamPractical guidance from the people who design, build and launch websites every week. Ask us a question
Let’s talk

Ready to put this into practice?

Skip the guesswork. Plan your project in two minutes, or talk it through with someone who builds websites every day.

  • Free, no-obligation scope
  • Working with clients in India, USA, UK, Canada and UAE
  • Mon–Sat, 10 AM to 7 PM IST
Plan your project

Positioning, mobile journey, search foundations and the next steps to take.

Before you go: want a free website review?

Share your address and we will reply with practical priorities.