dinaf2026-web/awesome-web-skills/web-animations-gsap

Claude Code and agent skill by dinaf2026-web/awesome-web-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

GSAP animation patterns for modern websites — ScrollTrigger, timelines, text animations, SVG morphing, and scroll-driven storytelling. More powerful than CSS or Framer Motion for complex sequences.

Install

npx vskill@latest install dinaf2026-web/awesome-web-skills/web-animations-gsap

SKILL.md

The same SKILL.md was published earlier as dinaf2026-web/awesome-web-skills/web-animations-gsap.

GSAP Animation Patterns

1. When to Use GSAP vs Framer Motion vs CSS

ScenarioWinnerReason
Simple hover/toggle transitionsCSSZero JS overhead
Component enter/exit animationsFramer MotionReact-idiomatic, AnimatePresence
Gesture-driven drag interactionsFramer MotionBuilt-in gesture API
Multi-step sequenced timelinesGSAPPrecise control, labels, callbacks
Scroll-linked scrubbed animationsGSAP ScrollTriggerBest-in-class scrub fidelity
SVG path drawing / morphingGSAPdrawSVG + morphSVG plugins
Text character/word revealsGSAP SplitTextLine-aware splitting with reflow
60fps parallax layersGSAPTicker + compositor-only transforms
Counter/number animationsGSAPBuilt-in number tweening
Canvas / WebGL orchestrationGSAPTicker drives any JS value
Simple page-load fadeCSS or Framer MotionOverkill for GSAP
Reduced-motion usersCSSUse prefers-reduced-motion media query first

Rule of thumb: If you need a scrubbed scroll timeline, a multi-step sequence with labels, or SVG manipulation — reach for GSAP. For component-level presence animations in React, Framer Motion wins on ergonomics.


2. Setup in Next.js

