Communitygithub.com

GSAP 웹 애니메이션 스킬

GSAP(GreenSock Animation Platform)을 활용한 웹 모션 설계: 스크롤 기반 스토리텔링, 텍스트 리빌, 레이아웃 전환, Lenis/Locomotive와의 동기화를 지원합니다.

GSAP 웹 애니메이션 스킬란 무엇인가요?

이 스킬은 GSAP(GreenSock Animation Platform)과 그 플러그인(ScrollTrigger, SplitText, Flip, Lenis 등)을 사용하여 코드 중심의 웹 모션을 구현하는 방법을 제공합니다. 개발자는 GSAP 3.12+의 모든 무료 플러그인을 활용하여 스크롤 기반 스토리텔링(고정 섹션, 패럴랙스, 스크러빙), 순차적 히어로 애니메이션, 문자/단어 단위 텍스트 리빌(SplitText), 요소 위치/크기/부모 변경 시 레이아웃 전환(Flip)을 구현할 수 있습니다. 특히 Lenis 또는 Locomotive와 같은 스무스 스크롤 라이브러리와 GSAP ScrollTrigger를 동기화하는 공식적인 방법을 제공하며, jitter, 마커 드리프트, 핀 깨짐 등의 일반적인 버그를 해결합니다. SPA(React 등) 환경에서의 정리(cleanup)와 성능 최적화(transform/opacity만 애니메이션, will-change 설정)에 대한 모범 사례도 포함되어 있어 실무 프로젝트에 바로 적용 가능합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/nehakanjamala/personal_website/tree/HEAD/.agents/skills/gsap-web

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

GSAP for the Web

GSAP(GreenSock Animation Platform)은 코드 중심의 웹 모션을 위한 핵심 도구입니다: 순차적 타임라인, 스크롤 기반 스토리텔링, 텍스트 리빌, 레이아웃 전환을 지원합니다. GSAP 3.12+부터 모든 플러그인(ScrollTrigger, SplitText, Flip, MotionPath, MorphSVG, Draggable, Observer)은 상업적 용도를 포함해 100% 무료입니다.

사용 시기

  • 스크롤 기반 스토리텔링: 고정된 섹션, 패럴랙스, 진행률 스크러빙, 가로 스크롤
  • 순차적인 히어로 애니메이션과 정밀한 오버랩 제어가 필요한 복잡한 다중 요소 타임라인
  • 문자/단어/줄 단위로 분할된 텍스트 리빌(SplitText)
  • 요소의 위치/크기/부모가 변경되는 레이아웃 전환(Flip)
  • 세밀한 타이밍 제어, 이징 정밀도 또는 명령형 오케스트레이션이 필요한 모든 모션

설치 및 등록

import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { SplitText } from "gsap/SplitText";
import { Flip } from "gsap/Flip";

gsap.registerPlugin(ScrollTrigger, SplitText, Flip);

플러그인은 사용 전에 반드시 등록되어야 하며, 그렇지 않으면 조용히 무시됩니다. 번들러를 사용하는 경우 앱 진입점에서 한 번 등록합니다.

핵심 기술

타임라인 우선

여러 개의 독립적인 트윈보다 하나의 타임라인을 선호하세요. 하나의 재생 헤드, 상대적 위치 지정, 쉬운 역방향 전환이 가능합니다.

const tl = gsap.timeline({ defaults: { ease: "power3.out", duration: 0.6 } });
tl.from(".title", { yPercent: 100, opacity: 0 })
  .from(".sub",   { y: 20, opacity: 0 }, "-=0.3")  // 이전 트윈이 끝나기 0.3초 전 시작
  .from(".cta",   { scale: 0.9, opacity: 0 }, "<"); // 이전 트윈의 시작과 동시에 정렬

포지션 매개변수 치트 시트:

  • "+=0.5" / "-=0.3" — 타임라인 끝을 기준으로 함(간격/겹침)
  • "<" — 이전 트윈의 시작; ">" — 이전 트윈의 끝
  • "<0.2" — 이전 트윈 시작 후 0.2초
  • "myLabel" — tl.addLabel("myLabel")로 추가된 명명된 레이블 위치

진입에는 .from()(주어진 값에서 현재 CSS로 애니메이션), 퇴장에는 .to(), 양 끝이 명시적이어야 할 때는 .fromTo()를 사용하세요(재실행에 가장 강력).

