Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

gsap

/gsap

Wspiera pracę z GSAP (GreenSock), silnikiem animacji JavaScript: tweeny, easing, osie czasu, ScrollTrigger i hook useGSAP w React, także przy sekwencjach sterowanych przewijaniem.

Licencja
MIT
Ostatnia zmiana repozytorium
21.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 21.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wspiera pracę z GSAP (GreenSock), silnikiem animacji JavaScript: tweeny, easing, osie czasu, ScrollTrigger i hook useGSAP w React, także przy sekwencjach sterowanych przewijaniem.

Wyzwalacze z opisu

GSAPGreenSockScrollTriggeruseGSAPtimeline animationtween
Oryginalny opis (EN)

GSAP (GreenSock Animation Platform) — high-performance JavaScript animation engine with a plugin ecosystem. Covers tweens, easing, timelines, ScrollTrigger and the useGSAP React hook. USE WHEN: user mentions "GSAP", "GreenSock", "ScrollTrigger", "useGSAP", "timeline animation", "tween", asks about scroll-driven sequences or complex animation choreography DO NOT USE FOR: React-idiomatic declarative animation (use `framer-motion`), SVG path morphing basics (use `svg-animation`), 3D scenes (use `three-js`)

Jak działa

  1. Install
  2. Core API
  3. Tween Properties
  4. Easing Reference
  5. Timeline
  6. ScrollTrigger
  7. React Integration — useGSAP hook
  8. Context (manual cleanup without useGSAP)
  9. Stagger
  10. SVG Path Draw (manual, no plugin)
Sekcje z nagłówków SKILL.md, w oryginale · 205 linii, 751 słów
Podgląd SKILL.md
---
name: gsap
description: |
  GSAP (GreenSock Animation Platform) — high-performance JavaScript animation
  engine with a plugin ecosystem. Covers tweens, easing, timelines, ScrollTrigger
  and the useGSAP React hook.

  USE WHEN: user mentions "GSAP", "GreenSock", "ScrollTrigger", "useGSAP", "timeline animation", "tween", asks about scroll-driven sequences or complex animation choreography

  DO NOT USE FOR: React-idiomatic declarative animation (use `framer-motion`), SVG path morphing basics (use `svg-animation`), 3D scenes (use `three-js`)
allowed-tools: Read, Grep, Glob, Write, Edit
---
# GSAP Skill

GreenSock Animation Platform — high-performance JS animation engine with plugin ecosystem.

## Install

```bash
npm install gsap
# Plugins (ScrollTrigger free, others require club membership):
# ScrollTrigger, Flip, Observer, ScrollSmoother — included in gsap package
```

## Core API

```ts
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { Flip } from "gsap/Flip";
gsap.registerPlugin(ScrollTrigger, Flip);
```

| Method | Purpose |
|--------|---------|
| `gsap.to(target, vars)` | Animate FROM current state TO vars |
| `gsap.from(target, vars)` | Animate FROM vars TO current state |
| `gsap.fromTo(target, from, to)` | Explicit start and end |
| `gsap.set(target, vars)` | Instant set, no animation |
| `gsap.timeline(vars)` | Sequence multiple tweens |
| `gsap.context(fn, scope)` | Scope cleanup (React) |
| `gsap.matchMedia()` | Responsive animations |

## Tween Properties

```ts
gsap.to(".box", {
  x: 100,           // translateX (px)
  y: -50,           // translateY
  rotation: 360,    // degrees
  scale: 1.5,
  opacity: 0,
  duration: 1,
  delay: 0.2,
  ease: "power2.out",
  stagger: 0.1,     // when targeting multiple elements
  repeat: -1,       // -1 = infinite
  yoyo: true,       // reverse on repeat
  onComplete: () => console.log("done"),
});
```

## Easing Reference

| Ease | Character |
|------|-----------|
| `power1-4.in/out/inOut` | Polynomial — power2.out is the go-to |
| `elastic.out(1, 0.3)` | Springy bounce |
| `back.out(1.7)` | Slight overshoot |
| `bounce.out` | Ball bounce |
| `circ.out` | Circular — sharp deceleration |
| `expo.out` | Dramatic fast-to-slow |
| `none` / `linear` | Constant speed |

## Timeline

```ts
const tl = gsap.timeline({ defaults: { ease: "power2.out", duration: 0.5 } });

tl.from(".hero-title",    { opacity: 0, y: 60 })
  .from(".hero-subtitle", { opacity: 0, y: 40 }, "-=0.3")   // 0.3s overlap
  .from(".hero-cta",      { opacity: 0, scale: 0.9 }, "+=0.1") // 0.1s gap
  .from(".hero-image",    { opacity: 0, x: 60 }, "<0.2");    // same start as prev + 0.2

// Position parameter:
// "<"   = same start as previous
// ">"   = end of previous
// "+=n" = n seconds after end
// "-=n" = n seconds before end
// "1.5" = absolute time in timeline
```

## ScrollTrigger

