Animationen hinzufügen (PFLICHT)
Jede Komponente MUSS Framer Motion Animationen haben.
APEX-WORKFLOW
Phase 0: VORHANDENE ANIMATIONEN ANALYSIEREN
Task: explore-codebase
Prompt: "Finde bestehende Framer Motion Muster: Varianten, Timing,
Easing, Hover-Effekte. Berichte über Animationskonventionen."
REGEL: Entweder vorhandene Animationsmuster übernehmen ODER eine Migration vorschlagen.
Standardmuster
Container + Stagger (ERFORDERLICH)
import { motion } from "framer-motion";
const container = {
hidden: { opacity: 0 },
show: { opacity: 1, transition: { staggerChildren: 0.1 } }
};
const item = {
hidden: { opacity: 0, y: 20 },
show: { opacity: 1, y: 0 }
};
<motion.div variants={container} initial="hidden" animate="show">
<motion.div variants={item}>Element 1</motion.div>
<motion.div variants={item}>Element 2</motion.div>
</motion.div>
Hover-Effekte (ERFORDERLICH)
// Card Hover
<motion.div whileHover={{ y: -4 }} transition={{ duration: 0.2 }}>
// Button Hover
<motion.button
whileHover={{ scale: 1.02 }}
whileTap={{ scale: 0.98 }}
>
Scroll-Animation
<motion.div
initial={{ opacity: 0, y: 40 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-100px" }}
/>
Zeitrichtlinien
| Interaktion | Dauer | Easing |
|---|---|---|
| Hover | 50-100 ms | ease-out |
| Button drücken | 100-150 ms | ease-out |
| Modal öffnen | 200-300 ms | ease-out |
| Seitenwechsel | 300-400 ms | ease-in-out |
VERBOTEN
// ❌ Zufällige Hüpfschleifen
animate={{ y: [0, -10, 0] }}
transition={{ repeat: Infinity }}
// ❌ Übermäßige Effekte
whileHover={{ scale: 1.2, rotate: 5 }}
// ❌ Langsame Animationen
transition={{ duration: 1.5 }}
Barrierefreiheit (PFLICHT)
import { useReducedMotion } from "framer-motion";
function Komponente() {
const shouldReduce = useReducedMotion();
return (
<motion.div
animate={shouldReduce ? {} : { y: 0 }}
transition={shouldReduce ? { duration: 0 } : { duration: 0.3 }}
/>
);
}
Validierung
[ ] Vorhandene Animationen analysiert (Phase 0)
[ ] Muster entsprechen bestehenden ODER Migration vorgeschlagen
[ ] Stagger bei Listen/Rastern
[ ] Hover auf allen interaktiven Elementen
[ ] prefers-reduced-motion beachtet
[ ] Keine übermäßigen/zufälligen Animationen
Referenzen
- APEX Motion:
references/design/05-add-motion.md - Motion Patterns:
references/motion-patterns.md