Skip to main content
skill CX Codex

gsap · mindrally — Claude Code skill: GSAP animation rules for agents

Tells your agent how to write GSAP animations: transforms over left/top, stagger, timelines, ScrollTrigger. Useful when the UI stutters on weaker hardware.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill gsap -a claude-code
Open on GitHub

What gsap does

The skill turns the agent into a GSAP reviewer. It carries rules for importing the library and registering plugins, choosing between gsap.to(), gsap.from() and gsap.fromTo(), and building sequences as timelines with labels and overlapping steps.

A separate section covers performance. Animate through x, y, rotation and scale rather than left and top, since transforms go to the GPU. Lists get stagger, long pages get ScrollTrigger.batch(), and CPU spikes get gsap.ticker.lagSmoothing(). Selectors should be cached — re-querying the DOM on every call is wasted work.

React and SVG have their own parts. For React it points to the useGSAP hook from @gsap/react, scoped to a container ref, with tl.kill() on unmount. If your project has no animation at all, the skill only adds context the agent will not use.

What it helps with

  • stop an animation from stuttering on a low-end phone
  • chain reveal steps into a single timeline
  • tie an element's movement to page scroll
  • kill timelines when a React component unmounts
  • animate the stroke of an SVG icon

Example prompts for the agent

  • Reveal the product cards with gsap stagger so they don't all fire at once
  • Rewrite the scroll animation with ScrollTrigger and pin the features section
  • Set up useGSAP with a scope in this component and clean up the timeline on unmount

How to install gsap

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill gsap -a claude-code

2Manually: put the files in place

~/.claude/skills/gsap/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/gsap/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about gsap

How do I install gsap in Claude?

Run npx skills add Mindrally/skills --skill gsap -a claude-code. The skill file lands at ~/.claude/skills/gsap/SKILL.md.

What does the gsap skill do?

It gives the agent rules for writing GreenSock Animation Platform code: timelines, stagger, ScrollTrigger, transform-based animation and React cleanup.

Does the project need GSAP for the skill to help?

Yes. The skill describes code built on GSAP and its plugins, including ScrollTrigger and MotionPathPlugin. Without the library in the project there is nothing to apply those rules to.

Source text

SKILL.md · Apache-2.0
---
name: gsap
description: Expert guidelines for building high-performance animations with GSAP (GreenSock Animation Platform)
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# GSAP Animation Guidelines

You are an expert in GSAP (GreenSock Animation Platform), JavaScript, and web animation performance. Follow these guidelines when creating animations.

## Core Principles

### Import and Setup
```javascript
// Modern ES Module import
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";

// Register plugins
gsap.registerPlugin(ScrollTrigger);
```

### Use gsap.to(), gsap.from(), and gsap.fromTo()
```javascript
// Animate TO a state
gsap.to(".element", { x: 100, duration: 1 });

// Animate FROM a state
gsap.from(".element", { opacity: 0, y: 50, duration: 0.5 });

// Animate FROM one state TO another
gsap.fromTo(".element",
  { opacity: 0 },
  { opacity: 1, duration: 0.5 }
);
```

## Performance Optimization

### Leverage Hardware Acceleration
```javascript
// Use transforms instead of positional properties
gsap.to(".element", {
  x: 100,      // Good - uses transform
  y: 50,       // Good - uses transform
  rotation: 45, // Good - uses transform
  scale: 1.2,  // Good - uses transform
  // Avoid: left, top, width, height when possible
});

// Enable force3D for GPU acceleration
gsap.to(".element", {
  x: 100,
  force3D: true // Ensures GPU acceleration
});
```

### Use will-change Wisely
```javascript
// Apply will-change before animation
element.style.willChange = "transform";

gsap.to(element, {
  x: 100,
  onComplete: () => {
    element.style.willChange = "auto"; // Remove after animation
  }
});
```

### Stagger for Multiple Elements
```javascript
// Always use stagger for multiple elements
gsap.to(".items", {
  opacity: 1,
  y: 0,
  stagger: 0.1, // Prevents all elements animating at once
  duration: 0.5
});

// Advanced stagger options
gsap.to(".grid-items", {
  scale: 1,
  stagger: {
    each: 0.1,
    from: "center",
    grid: "auto"
  }
});
```

### Use Lag Smoothing
```javascript
// Prevent animation stuttering during CPU spikes
gsap.ticker.lagSmoothing(1000, 16);
```

## Timeline Best Practices

### Use Timelines for Complex Sequences
```javascript
const tl = gsap.timeline({
  defaults: { duration: 0.5, ease: "power2.out" }
});

tl.to(".header", { y: 0, opacity: 1 })
  .to(".content", { y: 0, opacity: 1 }, "-=0.3") // Overlap
  .to(".footer", { y: 0, opacity: 1 }, "-=0.3");
```

### Use Labels for Organization
```javascript
const tl = gsap.timeline();

tl.addLabel("start")
  .to(".intro", { opacity: 1 })
  .addLabel("middle")
  .to(".main", { x: 100 })
  .addLabel("end")
  .to(".outro", { opacity: 0 });

// Jump to label
tl.play("middle");
```

### Control Timelines
```javascript
const tl = gsap.timeline({ paused: true });

// Methods
tl.play();
tl.pause();
tl.reverse();
tl.restart();
tl.seek(1.5); // Go to 1.5 seconds
tl.progress(0.5); // Go to 50%
```

## ScrollTrigger Best Practices

