Loading...
Loading...
Official Framer Motion skill for animation variants — state machines, orchestrated animations, stagger, repeat, sequencing. Use when building orchestrated animations, animation state machines, staggered entrances, or when asking about Framer Motion variants, transition variants, or choreographed animations.
npx skill4agent add c-jeril/framer-motion-skills framer-motion-variantsconst container = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1
}
}
};
const item = {
hidden: { opacity: 0, y: 20 },
visible: { opacity: 1, y: 0 }
};
function Component() {
return (
<motion.div
variants={container}
initial="hidden"
animate="visible"
>
{[1, 2, 3].map(i => (
<motion.div key={i} variants={item} />
))}
</motion.div>
);
}const variants = {
initial: { opacity: 0 },
animate: { opacity: 1 },
exit: { opacity: 0 }
};const variants = {
animate: (custom) => ({
x: custom * 100,
opacity: 1
})
};const container = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1,
delayChildren: 0.2
}
}
};transition: {
staggerChildren: 0.1,
staggerDirection: -1 // 1 = forward, -1 = backward
}const variants = {
animate: {
scale: [1, 1.5, 1],
transition: {
duration: 2,
repeat: Infinity,
repeatType: "loop" // "loop" | "reverse" | "mirror"
}
}
};| Type | Behavior |
|---|---|
| Restart from beginning |
| Play forward then backward |
| Swap states on each repeat |
<motion.div
animate={{
x: [0, 100, -50, 0],
backgroundColor: ["#ff0000", "#00ff00", "#0000ff"]
}}
transition={{
duration: 2,
times: [0, 0.3, 0.6, 1]
}}
/>const states = {
idle: { scale: 1 },
hovered: { scale: 1.1 },
pressed: { scale: 0.95 }
};
function Component({ state }) {
return (
<motion.div
variants={states}
animate={state}
custom={state}
/>
);
}const container = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1,
when: "beforeChildren"
}
}
};
const child = {
hidden: { x: -20, opacity: 0 },
visible: {
x: 0,
opacity: 1,
transition: { duration: 0.3 }
}
};custom