home / skills / dylantarre / animation-principles / gsap-greensock

This skill helps you implement Disney's 12 animation principles using GSAP for expressive, coordinated web animations with timelines and eases.

npx playbooks add skill dylantarre/animation-principles --skill gsap-greensock

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.0 KB
---
name: gsap-greensock
description: Use when implementing Disney's 12 animation principles with GSAP (GreenSock Animation Platform)
---

# GSAP Animation Principles

Implement all 12 Disney animation principles using GSAP's powerful timeline and tween system.

## 1. Squash and Stretch

```javascript
gsap.to(".ball", {
  scaleX: 1.2,
  scaleY: 0.8,
  yoyo: true,
  repeat: 1,
  duration: 0.15,
  ease: "power2.inOut"
});
```

## 2. Anticipation

```javascript
const tl = gsap.timeline();
tl.to(".character", { y: 20, scaleY: 0.9, duration: 0.2 }) // wind up
  .to(".character", { y: -200, duration: 0.4, ease: "power2.out" }); // action
```

## 3. Staging

```javascript
gsap.to(".background", { filter: "blur(3px)", opacity: 0.6 });
gsap.to(".hero", { scale: 1.1, zIndex: 10 });
```

## 4. Straight Ahead / Pose to Pose

```javascript
// Pose to pose with explicit keyframes
gsap.to(".sprite", {
  keyframes: [
    { x: 0, y: 0 },
    { x: 100, y: -50 },
    { x: 200, y: 0 },
    { x: 300, y: -30 }
  ],
  duration: 1
});
```

## 5. Follow Through and Overlapping Action

```javascript
const tl = gsap.timeline();
tl.to(".body", { x: 200, duration: 0.5 })
  .to(".hair", { x: 200, duration: 0.5 }, "-=0.4")  // overlaps
  .to(".cape", { x: 200, duration: 0.6 }, "-=0.45"); // more drag
```

## 6. Slow In and Slow Out

```javascript
gsap.to(".element", {
  x: 300,
  duration: 0.6,
  ease: "power2.inOut" // slow in and out
});
// Other eases: "power3.in", "power3.out", "elastic.out"
```

## 7. Arc

```javascript
gsap.to(".ball", {
  motionPath: {
    path: [{ x: 0, y: 0 }, { x: 100, y: -100 }, { x: 200, y: 0 }],
    curviness: 1.5
  },
  duration: 1
});
```

## 8. Secondary Action

```javascript
const tl = gsap.timeline();
tl.to(".button", { scale: 1.1, duration: 0.2 })
  .to(".icon", { rotation: 15, duration: 0.15 }, "<") // same time
  .to(".particles", { opacity: 1, stagger: 0.05 }, "<0.1");
```

## 9. Timing

```javascript
// Fast snap
gsap.to(".fast", { x: 100, duration: 0.15 });
// Gentle float
gsap.to(".slow", { y: -20, duration: 2, ease: "sine.inOut", yoyo: true, repeat: -1 });
```

## 10. Exaggeration

```javascript
gsap.to(".element", {
  scale: 1.5,        // exaggerated scale
  rotation: 720,     // multiple spins
  duration: 0.8,
  ease: "back.out(2)" // overshoot
});
```

## 11. Solid Drawing

```javascript
gsap.to(".box", {
  rotationX: 45,
  rotationY: 30,
  transformPerspective: 1000,
  duration: 0.5
});
```

## 12. Appeal

```javascript
gsap.to(".card", {
  scale: 1.02,
  boxShadow: "0 20px 40px rgba(0,0,0,0.2)",
  duration: 0.3,
  ease: "power1.out"
});
```

## GSAP Timeline Pattern

```javascript
const masterTL = gsap.timeline({ defaults: { ease: "power2.out" }});
masterTL
  .add(anticipation())
  .add(mainAction())
  .add(followThrough());
```

## Key GSAP Features

- `gsap.timeline()` - Sequence animations
- `ease` - 30+ built-in easing functions
- `stagger` - Offset multiple elements
- `motionPath` - Arc and path animations
- `yoyo` / `repeat` - Loop control
- `"<"` / `"-=0.2"` - Position parameter for overlap

Overview

This skill teaches how to apply Disney's 12 animation principles using GSAP (GreenSock Animation Platform). It provides practical patterns and code fragments to shape timing, motion, and character appeal with GSAP timelines, tweens, eases, and motion paths. Use it to build expressive UI motion, character animation, and polished microinteractions.

How this skill works

The skill maps each Disney principle to concrete GSAP techniques: tweens for squash/stretch and exaggeration, timelines for anticipation and follow-through, motionPath for arcs, and easing for slow-in/slow-out. It demonstrates composition patterns like a master timeline with reusable sub-timelines and shows how to layer secondary actions with position parameters and stagger. Sample snippets highlight parameters you can tweak for rhythm and personality.

When to use it

  • Designing character motion or mascot animations for web and apps
  • Crafting microinteractions and feedback states with emotional nuance
  • Sequencing complex scenes where overlapping actions matter
  • Improving perceived quality of UI transitions and onboarding animations
  • Teaching or prototyping traditional animation principles in code

Best practices

  • Start with a master timeline and compose small, named sub-timelines (anticipation, mainAction, followThrough)
  • Favor relative position parameters ("<", "-=0.2") to create natural overlap and follow-through
  • Use easing functions to get believable slow-in/slow-out; test different power and elastic eases
  • Keep secondary actions subtle and tied to primary motion to avoid visual noise
  • Use motionPath for arcs and curviness rather than manual x/y keyframes when possible

Example use cases

  • A bouncing product mascot that uses squash-and-stretch, arcs, and timing to feel alive
  • Button interactions where anticipation, secondary action, and appeal enhance perceived responsiveness
  • Scene sequencing for a landing page hero using a master timeline and layered follow-through
  • Character jump/land cycles with pose-to-pose keyframes and overlapping hair or cape motion
  • Animated onboarding steps that use exaggeration and solid drawing to guide attention

FAQ

Can I combine these techniques with frameworks like React or Vue?

Yes. GSAP integrates well with component frameworks; create timelines in lifecycle hooks and kill or revert them on unmount.

Which easing functions best reproduce hand-drawn animation timing?

Power eases (power2, power3) are good defaults for slow-in/slow-out. Use back and elastic eases for overshoot and snappy squash effects.