bash
npm install gsap
# Club plugins (SplitText, DrawSVG, MorphSVG, ScrambleText) require GSAP Club membership
# npm install gsap@npm:@gsap/shockingly # Club tier
typescript
// lib/gsap.ts — centralized registration, SSR-safe
import { gsap } from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'
import { SplitText } from 'gsap/SplitText'
import { DrawSVGPlugin } from 'gsap/DrawSVGPlugin'
import { MorphSVGPlugin } from 'gsap/MorphSVGPlugin'
import { ScrambleTextPlugin } from 'gsap/ScrambleTextPlugin'
// Register once — safe to call multiple times
if (typeof window !== 'undefined') {
gsap.registerPlugin(
ScrollTrigger,
SplitText,
DrawSVGPlugin,
MorphSVGPlugin,
ScrambleTextPlugin,
)
}
export { gsap, ScrollTrigger, SplitText, DrawSVGPlugin, MorphSVGPlugin, ScrambleTextPlugin }
typescript
// hooks/useGsap.ts — cleanup-safe animation hook
import { useEffect, useRef, DependencyList } from 'react'
import { gsap } from '@/lib/gsap'
/**
* Drop-in replacement for useEffect that auto-reverts all GSAP
* animations when the component unmounts or deps change.
*/
export function useGsap(
callback: (context: gsap.Context) => void,
deps: DependencyList = [],
) {
const contextRef = useRef<gsap.Context | null>(null)
useEffect(() => {
contextRef.current = gsap.context(callback)
return () => {
contextRef.current?.revert()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps)
}
typescript
// Usage in any component
'use client'
import { useRef } from 'react'
import { gsap } from '@/lib/gsap'
import { useGsap } from '@/hooks/useGsap'
export function FadeInBox() {
const boxRef = useRef<HTMLDivElement>(null)
useGsap((ctx) => {
ctx.add(() => {
gsap.from(boxRef.current, { opacity: 0, y: 40, duration: 0.8 })
})
}, [])
return <div ref={boxRef} className="box" />
}

3. ScrollTrigger Fundamentals

typescript
'use client'
import { useRef } from 'react'
import { gsap } from '@/lib/gsap'
import { ScrollTrigger } from '@/lib/gsap'
import { useGsap } from '@/hooks/useGsap'
export function ScrollSection() {
const sectionRef = useRef<HTMLElement>(null)
const contentRef = useRef<HTMLDivElement>(null)
useGsap(() => {
// Pin + scrub — element stays fixed while scrolling through its own height
gsap.from(contentRef.current, {
x: 200,
opacity: 0,
duration: 1,
scrollTrigger: {
trigger: sectionRef.current,
start: 'top 80%', // when top of trigger hits 80% from top of viewport
end: 'bottom 20%', // when bottom of trigger hits 20% from top of viewport
scrub: 1, // smooth scrub — number = seconds of lag behind scroll
pin: false, // set true to pin the trigger element
markers: process.env.NODE_ENV === 'development', // dev-only visual guides
toggleActions: 'play none none reverse', // onEnter onLeave onEnterBack onLeaveBack
onEnter: () => console.log('entered'),
onLeave: () => console.log('left'),
},
})
}, [])
return (
<section ref={sectionRef} className="min-h-screen">
<div ref={contentRef}>Content</div>
</section>
)
}
// Pinned scrollytelling panel
export function PinnedStory() {
const containerRef = useRef<HTMLDivElement>(null)
const panelsRef = useRef<HTMLDivElement[]>([])
useGsap(() => {
const panels = panelsRef.current
// Horizontal scroll pinned section
gsap.to(panels, {
xPercent: -100 * (panels.length - 1),
ease: 'none',
scrollTrigger: {
trigger: containerRef.current,
pin: true,
scrub: 1,
snap: 1 / (panels.length - 1),
end: () => `+=${containerRef.current?.offsetWidth ?? 0}`,
},
})
}, [])
return (
<div ref={containerRef} className="overflow-hidden flex w-[300vw]">
{['Panel 1', 'Panel 2', 'Panel 3'].map((label, i) => (
<div
key={label}
ref={(el) => { if (el) panelsRef.current[i] = el }}
className="w-screen h-screen flex-shrink-0 flex items-center justify-center"
>
{label}
</div>
))}
</div>
)
}
start/end Syntax Reference
"top top" → top of element meets top of viewport
"top center" → top of element meets center of viewport
"top 80%" → top of element meets 80% down from viewport top
"top +=200" → top of element + 200px offset
"center center" → centers meet
"bottom bottom" → bottom of element meets bottom of viewport
"+=500" → 500px after the start trigger (no element reference)

4. Timeline Sequences

typescript
'use client'
import { useRef } from 'react'
import { gsap } from '@/lib/gsap'
import { ScrollTrigger } from '@/lib/gsap'
import { useGsap } from '@/hooks/useGsap'
export function HeroTimeline() {
const containerRef = useRef<HTMLDivElement>(null)
useGsap(() => {
const tl = gsap.timeline({
defaults: { ease: 'power3.out', duration: 0.8 },
scrollTrigger: {
trigger: containerRef.current,
start: 'top 70%',
once: true, // play once — don't reverse on scroll back
},
})
// Labels as named anchor points
tl.addLabel('start')
.from('.hero-eyebrow', { y: 20, opacity: 0 }, 'start')
.from('.hero-headline', { y: 40, opacity: 0 }, 'start+=0.15')
.from('.hero-subline', { y: 30, opacity: 0 }, 'start+=0.3')
.addLabel('cta')
.from('.hero-cta', { scale: 0.9, opacity: 0, duration: 0.5 }, 'cta')
.from('.hero-image', { x: 60, opacity: 0, duration: 1 }, 'start+=0.2')
return () => tl.kill()
}, [])
return (
<div ref={containerRef}>
<p className="hero-eyebrow">Eyebrow</p>
<h1 className="hero-headline">Headline</h1>
<p className="hero-subline">Subline copy</p>
<button className="hero-cta">Get Started</button>
<img className="hero-image" src="/hero.jpg" alt="" />
</div>
)
}
// Stagger — animate a collection with offset delay
export function StaggerCards() {
const listRef = useRef<HTMLUListElement>(null)
useGsap(() => {
const tl = gsap.timeline({
scrollTrigger: {
trigger: listRef.current,
start: 'top 75%',
once: true,
},
})
tl.from(listRef.current?.querySelectorAll('.card') ?? [], {
y: 50,
opacity: 0,
stagger: {
each: 0.1, // 100ms between each
from: 'start', // 'start' | 'end' | 'center' | 'random' | index
ease: 'power2.inOut',
},
duration: 0.6,
})
}, [])
return (
<ul ref={listRef} className="grid grid-cols-3 gap-6">
{Array.from({ length: 6 }).map((_, i) => (
<li key={i} className="card bg-white rounded-xl p-6 shadow">Card {i + 1}</li>
))}
</ul>
)
}
// Nested timelines for modular composition
function buildCardTimeline(el: HTMLElement): gsap.core.Timeline {
return gsap.timeline()
.from(el.querySelector('.card-image'), { scale: 1.1, duration: 0.6 })
.from(el.querySelector('.card-title'), { y: 20, opacity: 0, duration: 0.4 }, '-=0.2')
.from(el.querySelector('.card-body'), { y: 10, opacity: 0, duration: 0.3 }, '-=0.1')
}
export function FeatureSection() {
const sectionRef = useRef<HTMLElement>(null)
useGsap(() => {
const master = gsap.timeline({
scrollTrigger: { trigger: sectionRef.current, start: 'top 60%', once: true },
})
sectionRef.current?.querySelectorAll('.feature-card').forEach((card, i) => {
master.add(buildCardTimeline(card as HTMLElement), i * 0.15)
})
}, [])
return <section ref={sectionRef}>{/* cards */}</section>
}

5. Text Animations

typescript
'use client'
import { useRef } from 'react'
import { gsap, SplitText } from '@/lib/gsap'
import { ScrollTrigger } from '@/lib/gsap'
import { useGsap } from '@/hooks/useGsap'
// Word reveal — mask each word with overflow:hidden wrapper
export function WordReveal({ text }: { text: string }) {
const headingRef = useRef<HTMLHeadingElement>(null)
useGsap(() => {
const split = new SplitText(headingRef.current, {
type: 'words,lines',
linesClass: 'line-wrapper overflow-hidden', // mask container
})
const tl = gsap.timeline({
scrollTrigger: {
trigger: headingRef.current,
start: 'top 85%',
once: true,
},
})
tl.from(split.words, {
y: '110%', // slide up from below the line mask
opacity: 0,
duration: 0.7,
ease: 'power4.out',
stagger: 0.04,
})
return () => split.revert() // restore original DOM
}, [])
return <h2 ref={headingRef}>{text}</h2>
}
// Character reveal — cinematic letter-by-letter
export function CharReveal({ text }: { text: string }) {
const ref = useRef<HTMLHeadingElement>(null)
useGsap(() => {
const split = new SplitText(ref.current, { type: 'chars' })
gsap.from(split.chars, {
opacity: 0,
y: 20,
rotateX: -90,
stagger: 0.02,
duration: 0.5,
ease: 'back.out(1.7)',
scrollTrigger: { trigger: ref.current, start: 'top 80%', once: true },
})
return () => split.revert()
}, [])
return <h1 ref={ref} style={{ perspective: '600px' }}>{text}</h1>
}
// Typewriter — cursor blink effect
export function Typewriter({ phrases }: { phrases: string[] }) {
const elRef = useRef<HTMLSpanElement>(null)
useGsap(() => {
let phraseIndex = 0
const type = () => {
const phrase = phrases[phraseIndex % phrases.length]
phraseIndex++
gsap.to(elRef.current, {
duration: phrase.length * 0.06,
text: { value: phrase, delimiter: '' },
ease: 'none',
onComplete: () => {
gsap.delayedCall(1.5, erase)
},
})
}
const erase = () => {
gsap.to(elRef.current, {
duration: 0.4,
text: { value: '', delimiter: '' },
ease: 'none',
onComplete: () => gsap.delayedCall(0.3, type),
})
}
type()
}, [])
return (
<span>
<span ref={elRef} />
<span className="animate-blink">|</span>
</span>
)
}
// Scramble text (Club plugin)
export function ScrambleReveal({ text }: { text: string }) {
const ref = useRef<HTMLParagraphElement>(null)
useGsap(() => {
gsap.to(ref.current, {
duration: 1.5,
scrambleText: {
text,
chars: 'upperCase',
revealDelay: 0.3,
speed: 0.4,
},
scrollTrigger: { trigger: ref.current, start: 'top 80%', once: true },
})
}, [])
return <p ref={ref}>{text}</p>
}

6. Scroll-Driven Counters

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/dinaf2026-web/awesome-web-skills/web-animations-gsap/badge)](https://verified-skill.com/skills/dinaf2026-web/awesome-web-skills/web-animations-gsap)

Something wrong with this skill or its page? Tell us.