Comparisons

GSAP vs CSS animation: performance, timelines, scroll and when to use each

GSAP vs CSS animation compared on performance, sequencing, scroll effects, bundle size and licensing, with the same animation written in both and a clear rule.

· 8 min read

GSAP and plain CSS are the two most common ways to animate a website. Both can make the same card slide in or the same menu unfold. The differences show up when you add a second and third step, tie motion to scroll, or ship to slower phones.

This post compares them on the things that decide the choice in a real project: performance, sequencing, scroll effects, bundle size, licensing and day-to-day developer experience. Then it writes the same animation in both and ends with a simple rule for picking one.

What each one is

CSS animation is built into the browser. Transitions animate a property when a state changes, such as :hover or a class being added. Keyframe animations run a sequence defined with @keyframes. You set a duration, a delay and an easing function, and the browser does the rest.

GSAP (GreenSock Animation Platform) is a JavaScript library. You create tweens with gsap.to(), gsap.from() and gsap.fromTo(), group them in timelines, and control them from code: play, pause, reverse, seek, speed up. It can animate CSS properties, SVG attributes, canvas objects and plain JavaScript values. Plugins add scroll control (ScrollTrigger), text splitting, SVG morphing and more.

Side by side

CSS animationGSAP
Extra downloadNoneThe core library, plus any plugins you use
Where it runsBrowser engine; transform and opacity can run on the compositorMain thread, updating inline styles each frame
SequencingDelays you calculate by handTimelines with relative positions
Runtime controlLimited: pause with animation-play-state, swap classesFull: play, pause, reverse, seek, timeScale, callbacks
Scroll effectsScroll-driven animations in supporting browsersScrollTrigger: scrub, pin, snap, callbacks
State changesBuilt in: hover, focus, checked, classesEvent listeners you wire up
What it can animateCSS properties of elementsCSS, SVG attributes, canvas, any object's numbers
Inspecting in DevToolsAnimations panel shows itAnimations panel shows nothing

Performance

The browser can hand CSS animations of transform and opacity to the compositor thread. Once they start, they keep running smoothly even if JavaScript is busy parsing a large bundle or handling a slow event. That is the strongest technical argument for CSS.

GSAP works differently. On every animation frame, it calculates the new values in JavaScript and writes them to the element's inline style. The browser then composites the result, so a GSAP transform still benefits from GPU compositing when painting. But the timing itself depends on the main thread. If a long task blocks it for 200ms, the GSAP animation stalls for 200ms too.

In practice, GSAP is very well optimised and this rarely matters for a handful of tweens on a normal page. It matters more on slow devices, during page load when the main thread is crowded, and when many elements animate at once. Whichever you use, the same rule applies: animate transform and opacity where you can, and avoid layout properties like width, height and top.

Timelines and sequencing

This is where GSAP is clearly ahead. A CSS sequence is a set of independent animations with hand-calculated delays. If the first step gets 100ms longer, you update every delay after it.

A GSAP timeline places each tween relative to the previous one. The position parameter lets you overlap steps ("-=0.2"), start at the same time as the last step ("<"), or jump to a label. Change one duration and everything after it moves with it. You can also reverse the whole sequence, which is how many menus close, or scrub through it with a slider while you tune it.

CSS has no timeline object. The Web Animations API gives you play, pause, reverse and seek for individual animations from JavaScript, but grouping and relative positioning are still up to you.

The same animation in both

Here is a small panel entrance: the heading rises in, three list items follow with a stagger, then a button pops in with a slight overshoot.

CSS version

.panel h2,
.panel li,
.panel .cta {
  opacity: 0;
  animation: rise 500ms cubic-bezier(.22, 1, .36, 1) forwards;
}

.panel li:nth-child(1) { animation-delay: 150ms; }
.panel li:nth-child(2) { animation-delay: 230ms; }
.panel li:nth-child(3) { animation-delay: 310ms; }

