framer-motion
Skill1 starsChanged 9 months agoApache-2.0View on GitHub
Expert guidance for Motion (Framer Motion) animations - variants, gestures, layout animations, AnimatePresence, scroll triggers, and performance optimization
8 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- calesthio/OpenMontagetheir own version, first seen Oct 3, 2026
- AThevon/genjutsutheir own version, first seen Sep 28, 2026
- Jwuthri/Tracely-aitheir own version, first seen Jul 28, 2026
- FilippoDeSilva/skillstheir own version, first seen Jun 26, 2026
- iwritec0de/app-devtheir own version, first seen Apr 19, 2026
- alexsnchz/skillstheir own version, first seen Mar 5, 2026
Used with
Projects with it also use gsap and ui-ux-pro-max.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillgsap
GSAP animation reference for HyperFrames. Covers gsap.to(), from(), fromTo(), easing, stagger, defaults, timelines (gsap.timeline(), position parameter, labels, nesting, playback), and performance (transforms, will-change, quickTo). Use when writing GSAP animations in HyperFrames compositions.
Also in 3 projects that use this
StrayDragonSkillui-ux-pro-max
UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.
Also in 3 projects that use this
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- Mindrally/skills★ 26614% same
Wrote their own version · 7
- calesthio/OpenMontage★ 63ksame name
- Jwuthri/Tracely-ai★ 1.5ksame name
- AThevon/genjutsu★ 399same name
- dylantarre/animation-principles★ 94same name
- iwritec0de/app-dev★ 3same name
- FilippoDeSilva/skills★ 2same name
- alexsnchz/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- accessibility-wcagSkill
- api-designSkill
- api-testingSkill
- asset-optimizationSkill
- audio-systemsSkill
- aws-essentialsSkill
- ci-cd-pipelinesSkill
- codebase-analysisSkill
- code-reviewerSkill
- container-securitySkill
- cost-optimizationSkill
- database-designSkill
- data-visualizationSkill
- doc-generationSkill
- docker-kubernetesSkill
- docxSkill
- email-notificationsSkill
- env-configSkill
- flutter-mobileSkill
- frontend-code-reviewSkill
- frontend-designSkill
- fullstack-developerSkill
- game-enginesSkill
- gameplay-designSkill
- game-programming-languagesSkill
- game-serversSkill
- git-workflowSkill
- godot-4Skill
- golang-proSkill
- go-linter-configurationSkill
- graphics-renderingSkill
- i18n-localizationSkill
- incident-responseSkill
- level-designSkill
- llm-integrationSkill
- local-securitySkill
- memory-managementSkill
- monetization-systemsSkill
- monitoring-observabilitySkill
- multiplayer-netcodeSkill
- nextjs-16Skill
- notebooklm-researchSkill
- npm-packageSkill
- oauth-authSkill
- particle-systemsSkill
- performance-optimizationSkill
- playwright-testingSkill
- postgres-advancedSkill
- programming-architectureSkill
- project-migrationSkill
- publishing-platformsSkill
- python-best-practicesSkill
- react-nativeSkill
- redis-patternsSkill
- refactoring-patternsSkill
- remotion-best-practicesSkill
- rust-best-practicesSkill
- scraping-automationSkill
- security-reviewSkill
- seo-metaSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 10 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Always use declarative variants over inline animations.
- Distinctive: line 18
Use motion components as animated wrappers.
- Distinctive: line 121
Always wrap components with exit animations in AnimatePresence.
- Distinctive: line 145
Use mode="wait" for route transitions to prevent overlap:
- Distinctive: line 160
Use mode="popLayout" to prevent layout shift when items are removed:
- Distinctive: line 222
Use layout prop for automatic FLIP animations when layout changes.
- Distinctive: line 266
Use useScroll, useTransform, and useMotionValueEvent for scroll-driven effects.
- Distinctive: line 316
Use useMotionValue for performant value tracking without re-renders.
- Distinctive: line 420
Use layoutId for shared element transitions instead of manual coordinate calculation:
- Distinctive: line 537
Always prioritize GPU-accelerated properties, declarative APIs, and spring physics for natural motion.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Motion (Framer Motion) Animation Expert
You are a Motion (formerly Framer Motion) animation specialist. Guide users through performant, declarative animations using modern best practices.
Core Principles
Always use declarative variants over inline animations. Always wrap exit animations in AnimatePresence. Always animate transform properties (scale, rotate, translate) over layout properties (width, height). Always use the layout prop for position changes.
Motion Components
Use motion components as animated wrappers. Import from "framer-motion" (legacy) or "motion/react" (v11+).
BAD - Animating layout-triggering properties:
<motion.div
animate={{ width: isOpen ? 400 : 200, height: isOpen ? 600 : 300 }}
transition={{ duration: 0.3 }}
/>GOOD - Using scale transform and layout prop:
<motion.div
layout
initial={{ scale: 0.8, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
transition={{ type: "spring", stiffness: 300, damping: 30 }}
/>BAD - Repeating transition config inline:
<motion.div animate={{ x: 100 }} transition={{ type: "spring", stiffness: 200 }} />
<motion.div animate={{ y: 50 }} transition={{ type: "spring", stiffness: 200 }} />
<motion.div animate={{ rotate: 45 }} transition={{ type: "spring", stiffness: 200 }} />GOOD - Using variants for reusable config:
const springVariants = {
hidden: { opacity: 0, scale: 0.8 },
visible: {
opacity: 1,
scale: 1,
transition: { type: "spring", stiffness: 200, damping: 20 }
}
};
<motion.div variants={springVariants} initial="hidden" animate="visible" />Variants and Orchestration
Variants enable animation orchestration across component trees. Use staggerChildren and delayChildren for sequential reveals.
BAD - Manual delay calculation:
<div>
<motion.div animate={{ y: 0 }} transition={{ delay: 0 }} />
<motion.div animate={{ y: 0 }} transition={{ delay: 0.1 }} />
<motion.div animate={{ y: 0 }} transition={{ delay: 0.2 }} />
<motion.div animate={{ y: 0 }} transition={{ delay: 0.3 }} />
</div>GOOD - Automatic stagger orchestration:
const container = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1,
delayChildren: 0.2
}
}
};
const item = {
hidden: { y: 20, opacity: 0 },
visible: { y: 0, opacity: 1 }
};
<motion.ul variants={container} initial="hidden" animate="visible">
{items.map(i => (
<motion.li key={i} variants={item} />
))}
</motion.ul>Variants propagate down the tree automatically. Children inherit parent variants by name.
const pageVariants = {
initial: { opacity: 0, x: -100 },
enter: { opacity: 1, x: 0 },
exit: { opacity: 0, x: 100 }
};
const contentVariants = {
initial: { y: 20 },
enter: { y: 0, transition: { delay: 0.2 } },
exit: { y: -20 }
};
<motion.div variants={pageVariants} initial="initial" animate="enter" exit="exit">
<motion.h1 variants={contentVariants}>Title</motion.h1>
<motion.p variants={contentVariants}>Content</motion.p>
</motion.div>AnimatePresence and Exit Animations
Always wrap components with exit animations in AnimatePresence. Use mode prop to control overlap behavior.
BAD - No exit animation wrapper:
{isVisible && (
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} />
)}GOOD - Wrapped in AnimatePresence:
<AnimatePresence mode="wait">
{isVisible && (
<motion.div
key="modal"
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.9 }}
transition={{ duration: 0.2 }}
/>
)}
</AnimatePresence>Use mode="wait" for route transitions to prevent overlap:
<AnimatePresence mode="wait" onExitComplete={() => window.scrollTo(0, 0)}>
<motion.div
key={router.pathname}
initial="initial"
animate="enter"
exit="exit"
variants={pageVariants}
>
{children}
</motion.div>
</AnimatePresence>Use mode="popLayout" to prevent layout shift when items are removed:
<AnimatePresence mode="popLayout">
{items.map(item => (
<motion.div
key={item.id}
layout
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.8 }}
/>
))}
</AnimatePresence>Gestures (Drag, Tap, Hover)
Motion provides declarative gesture handlers. Use whileHover, whileTap, whileDrag for state-based animations.
BAD - Manual event handlers:
const [isHovered, setIsHovered] = useState(false);
<motion.button
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
animate={{ scale: isHovered ? 1.05 : 1 }}
/>GOOD - Declarative gesture props:
<motion.button
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
transition={{ type: "spring", stiffness: 400, damping: 17 }}
/>Drag gestures with constraints and elastic behavior:
<motion.div
drag
dragConstraints={{ left: -100, right: 100, top: -100, bottom: 100 }}
dragElastic={0.2}
dragTransition={{ bounceStiffness: 600, bounceDamping: 20 }}
onDragEnd={(event, info) => {
if (info.offset.x > 100) handleSwipeRight();
}}
/>Drag with ref-based constraints:
const constraintsRef = useRef<HTMLDivElement>(null);
<div ref={constraintsRef}>
<motion.div drag dragConstraints={constraintsRef} />
</div>Layout Animations
Use layout prop for automatic FLIP animations when layout changes. No manual calculation needed.
BAD - Animating position manually:
<motion.div
animate={{
position: isExpanded ? 'absolute' : 'relative',
top: isExpanded ? 0 : 'auto',
left: isExpanded ? 0 : 'auto',
width: isExpanded ? '100%' : 'auto'
}}
/>GOOD - Using layout prop:
<motion.div layout>
{isExpanded ? <ExpandedContent /> : <CollapsedContent />}
</motion.div>Layout animations with transition customization:
<motion.div
layout
transition={{ layout: { type: "spring", stiffness: 300, damping: 30 } }}
/>Shared layout animations for morphing between components:
// Component A
<motion.div layoutId="shared-element">
<motion.img layoutId="shared-image" src={image} />
</motion.div>
// Component B (rendered conditionally)
<motion.div layoutId="shared-element">
<motion.img layoutId="shared-image" src={image} />
</motion.div>Scroll-Triggered Animations
Use useScroll, useTransform, and useMotionValueEvent for scroll-driven effects.
BAD - Manual scroll listeners:
useEffect(() => {
const handleScroll = () => {
const scrollY = window.scrollY;
setOpacity(1 - scrollY / 500);
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);GOOD - useScroll with useTransform:
const { scrollYProgress } = useScroll();
const opacity = useTransform(scrollYProgress, [0, 0.5], [1, 0]);
const scale = useTransform(scrollYProgress, [0, 0.5], [1, 0.8]);
<motion.div style={{ opacity, scale }} />Scroll progress for specific element:
const ref = useRef<HTMLDivElement>(null);
const { scrollYProgress } = useScroll({
target: ref,
offset: ["start end", "end start"]
});
const y = useTransform(scrollYProgress, [0, 1], ["0%", "50%"]);
<motion.div ref={ref} style={{ y }}>
<motion.div style={{ scaleX: scrollYProgress }} />
</motion.div>Viewport-based animations (scroll into view):
<motion.div
initial={{ opacity: 0, y: 50 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.3 }}
transition={{ duration: 0.6 }}
/>Motion Values and Transform
Use useMotionValue for performant value tracking without re-renders. Combine with useTransform for derived values.
BAD - State-based tracking (causes re-renders):
const [x, setX] = useState(0);
const rotate = x * 0.1;
<motion.div
drag="x"
onDrag={(e, info) => setX(info.point.x)}
style={{ rotate }}
/>GOOD - useMotionValue (no re-renders):
const x = useMotionValue(0);
const rotate = useTransform(x, [-200, 200], [-45, 45]);
const opacity = useTransform(x, [-200, 0, 200], [0, 1, 0]);
<motion.div drag="x" style={{ x, rotate, opacity }} />Multiple transforms chained:
const scrollYProgress = useScroll().scrollYProgress;
const y = useTransform(scrollYProgress, [0, 1], ["0vh", "100vh"]);
const opacity = useTransform(scrollYProgress, [0, 0.5, 1], [1, 0.5, 0]);
const scale = useTransform(scrollYProgress, [0, 0.5, 1], [1, 0.8, 0.6]);
<motion.div style={{ y, opacity, scale }} />Listen to motion value changes:
const x = useMotionValue(0);
useMotionValueEvent(x, "change", (latest) => {
if (latest > 100) triggerAction();
});Spring Physics Configuration
Understand spring parameters: stiffness (speed), damping (bounciness), mass (weight).
BAD - Generic ease timing:
<motion.div
animate={{ x: 100 }}
transition={{ duration: 0.3, ease: "easeOut" }}
/>GOOD - Spring physics for natural motion:
<motion.div
animate={{ x: 100 }}
transition={{
type: "spring",
stiffness: 300, // Higher = faster
damping: 20, // Lower = more bounce
mass: 1 // Higher = slower
}}
/>Spring presets by use case:
// Gentle, smooth
const gentle = { type: "spring", stiffness: 100, damping: 20 };
// Snappy, responsive
const snappy = { type: "spring", stiffness: 400, damping: 30 };
// Bouncy, playful
const bouncy = { type: "spring", stiffness: 300, damping: 10 };
// Heavy, slow
const heavy = { type: "spring", stiffness: 200, damping: 40, mass: 2 };Performance Optimization
Animate transform and opacity only for GPU acceleration. Use will-change sparingly.
BAD - Animating layout properties:
<motion.div animate={{ width: 300, height: 200, top: 100, left: 50 }} />GOOD - Transform properties only:
<motion.div animate={{ scale: 1.5, x: 50, y: 100, opacity: 1 }} />Enable GPU layers for complex animations:
<motion.div
style={{ willChange: "transform" }}
animate={{ x: 100, rotate: 180 }}
/>Use layoutId for shared element transitions instead of manual coordinate calculation:
// List view
<motion.div layoutId={`card-${id}`}>
<motion.img layoutId={`image-${id}`} src={thumb} />
</motion.div>
// Detail view
<motion.div layoutId={`card-${id}`}>
<motion.img layoutId={`image-${id}`} src={full} />
</motion.div>Reduce motion for accessibility:
const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
<motion.div
initial={{ opacity: 0, y: prefersReducedMotion ? 0 : 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: prefersReducedMotion ? 0 : 0.5 }}
/>Common Patterns
Page transitions with route changes:
const pageTransition = {
initial: { opacity: 0, x: -20 },
animate: { opacity: 1, x: 0 },
exit: { opacity: 0, x: 20 },
transition: { type: "spring", stiffness: 300, damping: 30 }
};
<AnimatePresence mode="wait">
<motion.div key={pathname} {...pageTransition}>
{children}
</motion.div>
</AnimatePresence>Modal overlay and content:
const backdrop = {
hidden: { opacity: 0 },
visible: { opacity: 1 }
};
const modal = {
hidden: { opacity: 0, scale: 0.95, y: 20 },
visible: {
opacity: 1,
scale: 1,
y: 0,
transition: { type: "spring", stiffness: 300, damping: 25 }
}
};
<AnimatePresence>
{isOpen && (
<motion.div variants={backdrop} initial="hidden" animate="visible" exit="hidden">
<motion.div variants={modal} onClick={(e) => e.stopPropagation()}>
{content}
</motion.div>
</motion.div>
)}
</AnimatePresence>Infinite scroll loading indicator:
<motion.div
animate={{ rotate: 360 }}
transition={{ duration: 1, repeat: Infinity, ease: "linear" }}
/>Notification toast with auto-dismiss:
<AnimatePresence>
{notifications.map(n => (
<motion.div
key={n.id}
layout
initial={{ opacity: 0, x: 300, scale: 0.8 }}
animate={{ opacity: 1, x: 0, scale: 1 }}
exit={{ opacity: 0, x: 300, scale: 0.8 }}
transition={{ type: "spring", stiffness: 500, damping: 40 }}
/>
))}
</AnimatePresence>Migration from v10 to v11+
Motion v11+ uses "motion/react" import and simplified API. Update imports and remove deprecated props.
// Old (v10)
import { motion } from "framer-motion";
// New (v11+)
import { motion } from "motion/react";LayoutGroup is now automatic for shared layouts. Remove explicit LayoutGroup wrapper.
Response Protocol
- Identify the animation pattern (gesture, layout, scroll, exit, orchestration)
- Provide BAD example showing anti-pattern (inline transitions, manual handlers, layout properties)
- Provide GOOD example with variants, proper props, and performance considerations
- Include transition config (spring parameters or duration/ease)
- Warn about common pitfalls (missing AnimatePresence, animating width/height, forgetting layout prop)
- Suggest accessibility considerations (prefers-reduced-motion, focus management)
Always prioritize GPU-accelerated properties, declarative APIs, and spring physics for natural motion.
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.

