The Animation Engineer adds motion that serves the user - transitions that convey hierarchy, micro-interactions that confirm actions, and scroll experiences that guide attention. Every animation decision starts from purpose: what does this motion communicate? Decoration that doesn't communicate is noise.
Framer Motion Patterns
import { motion, AnimatePresence } from 'framer-motion';
// Page transition
const pageVariants = {
initial: { opacity: 0, y: 8 },
animate: { opacity: 1, y: 0, transition: { duration: 0.3, ease: 'easeOut' } },
exit: { opacity: 0, y: -8, transition: { duration: 0.2 } },
};
function Page({ children }: { children: React.ReactNode }) {
return (
<motion.div variants={pageVariants} initial="initial" animate="animate" exit="exit">
{children}
</motion.div>
);
}
// Staggered list - each item animates after the previous
const listVariants = {
animate: { transition: { staggerChildren: 0.05 } },
};
const itemVariants = {
initial: { opacity: 0, x: -8 },
animate: { opacity: 1, x: 0 },
};
function AnimatedList({ items }: { items: string[] }) {
return (
<motion.ul variants={listVariants} initial="initial" animate="animate">
{items.map((item, i) => (
<motion.li key={i} variants={itemVariants}>{item}</motion.li>
))}
</motion.ul>
);
}
// AnimatePresence - animate unmounting components
function Toast({ message, visible }: { message: string; visible: boolean }) {
return (
<AnimatePresence>
{visible && (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, scale: 0.95 }}
>
{message}
</motion.div>
)}
</AnimatePresence>
);
}
CSS Scroll-Driven Animations
/* Reveal on scroll - no JavaScript, no IntersectionObserver */
@keyframes reveal {
from { opacity: 0; translate: 0 24px; }
to { opacity: 1; translate: 0 0; }
}
.reveal {
animation: reveal linear both;
animation-timeline: view(); /* Linked to scroll position */
animation-range: entry 0% entry 40%; /* Plays as element enters viewport */
}
/* Sticky progress bar */
@keyframes progress {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
.progress-bar {
transform-origin: left;
animation: progress linear;
animation-timeline: scroll(root);
}
Animation Performance Rules
- Only animate
transformandopacityfor 60fps. Never animate layout properties. - Duration: interactions 150–300ms; transitions 250–400ms; never >500ms for UI feedback
- Easing: ease-out for things entering the screen (fast start, slow finish feels natural); ease-in for exiting
- Always wrap decorative animations in
@media (prefers-reduced-motion: no-preference) - Use
will-change: transformsparingly - one GPU layer per animated element maximum