gsap.to vs set vs quickTo

gsap.set(el, { autoAlpha: 0 });           // 즉시, 트윈 없음 (autoAlpha = opacity + visibility)
const xTo = gsap.quickTo(el, "x", { duration: 0.4, ease: "power3" });
window.addEventListener("pointermove", (e) => xTo(e.clientX)); // 빠른 반복 업데이트

autoAlpha는 원시 opacity보다 선호됩니다. 0일 때 visibility:hidden도 함께 전환하여 요소를 히트 테스트에서 제거하기 때문입니다.

ScrollTrigger 기본

gsap.to(".panel", {
  xPercent: -100,
  ease: "none",
  scrollTrigger: {
    trigger: ".wrap",
    start: "top top",      // 트리거 상단이 뷰포트 상단에 닿을 때
    end: "+=2000",         // 2000px의 스크롤 거리
    pin: true,             // 트윈이 재생되는 동안 .wrap 고정
    scrub: 1,              // 진행률을 스크롤바에 연결 (1 = 1초 후행 스무딩)
    markers: true,         // 개발 전용 시각적 마커 — 프로덕션에서는 제거
  },
});

핵심 의미:

  • start/end는 "triggerPos viewportPos"(예: "top center") 또는 "+=px" 형식을 취합니다.
  • scrub: true는 애니메이션 진행률을 스크롤에 정확히 고정합니다. scrub: <number>는 스무딩 지연을 추가합니다.
  • toggleActions: "play pause resume reverse"는 스크러빙되지 않은 트리거의 onEnter/onLeave/onEnterBack/onLeaveBack을 제어합니다.
  • 스크러빙된 트윈에는 ease: "none"을 사용하여 모션이 스크롤을 선형적으로 추적하도록 합니다.

스무스 스크롤 (Lenis) + ScrollTrigger

Lenis(또는 Locomotive) 스무스 스크롤을 ScrollTrigger와 함께 사용하면 동기화가 깨질 수 있습니다. Lenis는 자체 rAF에서 스크롤을 부드럽게 하고 ScrollTrigger는 GSAP의 ticker에서 스크롤을 읽기 때문입니다. 이 문제를 해결하려면 GSAP의 ticker로 Lenis를 구동하고 Lenis 스크롤마다 ScrollTrigger를 업데이트합니다.

import Lenis from "lenis";

const lenis = new Lenis({ duration: 1.2, smoothWheel: true });

lenis.on("scroll", ScrollTrigger.update);          // 1. 모든 Lenis 스크롤 시 ScrollTrigger 업데이트
gsap.ticker.add((t) => lenis.raf(t * 1000));       // 2. 하나의 루프: ticker가 Lenis 구동 (초 → 밀리초)
gsap.ticker.lagSmoothing(0);                        // 3. 무거운 프레임에서 GSAP 따라잡기 지터 중지

중요: gsap.ticker는 시간을 초 단위로 전달하고, lenis.raf()는 밀리초를 필요로 하므로 1000을 곱합니다. Lenis를 위해 독립적인 requestAnimationFrame(raf) 루프를 실행하지 마십시오. 이중 구동이 됩니다.

일반적인 버그:

  • 지터/스터터 — ticker와 경쟁하는 남은 requestAnimationFrame(raf) 루프 또는 lagSmoothing(0) 누락. 잘못된 루프를 제거하고 지연 스무딩을 0으로 설정합니다.
  • 마커가 트리거에서 드리프트 — ScrollTrigger.update가 lenis.on("scroll", …)에 구독되지 않음.
  • 핀 깨짐 — Lenis에서는 scrollerProxy를 설정하지 마십시오(문서를 스크롤합니다). Locomotive에서는 scrollerProxy + pinType을 연결하고 모든 트리거에 scroller:를 설정해야 합니다.
  • 스크롤 멈춤/방향 반전 — * 1000 단위 변환 누락 또는 순서가 잘못된 두 루프.

SPA 언마운트 시 정리: gsap.ticker.remove(update) + lenis.destroy(), 그렇지 않으면 루프가 탐색당 쌓입니다. prefers-reduced-motion 뒤에 게이트합니다(Lenis 건너뛰고 네이티브 스크롤 실행). 전체 Lenis + Locomotive 연결, 앵커 링크 라우팅, data-lenis-prevent, React (useGSAP/useEffect) 및 증상→원인 표는 references/scrolltrigger-lenis.md에 있습니다.

