anymotion-agent/anymotion/framer-motion
Claude Code and agent skill by anymotion-agent/anymotion
- community
Checking that the SKILL.md file is still in the repository.
Framer Motion usage patterns — declarative React animation, gesture handling, layout animations, variants, orchestration, and AnimatePresence. Use when animating a React app or when CSS and vanilla JS are too cumbersome.
Install
npx vskill@latest install anymotion-agent/anymotion/framer-motionSKILL.md
Framer Motion
Framer Motion is the declarative animation library for React. It wraps the Web Animations API and FLIP technique into components you compose like any other React UI, and it handles interruption, layout animations, and gesture-driven motion better than hand-rolled solutions.
Use it when CSS transitions are too limited and writing RAF loops by hand is too much boilerplate. Do not use it when you are not in React, or when the motion is simple enough for plain CSS.
The core idea
Instead of imperatively calling .animate() or managing state timers, you declare what the component should look like in each state and Framer Motion interpolates between them.
When animate changes, the component animates to the new values. When the component unmounts, wrap it in <AnimatePresence> and add an exit prop to animate it out.
When Framer Motion is the right tool
- React projects with non-trivial animation. If you are toggling classes or
writing useEffect hooks that tween values manually, Framer Motion is cleaner.
- Gesture-driven UI. Drag, pan, swipe — these are built-in and interruption
is handled automatically.
- Layout animations. When an element's size or position changes due to a
layout shift (reorder, filtering a list), layout prop applies FLIP under the hood.
- Orchestrated sequences.
variantslet you define named animation states
and propagate them to children, with per-child delays or stagger.
When to skip it
- Simple hover/focus transitions. CSS
:hoverandtransitionare faster
to write and faster to run.
- Outside React. Framer Motion is React-only; use GSAP, Anime.js, or Motion
One for other frameworks.
- Bundle size matters and motion is minimal. Framer Motion adds ~40KB
minified; if you only fade in two elements, CSS is free.
Motion components
Any HTML or SVG element can become a motion component by prefixing motion.:
For custom components, wrap them:
The component must forward ref — motion() needs it to measure layout.
Animation props
| Prop | Runs when | |
|---|---|---|
initial | Component mounts — starting values | |
animate | Whenever this object changes — target values | |
exit | Component unmounts (requires <AnimatePresence>) | |
whileHover | Pointer enters | |
whileTap | Pointer presses | |
whileFocus | Element focuses | |
whileInView | Element scrolls into viewport |
initial={false} disables the mount animation, useful when server-rendering or when you want elements to appear instantly.
Transitions
The transition prop controls timing and easing:
Spring physics (the default for most properties):
Springs feel alive but their duration is not fixed — they end when velocity drops below a threshold. For choreographed sequences where you need to hit a beat, use type: 'tween' with an explicit duration.
Per-property timing:
Useful when you want position to move smoothly while opacity snaps.
Variants: orchestration and propagation
Variants are named animation states. Define them once, reference them by name, and they propagate to children automatically.
When the parent enters the show state, each child animates to its own show state with a 100ms stagger. This is far cleaner than manually calculating delays.
delayChildren starts the whole stagger after a delay. staggerDirection reverses stagger order (1 for forward, -1 for reverse).
Layout animations
When a component's layout changes (position, size), adding layout applies FLIP automatically — the element is measured before and after, then animated from the old position to the new one.
The transition happens even though the DOM structure changed, because Framer Motion measures the old and new boxes and transforms between them.
Shared layout animations let two different components animate as if they are the same element:
The layoutId tells Motion these are two views of one logical element, so it morphs between them. This is how you build the iOS photos grid-to-detail transition.
Cost: Layout animations read getBoundingClientRect and force a reflow, so they are more expensive than transform-only animations. Fine for user-triggered actions, risky for continuous scroll effects.
AnimatePresence: exit animations
React removes unmounted components immediately; <AnimatePresence> delays unmount until the exit animation finishes.
Wrap the parent that conditionally renders children, not each child.
For lists, give each item a unique key and set mode="wait" to wait for the exiting element before mounting the next:
Without mode="wait", both pages overlap during the transition.
Gestures: drag, pan, hover, tap
Drag:
drag="x" or drag="y" locks to one axis. dragElastic adds rubber-banding.
dragConstraints can also be a ref to a parent element, and Motion will calculate the bounds automatically.
Drag events:
info includes point, offset, velocity.
Pan (drag without moving the element) is useful for custom scroll or swipe:
Scroll-triggered animations: whileInView
once: true means it only animates the first time. amount: 0.5 sets the threshold.
useMotionValue and useTransform: manual control
Sometimes you need direct access to an animated value — for example, to drive multiple properties from one gesture.
useTransform maps one range to another. As x moves from -100 to 0, opacity goes from 0 to 1; from 0 to 100, opacity returns to 0.
useScroll tracks scroll position:
scrollYProgress is 0 at the top, 1 at the bottom. This is how you build parallax and scroll-driven scale effects.
Performance
Motion runs animations on the main thread by default, which means layout, paint, and JS all compete. Animating x, y, scale, rotate, and opacity is composited and cheap; animating width, height, top, or left forces layout every frame.
layout animations are inherently expensive — they measure boxes and apply FLIP — so reserve them for user-triggered interactions, not continuous scroll.
will-change is applied automatically when an animation starts and removed when it ends, so you do not manage it manually.
Reduced motion
Framer Motion respects prefers-reduced-motion if you tell it to:
Or globally:
"user" honours the user's system preference; "always" disables all motion.
Common mistakes
| Symptom | Cause | |
|---|---|---|
| Exit animation does not run | Missing <AnimatePresence> or child has no key | |
| Layout animation jumps | Parent or child has overflow: hidden clipping the transform | |
| Animation stutters | Animating width/height instead of scale, or animating too many elements with layout | |
| Drag feels sluggish | dragElastic is too high, or you are running heavy logic in onDrag | |
| Variant does not propagate | Child is not a motion component, or it has its own animate prop overriding the parent | |
| Spring never settles | Stiffness or damping is misconfigured; try type: 'tween' instead |
When to use imperative controls
Most of the time declarative props are cleaner, but useAnimation gives you manual control:
Reach for this when animation logic is tied to external events — WebSocket messages, intersection observers you built yourself, game loops.
Where Framer Motion shines
- Prototyping interaction quickly — drag, spring physics, and gesture handling
are built-in, so you do not rewrite them every project.
- Layout animations and shared-element transitions, which are painful to hand-roll.
- Scroll-driven effects that need to interpolate values smoothly.
- Staggered lists and orchestrated sequences without manually computing delays.
Where it does not: ultra-high-performance particle systems, anything that needs deterministic frame-by-frame control for export, and simple CSS-level transitions that do not justify the bundle weight.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/framer-motion/SKILL.md
Popularity
- Repository stars
- 70
- Repository forks
- 12
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/anymotion-agent/anymotion/framer-motion)