Motion

2.6-18kb

A modern animation library with spring physics, gestures, and scroll-linked effects.


01

See It in Action

Spring physics and gestures that CSS simply cannot replicate.

Drag the sliders to change spring stiffness and damping in real time. CSS easing curves cannot produce this physics-based motion.

Preview

02

What is Motion?

Motion (formerly Framer Motion) is an animation library for JavaScript, React, and Vue. It lets you add spring-based animations, gesture responses, scroll-linked effects, and layout transitions with very little code.

The library comes in two sizes. The mini version (motion/mini, 2.6kb) uses the browser's native Web Animations API for basic animations. The full version (motion, 18kb) adds spring physics, timelines, independent transforms, and more. Both are fully tree-shakeable — you only ship what you import.

Motion is MIT licensed and free for any project, including commercial ones.

🌊
Spring Physics
Animations driven by real spring math — stiffness, damping, and bounce — so movement feels natural instead of robotic.
👆
Gesture Support
Built-in hover, tap, drag, and pan detection that triggers smooth animations. No extra event-handling code needed.
📐
Layout Animations
Automatically animate elements when they change position or size — like reordering a list — with zero math on your part.

03

When to Use Motion

Use when
React or Vue apps that need declarative, component-level animations
Spring-based motion — bounces, snaps, and elastic effects that feel physical
Drag-to-reorder lists, swipeable cards, and other gesture-driven UI
Scroll-triggered reveal animations and parallax sections
Animating layout changes like expanding cards or reordering grids
Avoid when
Complex multi-element timeline choreography — GSAP's timeline API is more powerful for sequencing dozens of elements
Vanilla JS projects needing maximum control — Motion works best inside React or Vue
Projects that need GSAP-specific plugins like MorphSVG or DrawSVG

04

How Motion Compares

Motion vs GSAP

GSAP (now owned by Webflow) excels at complex timeline choreography and has a rich plugin ecosystem. Motion offers a simpler declarative API, real spring physics, and gesture support. GSAP is free but closed-source with usage restrictions; Motion is MIT licensed.

Motion wins at
Declarative API, spring physics, gestures, layout animations, MIT license
GSAP wins at
Complex timelines, more plugins, framework-agnostic, larger community
View Full Comparison →
Motion vs Anime.js

Anime.js v4 added spring physics, narrowing the gap for vanilla JS work. Motion still wins on gestures, automatic layout animations, and deep React/Vue integration.

Motion wins at
Gestures, layout animations, React/Vue integration, scroll-linked effects
Anime.js wins at
Simpler API for vanilla JS, smaller bundle, spring physics (v4)
View Full Comparison →
Motion vs CSS Animations

CSS handles simple transitions well. Motion is needed when you want spring physics, gesture-driven animations, layout transitions, or JS-controlled dynamic values.

Motion wins at
Spring physics, gestures, layout animations, dynamic values
CSS Animations wins at
Zero JS, GPU-accelerated by default, simpler for basic effects

05

Get Started with Motion

Terminal
npm install motion
Terminal
yarn add motion
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/motion.js"></script>
Quick Start
// CDN: after <script src="...motion.js"></script>
const { animate, stagger, inView } = Motion;

// npm: import { animate, stagger, inView } from "motion";

// Spring animation (CSS cannot do this)
animate(".box", { scale: 1.2, rotate: 10 }, {
  type: "spring", stiffness: 300, damping: 15
});

// Stagger multiple elements with spring
animate(".card", { opacity: 1, y: 0 }, {
  delay: stagger(0.1),
  type: "spring", bounce: 0.3
});

// Trigger animation on scroll
inView(".section", (el) => {
  animate(el, { opacity: 1, y: 0 }, { type: "spring" });
});

06

Related Libraries