--- name: framer-motion-interactive-animation description: | Framer Motion animations: motion components, gestures (hover/tap), entrance/exit, scroll triggers, and performance. Keywords: "animate", "animation", "framer motion", "hover", "scroll", "whileHover", "AnimatePresence" --- # Framer Motion Interactive Animation ## motion Component Convert any element to animatable: \`\`\`tsx 'use client'; import { motion } from 'framer-motion'; \`\`\` ## Gesture Animations ### Hover/Tap Effects \`\`\`tsx Click Me \`\`\` ## Entrance Animations \`\`\`tsx Fades in and slides up \`\`\` ## Exit Animations **CRITICAL**: Must wrap in \`\` \`\`\`tsx import { motion, AnimatePresence } from 'framer-motion'; {isVisible && ( Content with exit animation )} \`\`\` ## Scroll-Triggered Animations \`\`\`tsx Appears when scrolled into view \`\`\` ## Transition Options \`\`\`tsx // Spring (physics-based) transition={{ type: "spring", stiffness: 300, damping: 30 }} // Tween (duration-based) transition={{ duration: 0.3, ease: "easeInOut" }} \`\`\` ## Performance Best Practices ✅ **Animate**: \`transform\` (x, y, scale, rotate), \`opacity\` ❌ **Don't animate**: width, height, margin, padding (causes reflow) ✅ Use \`viewport={{ once: true }}\` for scroll animations ❌ Forget \`\` for exit animations --- **Token Estimate**: ~2,200 tokens