Basics
The Basics examples of the Motion library, rebuilt in Composite: the same trigger, in steps, with the system's own parts.
the category
motion/_rebuilds- rebuilds
- 32
- from motion+
- 2
- easing
- steps() only
motion / basics / animatepresence modes
after a motion.dev example- Motion
- AnimatePresence mode
- here
- play(), 3 frames
- a frame
- 80 ms, 2 steps
- modes
- sync · wait · pop
- original
- AnimatePresence modes
Three lanes, one a mode: the old item cuts out in one step; the new one steps in at once, one step later, or after the space is freed.
motion / basics / color interpolation
after a motion.dev example- Motion
- mixes in linear RGB
- here
- the grey ladder
- a step
- one token, 80 ms
- colours
- 9, ink to bone
- original
- Color interpolation
A colour change walks the grey ladder, one token a step, beside the browser's own blend.
motion / basics / drag: lock direction
after a motion.dev example- Motion
- dragDirectionLock
- here
- the first cell picks the axis
- a move
- one 8 px cell
- keys
- arrows
- original
- Drag: Lock direction
The drag moves in whole 8 px cells and keeps to the axis of its first cell. The arrow keys move it too.
motion / basics / aspect ratio
after a motion.dev example- Motion
- a layout animation
- here
- one cut
- ratios
- 1:1 · 4:3 · 16:9
- original
- Aspect ratio
The box cuts to its new ratio in one step; nothing scales between.
motion / basics / animateactivity: slideshow
after a motion+ example- Motion
- AnimateActivity
- here
- React's Activity
- a change
- one cut
- hidden
- keeps its count
- original
- AnimateActivity: Slideshow
Slides cut one to the next; a hidden slide keeps its count.
motion / basics / usepresencedata
after a motion.dev example- Motion
- usePresenceData
- here
- play(), 2 frames
- a frame
- 80 ms, 2 steps
- the jump
- one 8 px cell
- original
- usePresenceData
The leaving item jumps one cell toward the side the next comes from, then is gone; the next steps in from the other side.
motion / basics / html content
after a motion.dev example- Motion
- a MotionValue as text
- here
- play(), 10 frames
- a frame
- 80 ms, 2 steps
- the text
- 0 to 100
- original
- HTML content
The value counts up in the text in whole steps, one number a frame.
motion / basics / keyframe wildcards
after a motion.dev example- Motion
- a null keyframe
- here
- from the cell it is on
- a cell
- 40 ms, 1 step
- a new click
- stops the last
- original
- Keyframe wildcards
A move to a new cell starts from the cell the part is on, so a new click cuts the last move short.
motion / basics / drag with spring follow
after a motion+ example- Motion
- useSpring
- here
- three followers
- each
- one step behind
- springs
- none
- original
- Drag with spring follow
No springs: each follower takes the cell the one before it left, one step later.
motion / basics / reorder animation
after a motion.dev example- Motion
- the layout prop
- here
- one cut, then a Glitch
- rows
- 4
- original
- Reorder animation
The rows cut to their new order in one step, and each moved name glitches.
motion / basics / element scroll-linked animation
after a motion.dev example- Motion
- useScroll, a container
- here
- scroll(), motion
- the meter
- 8 cells
- original
- Element scroll-linked animation
The scroll of a box fills a meter, one cell a step of the scroll.
motion / basics / track element within viewport
after a motion.dev example- Motion
- useScroll, a target
- here
- scroll() with a target
- the meter
- 8 cells
- from
- enter to leave
- original
- Track element within viewport
A meter shows where a part is in the view, in eight cells.
motion / basics / animate state
after a motion.dev example- Motion
- animate from state
- here
- play(), 4 frames
- a frame
- 40 ms, 1 step
- values
- place and turn
- original
- Animate state
New values from the controls; the part cuts to them in at most four frames.
motion / basics / spinning 3d cube
after a motion.dev example- Motion
- useAnimationFrame
- here
- play(), 8 frames a turn
- a frame
- 80 ms, 2 steps
- turns
- 3, then it stops
- original
- Spinning 3D cube
A box-drawn cube turns in eight frames, three turns, then stops.
motion / basics / usetime
after a motion.dev example- Motion
- useTime
- here
- play(), a cell a step
- a frame
- 40 ms, 1 step
- a pass
- 24 cells, then it stops
- original
- useTime
A mark moves one cell a step along a track, for one pass, then stops.
motion / basics / exit animation
after a motion.dev example- Motion
- AnimatePresence exit
- here
- a Glitch, then a cut
- the Glitch
- 240 ms
- back
- in one step
- original
- Exit animation
The part glitches once, then is gone in one cut.
motion / basics / drag
after a motion.dev example- Motion
- the drag prop
- here
- pointer events
- a move
- one 8 px cell
- keys
- arrows; shift, 4 cells
- momentum
- none
- original
- Drag
The drag moves in whole 8 px cells; the arrow keys move it one cell.
motion / basics / drag: constraints
after a motion.dev example- Motion
- dragConstraints
- here
- the box's edges
- a move
- one 8 px cell
- keys
- arrows
- original
- Drag: Constraints
The drag moves in whole cells and stops at the edges of its box.
motion / basics / enter animation
after a motion.dev example- Motion
- animate on mount
- here
- play(), 4 frames
- a frame
- 80 ms, 2 steps
- reduced
- the last frame
- original
- Enter animation
The part writes its frame, then its fill, one frame a step.
motion / basics / gestures
after a motion.dev example- Motion
- whileHover, whileTap
- here
- the State set
- hover
- the Well fill
- press
- the Held fill
- original
- Gestures
Hover is one grey step, a press is the Held fill: each a cut.
motion / basics / keyframes
after a motion.dev example- Motion
- keyframes
- here
- play(), 4 frames
- a frame
- 80 ms, 2 steps
- frames
- square, turned, small
- original
- Keyframes
The part holds each keyframe for two steps: square, turned, small, square.
motion / basics / layout animation
after a motion.dev example- Motion
- the layout prop
- here
- one cut
- places
- start, end
- original
- Layout animation
The part cuts to its new place in one step.
motion / basics / motion along a path
after a motion.dev example- Motion
- offsetDistance
- here
- play(), 8 points
- a point
- 80 ms, 2 steps
- original
- Motion along a path
A mark jumps along the path from point to point, one point a step.
motion / basics / path drawing
after a motion.dev example- Motion
- pathLength
- here
- play(), 6 frames
- a frame
- 80 ms, 2 steps
- original
- Path drawing
The line draws in six frames, one part of its length a frame.
motion / basics / path morphing
after a motion.dev example- Motion
- an interpolated path
- here
- a cut through one glitch
- a frame
- 80 ms, 2 steps
- shapes
- square, diamond, bar
- original
- Path morphing
One shape cuts to the next through one glitched frame.
motion / basics / scroll-linked animations
after a motion.dev example- Motion
- useScroll
- here
- scroll(), motion
- the line
- 16 cells
- a cell
- 1/16 of the scroll
- original
- Scroll-linked animations
The scroll fills a progress line, one cell a step of the scroll.
motion / basics / scroll-triggered animations
after a motion.dev example- Motion
- whileInView
- here
- inView(), motion
- in
- after one step
- out
- at once
- original
- Scroll-triggered animations
Each row steps in as it comes into view, and out as it leaves.
motion / basics / transition options
after a motion.dev example- Motion
- transition options
- here
- frames, a frame, a delay
- frames
- 2 · 4 · 8
- a frame
- 40 · 80 · 120 ms
- original
- Transition options
The options of one cut: how many frames, how long a frame, and the delay.
motion / basics / value transform & path drawing
after a motion.dev example- Motion
- useTransform
- here
- a cell sets the length
- cells
- 10
- original
- Value transform & path drawing
The drag cell sets how much of the path is drawn, one part a cell.
motion / basics / variants
after a motion.dev example- Motion
- variants, staggerChildren
- here
- a cut, then a step an item
- items
- 4
- original
- Variants
The menu opens in one cut; its items step in one step apart.
motion / basics / rotate
after a motion.dev example- Motion
- animate rotate
- here
- play(), 8 frames
- a frame
- 80 ms, 45 degrees
- turns
- 1, then it stops
- original
- Rotate
The square turns 45 degrees a frame, one turn, then stops.