VOOZH about

URL: https://blog.logrocket.com/whats-new-in-gsap-3/

⇱ What's new in GSAP 3 - LogRocket Blog


2019-11-29
1130
#js libraries#what's new
Anjolaoluwa Adebayo-Oyetoro
10472
👁 Image

See how LogRocket's Galileo AI surfaces the most severe issues for you

No signup required

Check it out

GreenSock has been around for more than a decade, making it one of the oldest JavaScript animation libraries. It works anywhere JavaScript runs and animates both DOM elements and JavaScript objects while maintaining its performance.

👁 What's New in GSAP 3

GreenSock is backward-compatible, framework-agnostic and easy for developers across all skill levels to pick up. As such, it is one of the most important tools for building intuitive and interactive websites.

The latest version, GSAP 3, comes with about 50 new features and lots of improvements on the previous versions, including:

  • A much easier-to-use API
  • Reduced file size
  • Timeline defaults
  • Brand new utility methods
  • A motion path plugin
  • Backward compatibility
  • Relative position prefixes
  • Advanced staggers
  • Random capabilities

Let’s take a more detailed look at some of the most important new features available in GSAP 3.

🚀 Sign up for The Replay newsletter

The Replay is a weekly newsletter for dev and engineering leaders.

Delivered once a week, it's your curated guide to the most important conversations around frontend dev, emerging AI tools, and the state of modern software.

Simplified API

The new version comes with a simplified, more user-friendly API. GreenSock consolidated the “Lite” and “Max” features, which formed the core modules in the previous versions, into a single object named gsap.

Take the following code, for example, which would have looked like this in previous versions of GSAP.

TweenMax.method('selector', {});

In GSAP 3, the above code would now look like this:

gsap.method('selector', {});

Similarly, the following line would have applied to previous versions.

TweenLite.method('selector',{});

In GSAP 3, it would translate to the following.

gsap.method('selector',{});

This change also affects the way timelines are created. The two blocks of code below would appear as follows in older versions of GSAP.

const tl = new TimelineMax();
tl.method('selector',{})

const tl = new TimelineLite();
tl.method('selector',{})

In the most recent release, it would be written like this:

var tl = gsap.timeline();
tl.method("selector", {});

The gsap object, when chained to a method like to() or from(), returns an instance of a tween.

Reduced file size

GSAP retained almost all of its old functionality and added a host of new features. In addition, GreenSock rebuilt the core from the ground up as modern ES modules.


Over 200k developers use LogRocket to create better digital experiences

👁 Image
Learn more →

Backward compatibility

The new GSAP update still recognizes the old syntax, since the Max and Lite features of the previous version are all aliased to keep legacy codebases from breaking. This saves developers the hassle of rewriting codebases to use GSAP 3.

Duration

The duration parameter of a tween is now defined in the vars object, as opposed to previous versions where it was defined as a parameter for methods.

Take the following code, written for a previous version of GSAP.

TweenMax.from('selector', 1, {});

In GSAP 3, the above code can be rewritten as:

gsap.from('selctor', {duration:1})

Note: The old syntax still works because the new update is backward-compatible. This helps prevent breaking codebases that use the old syntax.

Timeline defaults

GSAP 3 enables you to specify default properties for your timeline. Child tweens inherit these values on creation.

In the older version, properties were set individually per tween, which led to code repetition. The update helps developers follow the don’t repeat yourself (DRY) principle, keeping code simple and more concise.

The following example is written for older versions of GSAP.

var tl = new TimelineMax();
 tl.to(".selector1", 5 , {ease: Power2.Out, x:200})
 .to(".selector2", 5 , {ease: Power2.Out, y:500})

This translates to the following in GSAP 3.


More great articles from LogRocket:


gsap.timeline({defaults:{ease:"power2.out", duration:5}})
 .to(".selector1", {x:200})
 .to(".selector2", {y:500}) 

Each tween inherits the ease and duration from the parent timeline. Inherited defaults are easily overwritten when another value is defined on a child tween.

Advanced staggers

The new update removed methods used to stagger, such as staggerTo(), staggerFrom(), staggerFromTo(). This is now a parameter in the vars object.

You can add staggers to tweens in the following format.

gsap.method("selector", {
 x:500,
 duration:2,
 stagger: 1 // adds a stagger of 1 second
});

See the Pen
gsap-stagger
by Anjolaoluwa (@jola_adebayor)
on CodePen.

You can also perform more advanced staggers by using the object syntax.

