useAnimationControls
useAnimationControls
provides an imperative way to control animations, allowing you to precisely control when animations start, stop and reset through code.
useAnimationControls
returns an animation controller with start
, stop
, set
methods.
The returned animation controller can be passed to a motion component's animate
prop to control its animations:
Basic Usage
Methods
start
Starts an animation with a transition effect. Takes a target state and optional transition config:
stop
Stops an animation.
set
Sets the animation to a target state without a transition effect.