Core Functions
The JavaScript API consists of five main functions:animate()- Animate HTML elements, objects, or motion valuesscroll()- Create scroll-linked animationsinView()- Detect when elements enter the viewporttimeline()- Create sequenced animations (via animate sequences)animateMini()- Lightweight WAAPI-only animations
Installation
Quick Start
Animation Types
Element Animations
Animate DOM elements using CSS selectors or element references:Motion Value Animations
Animate raw numeric or string values:Object Animations
Animate arbitrary JavaScript objects:Animation Options
Duration and Easing
Spring Physics
Delays and Stagger
Playback Controls
All animations return controls for playback manipulation:Lifecycle Callbacks
Promises and Async
Animations are Promise-compatible:Animatable Properties
Transform Properties
CSS Properties
Transform Origin
Performance
Motion automatically uses GPU-accelerated animations when possible:- Transform properties (
x,y,scale,rotate) are GPU-accelerated - Other properties may use JavaScript or WAAPI depending on browser support
- Animations are optimized for 60fps on most devices
Browser Support
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Degrades gracefully in older browsers
- Uses Web Animations API (WAAPI) when available
- Falls back to JavaScript animations when needed
Next Steps
animate()
Learn about the animate function
scroll()
Create scroll-linked animations
inView()
Detect viewport visibility
timeline()
Build sequenced animations