Files
4ee01c25-ab9b-4ed3-8df7-869…/.claude/skills/add-animation/SKILL.md
kudinDmitriyUp fb912fcc0b Initial commit
2026-05-08 19:18:30 +00:00

42 lines
1.2 KiB
Markdown

---
name: add-animation
description: Add animation to a component with proper setup and cleanup
disable-model-invocation: true
---
# Add Animation
Add animation to: $ARGUMENTS
## Process
1. **Choose animation library**
- GSAP: Complex timelines, ScrollTrigger, text splitting
- Framer Motion: Simple component animations, gestures, layout
- CSS: Basic transitions, hover states
2. **For GSAP animations**
- Register plugins at file level
- Use `gsap.context()` for cleanup
- Return `() => ctx.revert()` from useEffect
- Use refs for target elements
3. **For Framer Motion**
- Wrap conditionally rendered elements in `AnimatePresence`
- Add `key` prop for AnimatePresence children
- Use `initial`, `animate`, `exit` props
4. **For scroll-triggered animations**
- Set appropriate `start` and `end` points
- Use `toggleActions` for replay behavior
- Consider mobile: disable or simplify
5. **Performance considerations**
- Use transform properties (x, y, scale, rotation)
- Add `force3D: true` for GPU acceleration
- Check if animation should be disabled on mobile
## Output
Show the implemented animation code with proper cleanup.