Professional animation implementation using GSAP (GreenSock Animation Platform). Use this skill when users request animations, motion design, scroll effects, timeline sequences, interactive animations, or when building animated components, landing pages, or web experiences. Creates production-ready, performant animations with proper easing, timing, and sequencing.
This skill guides the creation of professional, production-grade animations using GSAP (GreenSock Animation Platform). GSAP is the industry-standard JavaScript animation library known for exceptional performance, reliability, and ease of use.
GSAP excels at animating CSS properties, SVG, canvas, and generic objects with precise timing and control. It's designed for:
Always load GSAP from CDN in this specific order:
<!-- Core GSAP (required) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
<!-- ScrollTrigger plugin (for scroll-based animations) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js"></script>
<!-- Other plugins as needed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/Draggable.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/MotionPathPlugin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/TextPlugin.min.js"></script>
Note: Some advanced plugins (SplitText, MorphSVG, DrawSVG) require a GreenSock membership. Stick to freely available plugins unless the user confirms they have access.
// Animate elements TO these values
gsap.to(".box", {
x: 100, // Move right 100px
y: 50, // Move down 50px
rotation: 360, // Rotate full circle
opacity: 0.5, // Fade to 50%
duration: 1, // 1 second
ease: "power2.out" // Easing function
});
// Animate FROM these values to current state
gsap.from(".box", {
opacity: 0,
y: -50,
duration: 1,
ease: "back.out(1.7)"
});
// Define both starting and ending values
gsap.fromTo(".box",
{ x: -100, opacity: 0 }, // From
{ x: 0, opacity: 1, duration: 1 } // To
);
// Set properties immediately (no animation)
gsap.set(".box", { x: 100, opacity: 0 });
{
x: 100, // translateX (pixels or relative)
y: 100, // translateY
xPercent: 50, // translateX in %
yPercent: 50, // translateY in %
rotation: 360, // rotate (degrees)
rotationX: 180, // rotateX (3D)
rotationY: 180, // rotateY (3D)
scale: 1.5, // scale uniformly
scaleX: 2, // scale width only
scaleY: 0.5, // scale height only
skewX: 10, // skew horizontally
skewY: 10, // skew vertically
transformOrigin: "center center" // rotation/scale origin
}
{
opacity: 0.5, // transparency
backgroundColor: "#ff0000", // colors
color: "#ffffff",
width: "500px", // CSS properties (use strings for units)
height: "300px",
borderRadius: "50%",
filter: "blur(10px)",
clipPath: "circle(50%)"
}
{
duration: 1, // Animation duration in seconds (default: 0.5)
delay: 0.5, // Delay before starting (default: 0)
ease: "power2.out", // Easing function (default: "power1.out")
stagger: 0.1, // Delay between animating multiple elements
repeat: 2, // Number of times to repeat (-1 for infinite)
repeatDelay: 1, // Delay between repeats
yoyo: true, // Reverse on alternate repeats
paused: false, // Start paused?
immediateRender: false, // Render immediately for .from()?
overwrite: "auto" // How to handle conflicting animations
}
GSAP includes powerful easing options. Choose based on the desired feel:
// Power eases (most common)
"power1.out" // Subtle deceleration
"power2.out" // Moderate deceleration (default feel)
"power3.out" // Strong deceleration
"power4.out" // Very strong deceleration
// Specialized eases
"back.out(1.7)" // Overshoots then settles (playful)
"elastic.out" // Bouncy, spring-like
"bounce.out" // Bounces at the end
"circ.out" // Circular motion feel
"expo.out" // Exponential deceleration (dramatic)
// Ease directions
".out" // Fast start, slow end (most common)
".in" // Slow start, fast end
".inOut" // Slow start and end, fast middle
// Linear
"none" // No easing, constant speed
// Examples of usage