Ajout d'animations (OBLIGATOIRE)
Chaque composant DOIT avoir des animations Framer Motion.
FLUX DE TRAVAIL APEX
Phase 0 : ANALYSER LES ANIMATIONS EXISTANTES
Tâche : explorer-codebase
Invite : "Trouver les motifs Framer Motion existants : variantes, temporisation, easing, effets de survol. Signaler les conventions d'animation."
RÈGLE : Correspondre aux motifs d'animation existants OU proposer une migration.
Motifs standard
Conteneur + Stagger (REQUIS)
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}>Élément 1</motion.div>
<motion.div variants={item}>Élément 2</motion.div>
</motion.div>
Effets de survol (REQUIS)
// Survol de carte
<motion.div whileHover={{ y: -4 }} transition={{ duration: 0.2 }}>
// Survol de bouton
<motion.button
whileHover={{ scale: 1.02 }}
whileTap={{ scale: 0.98 }}
>
Animation de défilement
<motion.div
initial={{ opacity: 0, y: 40 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-100px" }}
/>
Directives de temporisation
| Interaction | Durée | Easing |
|---|---|---|
| Survol | 50-100ms | ease-out |
| Appui sur bouton | 100-150ms | ease-out |
| Ouverture de modale | 200-300ms | ease-out |
| Transition de page | 300-400ms | ease-in-out |
INTERDIT
// ❌ Boucles de rebond aléatoires
animate={{ y: [0, -10, 0] }}
transition={{ repeat: Infinity }}
// ❌ Effets excessifs
whileHover={{ scale: 1.2, rotate: 5 }}
// ❌ Animations lentes
transition={{ duration: 1.5 }}
Accessibilité (OBLIGATOIRE)
import { useReducedMotion } from "framer-motion";
function Component() {
const shouldReduce = useReducedMotion();
return (
<motion.div
animate={shouldReduce ? {} : { y: 0 }}
transition={shouldReduce ? { duration: 0 } : { duration: 0.3 }}
/>
);
}
Validation
[ ] Animations existantes analysées (Phase 0)
[ ] Motifs correspondants existants OU migration proposée
[ ] Stagger sur les listes/grilles
[ ] Survol sur tous les éléments interactifs
[ ] prefers-reduced-motion respecté
[ ] Pas d'animations excessives/aléatoires
Références
- APEX Motion :
references/design/05-add-motion.md - Motifs de mouvement :
references/motion-patterns.md