AnimatedValue
A mutable, animation-aware value holder that implements Value for direct use in Litho Style APIs.
AnimatedValue integrates with Litho's state read tracking for automatic phase-skipping: when a component reads value during bind (e.g., Style.alpha(animatedFloat)), only the bind phase runs on animation updates — layout and resolve are skipped.
Value Ownership
Unlike State, the animated value is stored directly in this instance rather than in the component state container. State updates use a no-op HookUpdater — they serve purely as re-render signals. The actual value is read from _currentValue when the component re-evaluates.
Animation Lifecycle
retarget: Starts an animation toward a target value. If an animation is already running, it is interrupted with velocity preservation for smooth retargeting. The caller is responsible for registering this value with an AnimationController for frame callbacks.
snapTo: Immediately sets the value without animation and triggers a re-render.
restart: Restarts an animation from an explicit initial value, published on the next frame.
stop: Stops the current animation at its present value.
Frame Updates
Values are updated each frame via onFrame calls from the AnimationController. This class has no direct dependency on the frame loop — registration is the caller's responsibility.
Parameters
The type of the animated value.
See also
Functions
Immediately sets the value to target without animation.
Stops the current animation at its present value.