motion-animations
Skill1 starsChanged 5 months agoMITView on GitHub
Use when building website animations, scroll effects, entrance reveals, layout transitions, gesture interactions, parallax, hero choreography, or any animated UI component. Auto-trigger on any website build or frontend feature that involves motion, transitions, or animated elements.
- Installs packages
In this repository20 other files it gives its agents.
- system/CLAUDE.mdCLAUDE.md
- design-sub-agentSkill
- design-taste-frontendSkill
- emil-design-engSkill
- full-output-enforcementSkill
- generate-daily-scheduleSkill
- gpt-tasteSkill
- grill-with-docsSkill
- high-end-visual-designSkill
- improve-codebase-architectureSkill
- market-researchSkill
- minimalist-uiSkill
- nodejs-expertSkill
- playwright-cliSkill
- redesign-existing-projectsSkill
- scroll-videoSkill
- skill-builderSkill
- ui-refactorSkill
- ui-ux-pro-maxSkill
- ux-heuristicsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Next.js RSC: use "use client" directive on any component with motion
- Very specific: line 18
Every HTML/SVG element has a motion.* counterpart.
- Very specific: line 48
Always set viewport={{ once: true }} unless bidirectional reveal is intentional.
- Distinctive: line 52
Use variants for coordinated parent-to-child animations:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Motion Animations
Reference skill for building production animations with the Motion library (formerly Framer Motion). Consult this before writing any animation code.
Install: npm install motion
Import: import { motion, AnimatePresence } from "motion/react"
Next.js RSC: use "use client" directive on any component with motion
Core Concept
Every HTML/SVG element has a motion.* counterpart. Animation is declarative via props:
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0 }}
transition={{ type: "spring", stiffness: 200, damping: 20 }}
/>Animatable properties: x, y, scale, rotate, opacity, filter, clipPath, backgroundColor, borderRadius, boxShadow. Height can animate to/from "auto".
Pattern Catalog
1. Entrance Animations (scroll-triggered)
The default for any element appearing on scroll:
<motion.div
initial={{ opacity: 0, y: 40 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.3 }}
transition={{ duration: 0.6, ease: "easeOut" }}
/>Always set viewport={{ once: true }} unless bidirectional reveal is intentional.
2. Staggered List Entrance
Use variants for coordinated parent-to-child animations:
const container = {
hidden: {},
visible: { transition: { staggerChildren: 0.06, delayChildren: 0.1 } }
}
const item = {
hidden: { opacity: 0, y: 16 },
visible: { opacity: 1, y: 0, transition: { type: "spring", bounce: 0.3 } }
}
<motion.ul variants={container} initial="hidden" whileInView="visible" viewport={{ once: true }}>
{items.map(i => <motion.li key={i} variants={item} />)}
</motion.ul>Children inherit initial/animate labels automatically from parent — only need variants prop.
3. Exit Animations
AnimatePresence holds elements in DOM until exit completes:
<AnimatePresence mode="wait">
{isVisible && (
<motion.div
key="unique"
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.95 }}
/>
)}
</AnimatePresence>Modes: "sync" (simultaneous), "wait" (exit before enter), "popLayout" (exiting pops out of flow).
4. Scroll-Linked Animations (parallax, progress)
const ref = useRef(null)
const { scrollYProgress } = useScroll({
target: ref,
offset: ["start end", "end start"]
})
const y = useTransform(scrollYProgress, [0, 1], ["-20%", "20%"])
<div ref={ref}>
<motion.img style={{ y }} />
</div>Offset format: "[element edge] [viewport edge]" — "start end" means element top hits viewport bottom.
Progress bar:
const { scrollYProgress } = useScroll()
<motion.div style={{ scaleX: scrollYProgress, transformOrigin: "left" }} />Clip-path reveal:
const clipPath = useTransform(scrollYProgress, [0, 0.4],
["inset(100% 0% 0% 0%)", "inset(0% 0% 0% 0%)"])
<motion.img style={{ clipPath }} />Horizontal scroll (panels):
const { scrollYProgress } = useScroll({ target: containerRef })
const x = useTransform(scrollYProgress, [0, 1], ["0%", "-75%"])
<div ref={containerRef} style={{ height: "400vh" }}>
<div style={{ position: "sticky", top: 0, overflow: "hidden" }}>
<motion.div style={{ x, display: "flex" }}>{panels}</motion.div>
</div>
</div>5. Layout Animations
Auto-animate any DOM layout change:
<motion.div layout />Shared element transitions (thumbnail to modal, tab switches):
// Grid item
<motion.div layoutId={`card-${id}`} onClick={() => setSelected(id)} />
// Expanded modal
<AnimatePresence>
{selected && <motion.div layoutId={`card-${selected}`} className="modal" />}
</AnimatePresence>Layout prop values: true (position + size), "position", "size", "preserve-aspect".
6. Gesture Animations
<motion.button
whileHover={{ scale: 1.05, backgroundColor: "#f0f0f0" }}
whileTap={{ scale: 0.97 }}
whileFocus={{ outline: "2px solid blue" }}
/>Drag:
<motion.div
drag
dragConstraints={constraintsRef}
dragElastic={0.2}
whileDrag={{ scale: 1.1, boxShadow: "0 10px 30px rgba(0,0,0,0.2)" }}
/>7. Timeline Sequences (hero choreography)
import { animate, stagger } from "motion"
const sequence = [
["nav", { opacity: 1 }, { duration: 0.5 }],
["h1", { opacity: 1, y: 0 }, { at: "<" }], // simultaneous
["p", { opacity: 1 }, { at: "+0.2" }], // 0.2s after previous
["button", { opacity: 1, scale: 1 }, { at: 2.0 }] // absolute time
]
const controls = animate(sequence)at values: "<" (with previous), "+0.5" (after previous), "<0.3" (after previous starts), 2.0 (absolute).
8. Physics Effects
Magnetic button:
const mouseX = useMotionValue(0), mouseY = useMotionValue(0)
const x = useSpring(mouseX, { stiffness: 150, damping: 15 })
const y = useSpring(mouseY, { stiffness: 150, damping: 15 })
// onMouseMove: set mouseX/Y to (cursor offset from center) * 0.3Velocity-aware skew:
const xVelocity = useVelocity(x)
const skewX = useTransform(xVelocity, [-2000, 0, 2000], [-15, 0, 15])Counter without re-renders:
const count = useMotionValue(0)
const rounded = useTransform(count, v => Math.round(v))
animate(count, 1000, { duration: 2, ease: "easeOut" })
<motion.span>{rounded}</motion.span>Transitions
| Type | Config |
| Spring | { type: "spring", stiffness: 200, damping: 20 } or { type: "spring", bounce: 0.3, duration: 0.6 } |
| Tween | { type: "tween", duration: 0.5, ease: "easeOut" } |
| Keyframes | animate={{ x: [0, 100, 50] }} with times: [0, 0.5, 1] |
| Per-property | transition={{ default: { type: "spring" }, opacity: { duration: 0.3 } }} |
Easing: "linear", "easeIn", "easeOut", "easeInOut", "circOut", "backOut", "anticipate", or [0.17, 0.67, 0.83, 0.67].
Global defaults:
<MotionConfig transition={{ duration: 0.3, ease: "easeOut" }}>
<App />
</MotionConfig>Performance Rules (non-negotiable)
- Only animate
transformandopacity— these are GPU-composited. Never animatewidth,height,top,left,padding,margin. - Use MotionValues for high-frequency updates —
useMotionValue,useTransform,useSpringbypass React renders entirely. Use these for scroll, drag, and mouse-tracking effects. - Set
viewport={{ once: true }}on scroll-triggered animations unless bidirectional is intentional. - Use
initial={false}to skip entrance animations on SSR/first render. - Wrap app in
<MotionConfig reducedMotion="user">for accessibility.
Bundle optimization: Full motion is ~34kb. Use LazyMotion + m component for lighter builds (4.6kb + lazy features).
API Quick Reference
| Hook/Component | Purpose |
motion.div | Declarative animation component |
AnimatePresence | Mount/unmount transitions |
useScroll | Scroll position tracking |
useTransform | Map/derive MotionValues |
useMotionValue | Reactive primitive (no re-renders) |
useSpring | Spring-physics MotionValue |
useVelocity | Track rate of change |
useAnimate | Scoped imperative animations |
useInView | Viewport detection (0.6kb) |
MotionConfig | Global defaults + accessibility |
animate() | Imperative + timeline sequences |
stagger() | Cascading delays |
For full API details, see reference.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