.panel .cta {
  animation: pop 400ms cubic-bezier(.34, 1.56, .64, 1) 610ms forwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@keyframes pop {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .panel h2,
  .panel li,
  .panel .cta { animation: none; opacity: 1; }
}

GSAP version

import { gsap } from 'gsap';

const mm = gsap.matchMedia();

mm.add('(prefers-reduced-motion: no-preference)', () => {
  gsap.timeline({ defaults: { duration: 0.5, ease: 'power4.out' } })
    .from('.panel h2', { y: 16, opacity: 0 })
    .from('.panel li', { y: 16, opacity: 0, stagger: 0.08 }, '-=0.35')
    .from('.panel .cta', {
      scale: 0.9,
      opacity: 0,
      duration: 0.4,
      ease: 'back.out(1.7)'
    }, '-=0.2');
});

Both produce the same timing. The heading runs from 0 to 500ms, the list items start at 150ms, 230ms and 310ms, and the button starts at 610ms. power4.out is close to cubic-bezier(.22, 1, .36, 1), and back.out(1.7) matches cubic-bezier(.34, 1.56, .64, 1).

The difference is in maintenance. In the CSS version, the 610ms delay on the button is a number you worked out by hand. In the GSAP version, it follows from the previous steps. Add a fourth list item and GSAP moves the button for you; in CSS you add a rule and recalculate.

The CSS version has one advantage worth noting: it works before any JavaScript loads. With gsap.from(), the elements are visible until the script runs, then jump to their start state. Hide them in CSS first or load the script early to avoid that flash.

Scroll: ScrollTrigger vs scroll-driven animations

For years, scroll-linked motion meant JavaScript, and ScrollTrigger became the standard. It can scrub any timeline with the scroll position, pin a section while its content animates, snap to points and fire callbacks when a section enters or leaves.

CSS now has scroll-driven animations. A keyframe animation can use the scroll position as its timeline instead of time:

.reveal {
  animation: rise linear both;
  animation-timeline: view();
  animation-range: entry 0% cover 30%;
}

The GSAP equivalent:

import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';

gsap.registerPlugin(ScrollTrigger);

gsap.utils.toArray('.reveal').forEach(el => {
  gsap.from(el, {
    y: 16,
    opacity: 0,
    ease: 'none',
    scrollTrigger: { trigger: el, start: 'top bottom', end: 'top 70%', scrub: true }
  });
});

The CSS version is shorter, needs no library and can run off the main thread. Support is the catch: it works in Chromium browsers and recent Safari, but not everywhere yet, so check caniuse and treat it as an enhancement. ScrollTrigger works in every modern browser and does far more, especially pinning and multi-step scrubbed stories.

Bundle size

CSS animation costs nothing beyond the rules you write. GSAP's core is tens of kilobytes compressed, and each plugin adds more. That is small next to a typical framework bundle, and GSAP is tree-shakeable for plugins you do not import. But if all you need is a few hover states and an entrance, it is weight the page does not need.

Licensing

GSAP used to keep several plugins behind a paid Club membership. Since Webflow acquired it, the whole library, including those plugins, is free for commercial use under its standard licence. It is not an open-source licence like MIT, so read the terms on the GSAP site if your project has rules about third-party code. CSS has no licence question at all.

Developer experience

CSS keeps motion next to the component's styles and uses the same design tokens. State changes are declarative: add a class and the transition runs. Debugging is easy because the Chrome DevTools Animations panel shows every CSS animation, with a timeline you can slow down and scrub. See how to inspect CSS animations in Chrome DevTools.

GSAP keeps motion in JavaScript. That suits complex choreography, values computed at runtime, and animations that react to drag, cursor position or app state. Its API is consistent and its easing library is excellent. The cost is that DevTools cannot show what it is doing, and you must clean up tweens when components unmount in frameworks like React. The @gsap/react package's useGSAP() hook handles that cleanup.

Studying a motion is harder with GSAP for the same reason. If you want to learn the timing of a GSAP animation on someone else's site, how to copy a GSAP animation covers the console approach. Capture Motion records GSAP animations as they play and can export the result as GSAP, CSS or React code, which is handy when you want to move an animation from one approach to the other.

When to use which

Use CSS when:

Use GSAP when:

A short decision rule: if the animation can be described as "when X happens, move to Y", use CSS. If it reads like a script with many steps and someone controlling playback, use GSAP. Many sites use both: CSS for every interactive component and GSAP for the hero and the scroll story.

Whichever you choose, the motion values carry over. Durations, delays and easing curves translate directly between the two, so the decision is about tooling, not about the feel of the animation. For more on matching curves, read CSS easing functions explained.

Questions

Is GSAP faster than CSS animation?

Not in general. CSS animations of transform and opacity can run on the compositor thread, so they stay smooth when JavaScript is busy. GSAP computes values on the main thread each frame, which is fast enough for most work but is affected by a blocked main thread.

Is GSAP free for commercial use?

Yes. Since the Webflow acquisition, GSAP and its plugins, including the ones that used to need a paid Club membership, are free for commercial use under its standard licence. Read the licence text on the GSAP site before you ship, as it has terms of its own.

Can CSS replace ScrollTrigger?

For many effects, yes. CSS scroll-driven animations with animation-timeline: scroll() or view() handle reveal-on-scroll, progress bars and parallax without JavaScript. Pinning, snapping, callbacks and complex scrubbed sequences are still easier with ScrollTrigger.

How do I convert a GSAP animation to CSS?

Write each tween as a keyframe animation, turn the timeline positions into animation-delay values, and match the eases with cubic-bezier() or linear(). Capture Motion can record a playing GSAP animation and export it as CSS, React or GSAP code, which gives you the timings to start from.