```ts
gsap.to(".panel", {
  xPercent: -100 * (panels.length - 1),
  ease: "none",
  scrollTrigger: {
    trigger: ".scroll-container",
    pin: true,           // pins the trigger element during scroll
    scrub: 1,            // smooth scrubbing (lag in seconds)
    snap: 1 / (panels.length - 1),
    end: () => `+=${containerRef.current?.offsetWidth}`,
  }
});

// Callbacks
ScrollTrigger.create({
  trigger: "#section",
  start: "top 80%",
  end: "bottom 20%",
  onEnter: () => console.log("entered"),
  onLeave: () => console.log("left"),
  onEnterBack: () => console.log("entered back"),
  markers: process.env.NODE_ENV === "development", // visual debug markers
});
```

## React Integration — useGSAP hook

```tsx
import { useGSAP } from "@gsap/react";
import gsap from "gsap";
import { useRef } from "react";

gsap.registerPlugin(useGSAP);

function AnimatedHero() {
  const containerRef = useRef<HTMLDivElement>(null);

  useGSAP(() => {
    // All GSAP code here is automatically cleaned up on unmount
    gsap.from(".title", { opacity: 0, y: 60, duration: 0.8, ease: "power3.out" });
  }, { scope: containerRef }); // scope = only select within containerRef

  return (
    <div ref={containerRef}>
      <h1 className="title">Hello</h1>
    </div>
  );
}
```

## Context (manual cleanup without useGSAP)

```tsx
useEffect(() => {
  const ctx = gsap.context(() => {
    gsap.from(".item", { opacity: 0, stagger: 0.1 });
  }, containerRef);

  return () => ctx.revert(); // kills all tweens created in context
}, []);
```

## Stagger

```ts
gsap.from(".card", {
  opacity: 0, y: 30,
  stagger: {
    amount: 0.6,         // total time spread across all elements
    from: "center",      // start: "start" | "end" | "center" | "random" | index
    ease: "power2.inOut",
    grid: [3, 4],        // for grid layouts
  }
});
```

## SVG Path Draw (manual, no plugin)

```ts
function animatePath(el: SVGPathElement) {
  const len = el.getTotalLength();
  gsap.set(el, { strokeDasharray: len, strokeDashoffset: len });
  gsap.to(el, { strokeDashoffset: 0, duration: 2, ease: "power2.inOut" });
}
```

## matchMedia (responsive)

```ts
const mm = gsap.matchMedia();

mm.add("(min-width: 768px)", () => {
  gsap.from(".title", { x: -100, opacity: 0 });
});

mm.add("(max-width: 767px)", () => {
  gsap.from(".title", { y: 40, opacity: 0 });
});

// Cleanup:
return () => mm.revert();
```

## Reduced Motion

```ts
const prefersReduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;

gsap.to(".element", {
  x: prefersReduced ? 0 : 200,
  duration: prefersReduced ? 0 : 1,
  opacity: 1,
});
```

## Pitfalls

- Always `ctx.revert()` or use `useGSAP` in React — GSAP tweens survive component unmount otherwise
- `scrub: true` = hard sync with scroll; `scrub: 1` = 1s lag (smoother)
- `pin: true` — the trigger element must have explicit height for the pinned section to work
- Avoid `document.querySelector` inside components — use refs with `gsap.context(scope)`
- `ScrollTrigger.refresh()` after dynamic content loads (images, fonts)

Wersje

RepozytoriumWynikLicencja
Ta strona · claude-dev-suite/claude-dev-suite100MIT
anton-abyzov/vskill100MIT
cowork-os/cowork-os100MIT
TerminalSkills/skills100Apache-2.0
MengTo/Skills100MIT
alecs5am/ralphy100Apache-2.0
notivn/AIEVv2100MIT
dirnbauer/webconsulting-skills100MIT
contextgo/contextgo100Apache-2.0

Migawka bazy z 13.11.2026 · wersja paczki 01da7ca19b2f (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100gsap-router
    Kieruje do właściwego skilla z domeny animacji GSAP: podstawy, sekwencjonowanie, ScrollTrigger i wzorce React, przy tweenach, osiach czasu i animacjach opartych na przewijaniu.
  • 100gsap-react
    Wdraża animacje GSAP w React i Next.js przez hook useGSAP, referencje, gsap.context() i sprzątanie po odmontowaniu komponentu.
  • 100gsap-react
    Opisuje użycie GSAP w React i Next.js: hook useGSAP, refy, gsap.context() i sprzątanie przy odmontowaniu komponentu.
  • 100gsap-web
    Pomaga używać GSAP w aplikacji React lub Next.js bez wycieków: osie czasu zamiast stosów tweenów, useGSAP i kontekst do sprzątania oraz ScrollTrigger odporny na zmiany tras i układu.
  • 90gsap-suite
    Obejmuje całą bibliotekę GSAP: tweeny, timeline'y, ScrollTrigger, oficjalne wtyczki (Flip, Draggable, SplitText, ScrollSmoother), integracje z React, Vue, Svelte i Nuxt, gsap.utils oraz optymalizację wydajności.
  • 95gsap-react
    Integruje GSAP z Reactem: hook useGSAP, obsługa ref, wzorce czyszczenia i zarządzanie kontekstem przy animacjach w komponentach.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.