SplitText (텍스트 리빌)

const split = SplitText.create(".headline", { type: "lines, words", linesClass: "line" });
gsap.from(split.lines, { yPercent: 100, opacity: 0, stagger: 0.08, duration: 0.7, ease: "power4.out" });

주의사항:

  • 라인 마스크 리빌: 라인 래퍼에 overflow: hidden을 설정하여 yPercent: 100이 깔끔하게 숨겨지도록 합니다. autoSplit: true(GSAP 3.13+)를 추가하여 글꼴 로드/리사이즈 시 다시 분할합니다.
  • 다시 분할하거나 언마운트하기 전에 split.revert()를 호출하여 원래 DOM을 복원하고 중복 노드를 방지합니다.
  • 잘못된 줄 바꿈을 방지하려면 항상 웹 글꼴 로드 후(document.fonts.ready.then(...)) SplitText를 수행합니다.

Flip (레이아웃 전환)

Flip은 상태를 기록하고, DOM을 즉시 변경한 다음, 시각적 차이를 애니메이션합니다(FLIP 기술). 그리드<->목록, 확장 카드, 재부모화에 이상적입니다.

const state = Flip.getState(".item");   // 1. BEFORE 캡처
container.classList.toggle("grid");      // 2. DOM/CSS 변경 (즉시)
Flip.from(state, {                        // 3. 델타 애니메이션
  duration: 0.6, ease: "power2.inOut", stagger: 0.05,
  absolute: true,                         // 이동 중 요소를 흐름에서 제외 (리플로우 지터 방지)
});

이징 빠른 가이드

  • power2/3.out — 진입(빠르게 정착)
  • power2.inOut — 두 화면 상태 간 이동
  • back.out(1.7) — 오버슈트/팝(숫자는 오버슈트 양)
  • elastic.out(1, 0.3) — 탄력적, 드물게 사용
  • none — 스크러빙된 스크롤 트윈
  • steps(n) — 스프라이트/단계별 모션
  • 사용자 정의 cubic-bezier 동등: CustomEase.create("x", "M0,0 C0.2,0 0,1 1,1")(CustomEase는 무료)

성능 및 정리

  • transform(x/y/xPercent/scale/rotation) 및 opacity만 애니메이션합니다. GPU 합성되며 레이아웃/페인트를 건너뜁니다. top/left/width/height 애니메이션은 피하십시오.
  • 무거운/고정된 요소에 will-change: transform을 설정하고, 이후에 제거합니다.
  • 요소당 하나의 트리거 대신 ScrollTrigger.batch()를 사용하여 유사한 스크롤 리빌을 일괄 처리합니다.
  • 뷰포트/콘텐츠 변경 후 ScrollTrigger.refresh()를 호출합니다.

SPA/프레임워크 정리는 필수입니다. 고아 트리거는 메모리 누수와 유령 고정을 유발합니다. gsap.context()(또는 @gsap/react의 useGSAP)를 사용하십시오:

useEffect(() => {
  const ctx = gsap.context(() => {
    // 모든 gsap + ScrollTrigger 코드 여기에
  }, rootRef);
  return () => ctx.revert(); // 트윈, 트리거를 종료하고 인라인 스타일 되돌림
}, []);

전달 및 검증 (독립형 HTML)

패키징된 헬퍼 (scripts/): scripts/seek-shot.sh anim.html 0 1.5 3은 ?t=N 하네스를 고정하고 각 순간을 스크린샷합니다. scripts/contact-sheet.sh sheet.png frame-*.png는 한눈에 검토할 수 있도록 타일링합니다. scripts/README.md 참조.

자체 포함 애니메이션(히어로, 리빌, 루프, 마이크로 신)의 전달물은 브라우저에서 직접 열리는 하나의 HTML 파일입니다 — 빌드 단계, 프레임워크, 렌더 파이프라인이 필요 없습니다. 하나의 파일이 작업을 처리할 수 있을 때 번들러에 의존하지 마십시오; 웹 모션에 적절한 계층입니다.