gsap.method("selector", {
 x:500,
 duration:2,
 stagger: {
 amount:2, // amount of time between staggered tweens
 }

The stagger object also takes in other parameters such as:

  • from, which defines the point where the stagger should begin
  • axis, which defines the axis to be staggered from
  • ease, which defines the type of ease the staggered item should have

New random capabilities

You can now define random value ranges to (such as random(-100, 100)) or an array to be selected from, and GSAP will choose a random value to animate with.

This makes it easier to create advanced randomized effects.

gsap.method("selector", {
 x:"random(100, 200)" //chooses a random number between 1 and 100
}); 

Below is an example of using an array.

gsap.method("selector", {
 x:"random([0, 100, 400, 500])" //chooses a number in the array at random
}); 

You can even have the random number rounded to the closest increment of any number.

gsap.method("selector", {
 x:"random(-100, 100, 5)" //chooses a random number between -100 and 100 for each target, rounding to the closest 5!
});

Relative “>” and “<” position prefix

This feature helps with positioning animations in a timeline. It puts a tween relative to the previous tween’s start or end time and removes the need to add labels through your code.

gsap.method('selector',{}, "<" ) //Inserts a tween at the start of the previous tween

gsap.method('selector',{}, ">" ) //Inserts a tween at the end of the previous tween

New utility methods

GSAP has made 15 new utility methods available. Many of them return functions so that they can be added directly to tweens.

These methods include:

Keyframes

Keyframes are a way to define multiple states to which a single tween should be animated instead of creating multiple tweens with the same target.

You can pass an array of keyframes in the vars objects and they’ll be perfectly sequenced.

gsap.method("selector", {keyframes: [
 {x:500, duration:1,delay:2},//adds a delay of 2 seconds before the next animation
 {y:200, duration:1 }
]});

Using GSAP3 in your project

You can use the newest version of GreenSock in your project with either of the following methods.

Using CDN

You can include GSAP 3 in your project using CDN by adding the following to your HTML file.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>

Installing via package managers

To install via package managers, use the following code.

#Using Yarn

yarn add gsap

#or Using NPM

npm install gsap

Then, import it in your JavaScript file.

import { gsap } from "gsap";

Conclusion

The newly released GSAP 3 includes myriad updates to help you create even more stunning animations. There are more amazing features not covered in this article; for a full list of the updates, read the GSAP 3 release notes. The GreenSock team also put together a list of the top five features to check out in the new release.

Which new features stand out to you? Let us know in the comments section.

Are you adding new JS libraries to build new features or improve performance? What if they’re doing the opposite?

There’s no doubt that frontends are getting more complex. As you add new JavaScript libraries and other dependencies to your app, you’ll need more visibility to ensure your users don’t run into unknown issues.

LogRocket is a frontend application monitoring solution that lets you replay JavaScript errors as if they happened in your own browser so you can react to bugs more effectively.

👁 LogRocket Dashboard Free Trial Banner

LogRocket works perfectly with any app, regardless of framework, and has plugins to log additional context from Redux, Vuex, and @ngrx/store. Instead of guessing why problems happen, you can aggregate and report on what state your application was in when an issue occurred. LogRocket also monitors your app’s performance, reporting metrics like client CPU load, client memory usage, and more.

Build confidently — start monitoring for free.

👁 Image
👁 Image
👁 Image

Stop guessing about your digital experience with LogRocket

Get started for free

Recent posts:

Debug Next.js apps with AI agents and next-browser

Learn how next-browser gives AI agents runtime context for debugging Next.js apps, including React props, hydration, PPR, forms, and performance.

👁 Image
Emmanuel John
Jun 17, 2026 ⋅ 9 min read

Stop hardcoding LLM SDKs: Dynamic LLM routing with OpenRouter and Next.js

Build dynamic LLM routing in Next.js with OpenRouter, TanStack AI, task classification, model fallbacks, and cost-aware routing.

👁 Image
Chizaram Ken
Jun 16, 2026 ⋅ 13 min read

What is TSRX?: What JSX would look like if it were designed today

TSRX adds first-class control flow, conditional hooks, and scoped styles to React via a TypeScript compiler extension — no new framework required.

👁 Image
Ikeh Akinyemi
Jun 12, 2026 ⋅ 6 min read

How to add authentication to a React Native app with Better Auth

Learn how to build a full React Native auth system using Better Auth and Expo — with email/password login, Google OAuth, session persistence, and protected routes.

👁 Image
Chinwike Maduabuchi
Jun 9, 2026 ⋅ 13 min read
View all posts

Hey there, want to help make our blog better?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now