References (Official)
Basic Policy of This Skill
- Tool selection: Use CSS for simple animations that CSS can handle. Use GSAP when complex sequences/interactions/control are needed.
- Structure: Design in stages: Tween (single) → Timeline (sequence) → ScrollTrigger (scroll-linked).
- Performance: Assume requestAnimationFrame. Combining with CSS transition is strictly forbidden.
- License: All features became free (own license, commercial use OK) due to the 2024 Webflow partnership.
- React:
useGSAP()Hook (@gsap/react) is officially recommended. A drop-in replacement for useEffect/useLayoutEffect.
Philosophy (Decision Rules)
- Decide first whether to use CSS or GSAP — CSS is sufficient for simple effects like hover. Use GSAP when sequences/control/interactions are needed.
- Manage sequences centrally with Timeline — Control using Timeline's relative timing rather than manually calculating delays.
- Do not combine CSS transition and GSAP — Browser interruptions cause the worst performance.
- Understand the default ease (power1.out) — Easing determines the "personality" of the animation.
- ScrollTrigger is one-to-one — One animation per ScrollTrigger (combine multiple into a Timeline).
- Cleanup is mandatory — Always remove scroll/resize listeners, timers, and event handlers.
Output Format (Always in This Order)
- Recommended policy (1–3 lines)
- Reason (expressive intent / performance / maintainability)
- Design proposal (Tween/Timeline structure / Easing selection / ScrollTrigger design / React integration)
- Checklist (confirm before implementation)
- Pitfalls (to avoid)
- Next actions (order of small experiments)
Checklist
- Have you first considered whether it can be achieved with CSS? (GSAP may be overkill)
- Is CSS transition applied to the animation target element? (conflict check)
- Is the Timeline created in advance? (better performance than creating it each time it's needed)
- Are you applying ScrollTrigger individually to Tweens inside a nested Timeline?
-
will-changeAre you providing pre-optimization hints via CSS properties? - In a React environment, are you using
useGSAP()+contextSafe()? - Is there cleanup on unmount (gsap.context().revert())?
Common Pitfalls
- Combining CSS transition and GSAP (worst performance, the browser always interrupts)
- Adding a Tween to a completed Timeline (it won't be called unless re-run)
.from()Misconception (animation from specified value to current value; if incomplete, the intended endpoint is not reached)- Applying ScrollTrigger to individual Tweens within a nested Timeline (the parent Timeline and scrollbar controls conflict)
- Excessive use of animation (impressive, but too much makes the UX chaotic)
- Import mistakes in a module environment (refer to the official installation guide)
- Event handlers in a React environment without contextSafe() (cleanup does not work)