useAnimatedValue
Animates a value of type T, automatically starting a new animation whenever targetValue changes.
This is the foundation hook for all declarative animations. It creates an AnimatedValue internally and drives it via useEffect whenever the target or spec changes. The returned Value integrates with Litho's state read tracking for automatic phase-skipping.
Prefer the typed convenience hooks (useAnimatedFloat, useAnimatedInt, useAnimatedColor, useAnimatedDimen) over calling this directly.
val alpha = useAnimatedValue(
targetValue = if (visible) 1f else 0f,
typeConverter = FloatTypeConverter,
)
Style.alpha(alpha)Return
A Value containing the current animated value.
Parameters
The value to animate toward. Changes trigger new animations.
The animation specification. Defaults to spring.
Controls when the animation begins receiving frame callbacks. Defaults to AnimationTrigger.Immediate.
Optional label for debugging and tracing attribution.