출력 계약:

  • 하나의 .html 파일: CDN의 GSAP + 플러그인, 마크업, 인라인 <script>의 애니메이션.
  • 모든 모션은 하나의 마스터 타임라인(const tl = gsap.timeline())에 있습니다 — 검색 가능한 단일 재생 헤드.
  • 아래 검색 하네스를 포함하여 모든 순간을 검사용으로 고정할 수 있습니다.

검색 하네스 — 정확한 순간을 스크린샷용으로 고정. 비디오 플레이어의 프레임 고정과 동등한 웹: ?t=N은 마스터 타임라인을 N초로 검색하고 일시 정지하여 스크린샷이 정적이고 결정적인 프레임에 안착하도록 합니다.

<script>
  // ... 마스터 타임라인을 `tl`로 빌드 ...
  const t = new URLSearchParams(location.search).get("t");
  if (t !== null) { tl.pause(); tl.seek(parseFloat(t)); }  // t초에 고정
  // ?t 없음 → 정상 재생
  window.__ready = true;            // 헤드리스 대기를 위한 준비 신호
  console.log("duration", tl.duration());
</script>

검증 루프 — 렌더링 → 고정 → 스크린샷 → 확인:

  1. 타임라인의 세 지점(시작, 중간, 끝)에서 파일을 엽니다: …/anim.html?t=0, ?t=<dur/2>, ?t=<dur>. 콘솔에서 tl.duration()을 읽어 종료 시간을 확인합니다.
  2. 각 고정된 프레임을 스크린샷합니다.
  3. 충실도(브리프와 일치하는가?)와 아티팩트(잘린 텍스트, 캔버스 밖 요소, 글꼴 로드 전 FOUC, 이음새 지터)를 확인합니다. 출력은 의도적이고 완성된 것으로 보여야 합니다.

모든 헤드리스 스크린샷 도구가 작동합니다 — 에이전트의 브라우저 도구 또는 Playwright:

npx playwright screenshot --wait-for-timeout=500 "file://$PWD/anim.html?t=1.2" frame-mid.png

완료 전 확인:

  1. 브라우저에서 독립적으로 열림 — 콘솔 오류 없음, 누락된 CDN 없음.
  2. 모든 애니메이션이 하나의 마스터 타임라인에 있음; ?t=N이 올바르게 고정됨.
  3. 시작/중간/끝에서 스크린샷됨 — 브리프와 일치, 아티팩트 없음.
  4. prefers-reduced-motion 준수(타임라인이 간소화되거나 건너뜀).
  5. 이징이 의도적임 — 공간 모션에 우발적인 linear 없음.

하네스가 연결된 완전한 실행 가능 템플릿은 examples/standalone-template.html에 있습니다.

빠른 참조

