Overview
Creates aMotionValue to track the state and velocity of a value. Usually, these are created automatically by Motion components. For advanced use cases, you can create MotionValues externally and pass them into components via the style prop.
Import
Signature
Parameters
The initial state value
Returns
A
MotionValue instance that tracks the state and velocity of the provided valueUsage
Basic Usage
Create a motion value and use it in a component:With Transform
Motion values work seamlessly withuseTransform for derived values:
Updating Values
Use theset() method to update motion values:
Subscribing to Changes
Listen to value changes with theon() method:
Notes
- Motion values created with
useMotionValueexist outside of React’s render cycle - Changes to motion values don’t trigger component re-renders
- In static mode (e.g., Framer canvas), components automatically re-render when motion values update
- Motion values automatically track velocity for physics-based animations
Related
- MotionValue - The MotionValue class API
- useTransform - Transform motion values
- useSpring - Add spring physics to motion values
- useVelocity - Track velocity of motion values