AnimatedValueModel
@Stable class AnimatedValueModel<T, V : AnimationVector> : AnimatedValue<T, V>
Model class for AnimatedValue. This class tracks the value field change, so that composables
that read from this field can get promptly recomposed as the animation updates the value.
Summary
Inherited functions |
From class BaseAnimatedValue
Unit |
animateTo(targetValue: T, anim: AnimationSpec<T> = defaultSpringSpec, onEnd: (AnimationEndReason, T) -> Unit = null)
Sets the target value, which effectively starts an animation to change the value from value
to the target value. If there is already an animation in flight, this method will interrupt
the ongoing animation, invoke onEnd that is associated with that animation, and start
a new animation from the current value to the new target value.
|
Unit |
checkFinished(playtime: Long)
|
Unit |
snapTo(targetValue: T)
Sets the current value to the target value immediately, without any animation.
|
Unit |
stop()
Stops any on-going animation. No op if no animation is running. Note that this method does
not skip the animation value to its target value. Rather the animation will be stopped in its
track.
|
|
Properties |
T |
Current value of the animation.
|
Inherited properties |
From class BaseAnimatedValue
Boolean |
isRunning
Indicates whether the animation is running.
|
T |
targetValue
The target of the current animation. This target will not be the same as the value of the
animation, until the animation finishes un-interrupted.
|
T |
value
Current value of the animation.
|
|
|
Public constructors
<init>
AnimatedValueModel(
initialValue: T,
typeConverter: TwoWayConverter<T, V>,
clock: AnimationClockObservable,
visibilityThreshold: T? = null)
Model class for AnimatedValue. This class tracks the value field change, so that composables
that read from this field can get promptly recomposed as the animation updates the value.
Parameters |
initialValue: T |
The overridden value field that can only be mutated by animation |
typeConverter: TwoWayConverter<T, V> |
The converter for converting any value of type T to an
AnimationVector type |
clock: AnimationClockObservable |
The animation clock that will be used to drive the animation |
visibilityThreshold: T? = null |
Threshold at which the animation may round off to its target value. |
Properties
value
var value: T
Current value of the animation.