Intro to the GreenSock Animation Platform (GSAP)
Master Modern JavaScript Animation with GSAP
What You'll Learn in This Tutorial
GSAP Fundamentals
Learn to load GSAP libraries and understand the anatomy of a GSAP tween for smooth web animations.
Animation Methods
Master the gsap.from() method to create entrance animations that scale, move, and rotate elements.
Advanced Techniques
Explore multiple property tweening and easing functions to create professional, natural-feeling animations.
GreenSock Animation Platform (GSAP) is the fastest and most robust JavaScript library for animation, offering superior performance and cross-browser compatibility for professional web development.
Setting Up Your Workspace
Open Project Folder
Navigate to Desktop > Class Files > JavaScript Class > GSAP Intro folder and open it in your code editor
Preview Finished Result
Open done.html in your browser to see the completed Noble Desktop logo animation with scaling and movement
Open Working File
Close done.html and open intro.html - this is where you'll write your animation code
While you can use a CDN link for GSAP, using local files ensures your animations work offline and don't rely on external servers for reliability.
GSAP Architecture Benefits
Lightweight Core
GSAP's single core file handles most animation needs while keeping file size small and performance high.
Modular Design
Load only the features you need with optional plugins available for advanced animation requirements.
Save the file.
Preview intro.html in a web browser.
Notice how the logo elegantly scales up over one second to its natural size—the dimensions determined by your HTML and CSS. This seamless integration with existing styles is a key advantage of GSAP over other animation libraries.
To replay the animation, press Cmd–R (Mac) or Ctrl–R (Windows) to reload the browser.
Keep the page open in your browser for quick testing as we enhance the animation.
GSAP Animation Methods
| Feature | gsap.from() | gsap.to() |
|---|---|---|
| Purpose | Specifies start values | Specifies end values |
| Animation Direction | From specified to current state | From current to specified state |
| Use Case | Entrance animations | Exit animations |
Common GSAP Properties
Scale Property
Controls the size of elements. Use scale:0 to start invisible and animate to normal size.
Rotation Property
Rotates elements in degrees. Use positive values for clockwise, negative for counter-clockwise rotation.
Position Properties
Use x for horizontal movement and y for vertical movement. Positive y values move elements down.
The order of properties in your GSAP animation object doesn't matter - all specified properties will animate simultaneously over the duration.
An ease alters the rate of change (speed) during a tween, giving the movement a different feel.
Using the Ease Visualizer Tool
Access the Tool
Visit greensock.com/ease-visualizer to see visual previews of different easing functions
Compare Eases
Click different ease names to see how they affect animation speed and feel - compare 'none' vs 'power4'
Copy Code
Use the Copy Ease button to get the exact code syntax for your chosen easing function
Traditional vs GSAP Ease Naming
| Feature | Traditional Names | GSAP Power Names |
|---|---|---|
| Ease Strength 1 | Quad | power1 |
| Ease Strength 2 | Cubic | power2 |
| Ease Strength 3 | Quart | power3 |
| Ease Strength 4 | Quint | power4 |
| No Easing | Linear | none |
Popular Easing Types
Back Ease
Overshoots the target value before settling back, creating a bouncy or bubbly feeling effect.
Elastic Ease
Creates a springy bounce effect at the end of the animation, like a rubber band snapping back.
Bounce Ease
Simulates the element hitting an invisible wall and bouncing off multiple times before settling.
Additional eases like RoughEase, SlowMo, and CustomEase are available as separate plugins beyond the GSAP core file for specialized animation needs.
Key Takeaways