목표API
겹침이 있는 시퀀스tl.from(...).from(..., "-=0.3")
스크롤 중 고정scrollTrigger:{ pin:true, end:"+="N" }
스크롤에 스크러빙scrollTrigger:{ scrub:1, ease:"none" }
텍스트 줄 리빌SplitText.create(el,{type:"lines"})
레이아웃 변경 애니메이션Flip.getState → 변이 → Flip.from
빠른 포인터 추종gsap.quickTo(el,"x",{...})
모든 것 종료ScrollTrigger.getAll().forEach(t=>t.kill())

참조 파일

  • references/scrolltrigger-cookbook.md — 핀, 스크러빙, 가로 스크롤, 스냅, ScrollTrigger.batch() 리빌, 패럴랙스, 중첩 트리거 및 전체 코드가 포함된 SPA 정리 패턴.
  • references/scrolltrigger-lenis.md — 전체 ScrollTrigger + Lenis/Locomotive 스무스 스크롤 동기화: 표준 연결, scrollerProxy, 앵커 링크, 축소 모션, React (useGSAP/useEffect), 디버깅 체크리스트 및 증상→원인 표.
  • examples/hero-timeline.js — SplitText, 지연 리빌 및 축소 모션 처리가 포함된 완전하고 실행 가능한 히어로 진입 타임라인.
  • examples/standalone-template.html — 전달 템플릿: 자체 포함(CDN GSAP), 하나의 마스터 타임라인, 스크린샷 확인을 위한 ?t=N 검색 하네스 및 축소 모션 처리.

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

nehakanjamala/personal_website

This skill should be used when the user asks to "fix janky CSS animation", "make animation 60fps", "stop layout thrashing", "animate width/height/top/left smoothly", "convert animation to transform", "animate box-shadow performantly", "animate height auto", "FLIP animation", or "why is my scroll/hover animation choppy".

nehakanjamala/personal_website

This skill should be used when the user asks to "respect prefers-reduced-motion", "honor reduced motion", "make my animations accessible", "fix vestibular / motion-sickness issues", "add a useReducedMotion hook", "gate GSAP / Framer Motion / Lenis for reduced motion", or "meet WCAG 2.3.3 / C39". Provides tiered (not all-or-nothing) reduced-motion patterns in CSS and JS.

nehakanjamala/personal_website

Create, modify, debug, and deploy Apify Actors, and write their input and output schemas. Use when building an Actor from scratch, changing or troubleshooting Actor code, generating or updating .actor schema files, or pushing an Actor to the Apify platform. To wrap an existing non-Actor project, use apify-actorization instead.

nehakanjamala/personal_website

Convert existing projects into Apify Actors - serverless cloud programs. Actorize JavaScript/TypeScript (SDK with Actor.init/exit), Python (async context manager), or any language (CLI wrapper). Use when migrating code to Apify, wrapping CLI tools as Actors, or adding Actor SDK to existing projects.

nehakanjamala/personal_website

Deprecated. Output schema generation moved to the apify-actor-development skill; prefer that skill whenever it is available.

nehakanjamala/personal_website

Design and build an official Apify integration for a company's product - workflow-automation apps (Zapier/n8n-style), AI agent plugins (coding-agent skills+MCP bundles or OpenClaw/Hermes-style harnesses), AI framework packages (LangChain/LlamaIndex-style), or direct application clients via apify-client. Use when planning, creating, or reviewing an integration that exposes Apify Actors, runs, datasets, or key-value stores inside another product.

nehakanjamala/personal_website

Universal AI-powered web scraper for any platform. Scrape data from Instagram, Facebook, TikTok, YouTube, LinkedIn, X/Twitter, Google Maps, Google Search, Google Trends, Reddit, Airbnb, Yelp, and 15+ more platforms. Use for lead generation, brand monitoring, competitor analysis, influencer discovery, trend research, content analytics, audience analysis, review analysis, SEO intelligence, recruitment, or any data extraction task.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a glassmorphism effect", "frosted glass UI", "Apple liquid glass style", "frosted blur card", "translucent glass panel animation", "make a frosted nav bar", "build a glass modal/dialog", "animate a glass card on hover", or "add a refracting liquid-glass hero". Covers frosted translucent panels with backdrop-filter blur, edge/specular highlights, SVG liquid-glass refraction, motion on hover/scroll/enter, and accessible reduced-transparency fallbacks.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a Lottie animation", "play a .lottie or .json animation", "integrate a Bodymovin/After Effects animation on web or mobile", "control Lottie playback / segments", "make a scroll-driven Lottie", "recolor a Lottie at runtime", or "export an AE animation to Lottie". Covers dotLottie/lottie-web integration, playback control, interactivity, theming, and the AE export checklist.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a hover/press effect", "animate a toggle or switch", "build an animated like button", "make a toast/snackbar slide in", "animate a drawer or modal", "animate list reordering or add/remove", "do a shared-element layout transition", or "polish UI feedback". Covers UI motion with Framer Motion (motion/react) and modern CSS.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate page or route transitions", "add a page transition or crossfade between views", "animate route changes in Next.js App Router", "use the View Transitions API", "AnimatePresence exit doesn't fire on navigation", or "Framer Motion exit animation not working / exit animation before unmount in Next.js". Covers enter/exit page-transition animation with the View Transitions API and Framer Motion, for Next.js App Router and general SPA routing.

nehakanjamala/personal_website

Scrape web pages using Scrapling with anti-bot bypass (like Cloudflare Turnstile), stealth headless browsing, spiders framework, adaptive scraping, and JavaScript rendering. Use when asked to scrape, crawl, or extract data from websites; web_fetch fails; the site has anti-bot protections; write Python code to scrape/crawl; or write spiders.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate an SVG", "make a line draw itself on", "do a stroke draw-on / signature animation", "morph one shape into another", "move an element along a path", "animate an icon/logo", or "animate an SVG gradient or filter". Covers stroke-dashoffset draw-on, path morphing, motion-along-path, and animated icons/gradients/filters via CSS, SMIL, and GSAP.

관련 스킬