Framer Motion

by pproencacf93c57cac89No license215 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 7 weeks ago

Framer Motion performance optimization guidelines. This skill should be used when writing, reviewing, or refactoring React animations with Framer Motion to ensure optimal performance patterns. Triggers on tasks involving motion components, animations, gestures, layout transitions, scroll-linked effects, and SVG animations.

Instructions onlySoftware Development
AI-generated overview

Guidelines for optimizing Framer Motion animation performance in React applications.

What it does
This skill provides a prioritized set of 42 rules across 9 categories for writing, reviewing, and refactoring Framer Motion animations in React. It covers bundle optimization, re-render prevention, animation properties, layout transitions, scroll effects, gestures, springs, SVG animations, and exit animations. Each rule is documented in a separate reference file with explanations and code examples, and a template is included for adding new rules.
When to use it
Use it when adding animations to React components with Framer Motion, optimizing bundle size for animation-heavy apps, preventing unnecessary re-renders during animations, or implementing layout, scroll-linked, gesture-based, or SVG animations.
Requirements
No scripts or runtime dependencies; it is an instructions-only skill. It assumes the reader is working with React and the Framer Motion library.

Community Framer Motion Best Practices

Comprehensive performance optimization guide for Framer Motion animations in React applications. Contains 42 rules across 9 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Adding animations to React components with Framer Motion
  • Optimizing bundle size for animation-heavy applications
  • Preventing unnecessary re-renders during animations
  • Implementing layout transitions or shared element animations
  • Building scroll-linked or gesture-based interactions

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Bundle OptimizationCRITICALbundle-
2Re-render PreventionCRITICALrerender-
3Animation PropertiesHIGHanim-
4Layout AnimationsHIGHlayout-
5Scroll AnimationsMEDIUM-HIGHscroll-
6Gesture OptimizationMEDIUMgesture-
7Spring & PhysicsMEDIUMspring-
8SVG & Path AnimationsLOW-MEDIUMsvg-
9Exit AnimationsLOWexit-

Quick Reference

1. Bundle Optimization (CRITICAL)

  • bundle-lazy-motion [blocked] - Use LazyMotion and m component instead of motion
  • bundle-dynamic-features [blocked] - Dynamically import motion features
  • bundle-dom-animation [blocked] - Use domAnimation for basic animations
  • bundle-use-animate-mini [blocked] - Use mini useAnimate for simple cases
  • bundle-strict-mode [blocked] - Enable strict mode to catch accidental imports

2. Re-render Prevention (CRITICAL)

  • rerender-motion-value [blocked] - Use useMotionValue instead of useState
  • rerender-use-transform [blocked] - Derive values with useTransform
  • rerender-stable-callbacks [blocked] - Keep animation callbacks stable
  • rerender-variants-object [blocked] - Define variants outside component
  • rerender-animate-prop [blocked] - Use stable animate values
  • rerender-motion-value-event [blocked] - Use motion value events

3. Animation Properties (HIGH)

  • anim-transform-properties [blocked] - Animate transform properties
  • anim-opacity-filter [blocked] - Prefer opacity and filter for visual effects
  • anim-hardware-acceleration [blocked] - Leverage hardware acceleration
  • anim-will-change [blocked] - Use willChange prop judiciously
  • anim-independent-transforms [blocked] - Animate transforms independently
  • anim-keyframes-array [blocked] - Use keyframe arrays for sequences

4. Layout Animations (HIGH)

  • layout-dependency [blocked] - Use layoutDependency to limit measurements
  • layout-position-size [blocked] - Use layout="position" or "size" appropriately
  • layout-group [blocked] - Group related layout animations
  • layout-id-shared [blocked] - Use layoutId for shared element transitions
  • layout-scroll [blocked] - Add layoutScroll to scrollable ancestors

5. Scroll Animations (MEDIUM-HIGH)

  • scroll-use-scroll [blocked] - Use useScroll hook for scroll-linked animations
  • scroll-use-spring-smooth [blocked] - Smooth scroll animations with useSpring
  • scroll-element-tracking [blocked] - Track specific elements entering viewport
  • scroll-offset-configuration [blocked] - Configure scroll offsets
  • scroll-container-ref [blocked] - Track scroll within specific containers

6. Gesture Optimization (MEDIUM)

  • gesture-while-props [blocked] - Use whileHover/whileTap instead of handlers
  • gesture-variants-flow [blocked] - Let gesture variants flow to children
  • gesture-drag-constraints [blocked] - Use dragConstraints ref for boundaries
  • gesture-drag-elastic [blocked] - Configure dragElastic for natural feel
  • gesture-tap-cancel [blocked] - Use onTapCancel for interrupted gestures

7. Spring & Physics (MEDIUM)

  • spring-physics-based [blocked] - Use physics-based springs for interruptibility
  • spring-damping-ratio [blocked] - Configure damping to control oscillation
  • spring-mass-inertia [blocked] - Adjust mass for heavier/lighter feel
  • spring-use-spring-hook [blocked] - Use useSpring for reactive values

8. SVG & Path Animations (LOW-MEDIUM)

  • svg-path-length [blocked] - Use pathLength for line drawing animations
  • svg-motion-components [blocked] - Use motion.path and motion.circle
  • svg-viewbox-animation [blocked] - Animate viewBox for zoom effects
  • svg-morph-matching-points [blocked] - Match point counts for morphing

9. Exit Animations (LOW)

  • exit-animate-presence [blocked] - Wrap conditional renders with AnimatePresence
  • exit-unique-keys [blocked] - Provide unique keys for AnimatePresence children
  • exit-mode-wait [blocked] - Use mode="wait" for sequential transitions

How to Use

Read individual reference files for detailed explanations and code examples:

  • Section definitions [blocked] - Category structure and impact levels
  • Rule template [blocked] - Template for adding new rules

Reference Files

FileDescription
references/_sections.md [blocked]Category definitions and ordering
assets/templates/_template.md [blocked]Template for new rules
metadata.json [blocked]Version and reference information

Source and attribution

Source:pproenca/dot-skillsinskills/.experimental/framer-motionat commitcf93c57

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal