← Zurück zu Web-App-Entwickler

Skill · Version 1.0.0

GSAP-Zeitleistenanimation

Koordiniert mehrere Elemente mit wiederverwendbaren Zeitleisten, vorhersehbaren Unterbrechungen und sauberem Komponentenabbau.

gsap-timeline-animation

Teammitglieder mit diesem Skill

Entdecke, wie der Skill hilft

Wann ist der Skill hilfreich?

Nutze diesen Skill für vorhandene GSAP-Choreografie oder umkehrbare Interaktionen jenseits einfacher Übergänge.

Wobei hilft er dir?

  • Verwendet Zeitleistenpositionen statt fragiler Verzögerungsketten.
  • Verhindert festhängende Zwischenzustände bei wiederholten Auslösern.
  • Begrenzt Animationen auf Komponenten und berücksichtigt reduzierte Bewegung.

Das könntest du fragen

Animiere unser ausklappbares Panel mit umkehrbarer Zeitleiste für schnelle Klicks, Größenwechsel und Entfernung. Kehre die Öffnung halbwegs um und aktiviere reduzierte Bewegung. Das Panel erreicht den gewünschten Endzustand ohne gestapelte Timelines oder unsichtbare interaktive Inhalte.

Ausführliche Dokumentation

Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.

Details…Weniger anzeigen

GSAP & Timeline Animation

Use GSAP when a project already includes it or when a multi-element choreographed sequence, reversible timeline, or scrubbed scroll scene exceeds what CSS and basic WAAPI handle cleanly.

Core Timeline & Property Discipline

  1. Prefer transform shorthands and autoAlpha:
    • Animate x, y, xPercent, yPercent, scale, rotation, and autoAlpha (opacity + automatic visibility: hidden when opacity reaches 0 so invisible elements never block clicks).
    • Register plugins (ScrollTrigger, Flip, useGSAP) once at module initialization with gsap.registerPlugin(...).
  2. Timelines over fragile delay chains:
    • Coordinate multi-step sequences with gsap.timeline({ defaults: { duration: 0.5, ease: 'power2.out' } }) and position parameters ("<", ">" , "-=0.15", "<0.08", or named .addLabel('reveal')). Changing step 1's duration then shifts all downstream steps automatically.
  3. Avoid .from() flash of unstyled content (FOUC) & re-trigger traps:
    • Calling gsap.from(el, { opacity: 0, y: 24 }) repeatedly on rapid user clicks captures the current mid-tween value as the destination state, leaving elements stuck semi-transparent!
    • For re-triggerable interactions, use .fromTo(el, { autoAlpha: 0, y: 24 }, { autoAlpha: 1, y: 0, overwrite: 'auto' }) or control a persistent timeline instance (tl.play() / tl.reverse()).

Scoped Cleanup & Responsive Accessibility (gsap.context & gsap.matchMedia)

Never leave loose global selector tweens (gsap.to('.card', ...)) that leak across component unmounts or affect unrelated DOM instances:

// Scope selectors to the component container and handle responsive + reduced-motion rules cleanly
const mm = gsap.matchMedia(containerEl);

mm.add(
  {
    isDesktop: '(min-width: 768px)',
    isMobile: '(max-width: 767px)',
    reduceMotion: '(prefers-reduced-motion: reduce)',
  },
  (context) => {
    const { isDesktop, reduceMotion } = context.conditions!;
    if (reduceMotion) {
      gsap.set('.stage-card', { autoAlpha: 1, y: 0, clearProps: 'transform' });
      return;
    }
    const tl = gsap.timeline({
      scrollTrigger: {
        trigger: containerEl,
        start: 'top 75%',
        end: 'bottom 25%',
        toggleActions: 'play none none reverse',
      },
    });
    tl.from('.stage-card', {
      y: isDesktop ? 32 : 16,
      autoAlpha: 0,
      stagger: 0.08,
      duration: 0.55,
      ease: 'power3.out',
    });
  },
);

// On component unmount / teardown:
mm.revert(); // Reverts all tweens, inline styles, and ScrollTriggers created inside!

ScrollTrigger Guardrails

  • Never attach scrollTrigger to a child tween inside a timeline: A tween cannot be controlled by both a parent timeline's playhead and the scrollbar simultaneously. Attach scrollTrigger to the top-level gsap.timeline({ scrollTrigger: { ... } }).
  • Refresh after layout shifts: Call ScrollTrigger.refresh() after async data loads, accordion expansions, image decodes, or webfont readiness so cached start/end scroll offsets stay accurate.

Enthaltene Dateien 1

  • SKILL.md