Docs https://gsap.com/
Perfect π₯ β youβve added the official GSAP docs link (https://gsap.com/).
Letβs now expand it with detailed GSAP documentation info, including official sections, usage guides, and hidden gems many developers miss.
Hereβs the comprehensive GSAP documentation breakdown π
π Official Docs β https://gsap.com/docs/
GSAPβs core module handles all the basic animations. Once you import or include it, you can use these main methods:
| Method | Description | Example |
|---|---|---|
gsap.to() |
Animates target properties to new values | gsap.to(".box", { x: 200, duration: 1 }); |
gsap.from() |
Animates from starting values to current ones | gsap.from(".circle", { opacity: 0, y: -50 }); |
gsap.fromTo() |
Defines both start and end values | gsap.fromTo(".card", { scale: 0.5 }, { scale: 1 }); |
gsap.set() |
Instantly sets a property (no animation) | gsap.set(".text", { opacity: 0 }); |
gsap.delayedCall() |
Calls a function after delay | gsap.delayedCall(2, () => console.log("Done")); |
gsap.killTweensOf() |
Instantly stops any ongoing animation | gsap.killTweensOf(".box"); |
π Docs Link: π GSAP Core Methods
Timelines give you precise control to chain and organize multiple animations.
const tl = gsap.timeline({ repeat: 2, yoyo: true });
tl.to(".box", { x: 100, duration: 1 })
.to(".circle", { y: 100, duration: 1 })
.to(".triangle", { rotation: 360, duration: 1 });| Method | Description |
|---|---|
tl.add() |
Add a new animation to the timeline |
tl.play() |
Play animation forward |
tl.reverse() |
Play backward |
tl.pause() |
Pause animation |
tl.seek(time) |
Jump to specific time |
tl.progress(value) |
Set timeline progress (0 β 1) |
π Docs Link: π GSAP Timeline Docs
GSAP includes official plugins that extend functionality β these are the real power tools π§
| Plugin | Purpose | Docs Link |
|---|---|---|
| ScrollTrigger | Trigger animations during scroll | ScrollTrigger Docs |
| Draggable | Make elements draggable | Draggable Docs |
| MotionPathPlugin | Move elements along SVG paths | MotionPath Docs |
| ScrollToPlugin | Smoothly scroll to positions | ScrollTo Docs |
| SplitText | Animate characters/words separately | SplitText Docs |
| Observer | Detect gestures (scroll, touch, wheel) | Observer Docs |
| Flip | Create advanced layout transitions | Flip Docs |
GSAP comes with super-useful utility helpers via gsap.utils.
| Utility | Description | Example |
|---|---|---|
gsap.utils.random(min, max) |
Returns a random number | gsap.utils.random(-50, 50) |
gsap.utils.wrap(array) |
Cycles through values | gsap.utils.wrap(["red","green","blue"]) |
gsap.utils.clamp(min, max, value) |
Limits value between range | gsap.utils.clamp(0, 100, 120) |
gsap.utils.interpolate(a, b, progress) |
Interpolates between values | gsap.utils.interpolate(0, 100, 0.5) |
gsap.utils.snap(increment, value) |
Snaps to nearest increment | gsap.utils.snap(5, 17) |
π Docs Link: π GSAP Utilities
Eases define how your animation moves.
| Ease Name | Effect |
|---|---|
power1.inOut |
Smooth start and end |
back.out(1.7) |
Overshoot at end |
elastic.out(1, 0.3) |
Bouncy motion |
bounce.out |
Ball drop bounce |
sine.inOut |
Gentle wave-like motion |
π Docs Link: π Easing Docs
You can run code at specific points during an animation:
| Callback | Trigger Point |
|---|---|
onStart |
When animation begins |
onUpdate |
Every frame during animation |
onComplete |
When animation finishes |
onRepeat |
When animation repeats |
onReverseComplete |
When reverse animation completes |
Example:
gsap.to(".box", {
x: 200,
duration: 2,
onStart: () => console.log("Started"),
onComplete: () => console.log("Completed")
});π Docs Link: π Callbacks Docs
When using GSAP in React, wrap animations in gsap.context() for cleanup and scope safety:
import { useEffect, useRef } from "react";
import { gsap } from "gsap";
export default function Example() {
const boxRef = useRef();
useEffect(() => {
const ctx = gsap.context(() => {
gsap.to(boxRef.current, { x: 300, duration: 2 });
});
return () => ctx.revert(); // cleanup on unmount
}, []);
return <div ref={boxRef} className="box"></div>;
}π Docs Link: π React Integration Docs
The GSAP team provides live interactive examples on CodePen:
π GSAP CodePen Collection Learn via hands-on demos (ScrollTrigger, MotionPath, Flip, etc.)
GSAP has premium (paid) plugins via Club GreenSock:
- MorphSVGPlugin π β morph SVG paths
- DrawSVGPlugin βοΈ β draw SVG strokes
- SplitText π¬ β animate individual letters
- GSDevTools βοΈ β debug timelines visually
π Docs Link: π Club GreenSock
| Category | Docs Link |
|---|---|
| GSAP Core | https://gsap.com/docs/v3/GSAP/ |
| Timeline | https://gsap.com/docs/v3/GSAP/Timeline/ |
| Plugins | https://gsap.com/docs/v3/Plugins/ |
| Eases | https://gsap.com/docs/v3/Eases/ |
| Utilities | https://gsap.com/docs/v3/GSAP/UtilityMethods/ |
| ScrollTrigger | https://gsap.com/docs/v3/Plugins/ScrollTrigger/ |
| React Integration | https://gsap.com/resources/React/ |