### Basic ScrollTrigger Setup
```javascript
gsap.to(".element", {
  x: 500,
  scrollTrigger: {
    trigger: ".element",
    start: "top center",
    end: "bottom center",
    scrub: true,
    markers: false // Enable for debugging only
  }
});
```

### Pin Elements Properly
```javascript
ScrollTrigger.create({
  trigger: ".panel",
  pin: true,
  start: "top top",
  end: "+=500",
  pinSpacing: true
});
```

### Batch ScrollTriggers for Performance
```javascript
ScrollTrigger.batch(".items", {
  onEnter: (elements) => {
    gsap.to(elements, {
      opacity: 1,
      y: 0,
      stagger: 0.1
    });
  }
});
```

## React Integration

### Use useGSAP Hook
```javascript
import { useGSAP } from "@gsap/react";

function Component() {
  const containerRef = useRef(null);

  useGSAP(() => {
    gsap.to(".box", { x: 100 });
  }, { scope: containerRef }); // Scopes selectors to container

  return <div ref={containerRef}>...</div>;
}
```

### Cleanup Animations
```javascript
useGSAP(() => {
  const tl = gsap.timeline();
  tl.to(".element", { x: 100 });

  return () => {
    tl.kill(); // Clean up on unmount
  };
}, []);
```

## Selector Optimization

### Cache DOM Selectors
```javascript
// Bad - queries DOM on every call
gsap.to(".element", { x: 100 });
gsap.to(".element", { y: 50 });

// Good - cache the reference
const element = document.querySelector(".element");
gsap.to(element, { x: 100 });
gsap.to(element, { y: 50 });
```

### Use gsap.utils for Efficiency
```javascript
// Convert NodeList to Array
const items = gsap.utils.toArray(".items");

// Create reusable selector
const select = gsap.utils.selector(container);
gsap.to(select(".box"), { x: 100 });
```

## Easing

### Use Appropriate Eases
```javascript
// Common eases for UI
gsap.to(".element", { x: 100, ease: "power2.out" }); // Decelerate
gsap.to(".element", { x: 100, ease: "power2.in" });  // Accelerate
gsap.to(".element", { x: 100, ease: "power2.inOut" }); // Both

// Bounce and elastic for playful UI
gsap.to(".element", { y: 0, ease: "bounce.out" });
gsap.to(".element", { scale: 1, ease: "elastic.out(1, 0.3)" });
```

## SVG Animation

### Animate SVG Properties
```javascript
gsap.to("path", {
  strokeDashoffset: 0,
  duration: 2,
  ease: "none"
});

gsap.to("circle", {
  attr: { r: 50, cx: 200 },
  duration: 1
});
```

## Complex Animations

### Use MotionPath for Path Animation
```javascript
import { MotionPathPlugin } from "gsap/MotionPathPlugin";
gsap.registerPlugin(MotionPathPlugin);

gsap.to(".element", {
  motionPath: {
    path: "#path",
    align: "#path",
    autoRotate: true
  },
  duration: 5
});
```

## Debugging

### Use Markers During Development
```javascript
ScrollTrigger.defaults({
  markers: process.env.NODE_ENV === "development"
});
```

### Debug Timeline Progress
```javascript
tl.eventCallback("onUpdate", () => {
  console.log(tl.progress());
});
```

## Best Practices Summary

1. Always use transforms over positional properties
2. Use stagger for animating multiple elements
3. Leverage timelines for complex sequences
4. Cache DOM selectors
5. Use useGSAP hook in React
6. Clean up animations on component unmount
7. Enable lag smoothing for smooth playback
8. Test on actual devices, especially mobile

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Frontend and UI →

gsap by other authors comes first.

gsap MengTo A skill that helps your coding agent write and debug GSAP web animations: timelines, ScrollTrigger, stagger, transforms. CX Codex +1 1,800installs gsap AThevon This skill helps an agent write GSAP animations with timelines, staggered effects, and ScrollTrigger. Use it for complex motion and scroll-linked scenes. CX Codex +1 997installs gsap martinholovsky A skill that teaches the agent GSAP animations: HUD panel entrances, status indicator transitions, scroll effects. Useful when the UI is built on Vue. CX Codex +1 1,300installs gsap official HeyGen A GSAP cheat sheet for your agent: tweens, timelines, easing, performance. Useful when writing animation inside HyperFrames compositions. CX Codex GP ChatGPT 3installs gsap-scrolltrigger greensock Teaches AI agents to build scroll-driven animations with GreenSock ScrollTrigger, including pinned sections and scrub timelines. CX Codex +1 72,200installs gsap-plugins greensock A skill that walks your agent through GSAP plugin registration and usage: ScrollTo, Flip, Draggable, SplitText and more. Handy when your animations already run on GSAP. CX Codex +1 67,200installs gsap-scrolltrigger-storytelling MengTo A skill for scroll-driven product storytelling: pinned scenes, progressive UI reveals and transitions between sections, built on GSAP ScrollTrigger. CX Codex +1 1,800installs gsap-web iart-ai Helps AI coding assistants write GSAP animations, from sequenced timelines and ScrollTrigger effects to SplitText, Flip, and Lenis smooth scroll. CX Codex +1 2,500installs cinematic-gsap-lenis-motion-system MengTo Builds cinematic web animation systems using GSAP, ScrollTrigger, and Lenis. Ideal for luxury editorial layouts, creative portfolios, and smooth reveals. CX Codex +1 2,400installs gsap-animation notedit Integrates GSAP animations into Remotion video projects. It brings timeline orchestration, SplitText reveals, and custom easing curves into React-based video rendering. CX Codex +1 313installs

From the same set168

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor