AnimatedValue
class AnimatedValue<T> : BaseAnimatedValue<T>
AnimatedValue is an animatable value holder. It can hold any type of value, and automatically
animate the value change when the value is changed via animateTo. AnimatedValue supports value
change during an ongoing value change animation. When that happens, a new animation will
transition AnimatedValue from its current value (i.e. value at the point of interruption) to the
new target. This ensures that the value change is always continuous.
Summary
Public constructors
|
AnimatedValue is an animatable value holder.
|
Inherited functions
|
From class BaseAnimatedValue
Unit |
animateTo(targetValue: T)
|
Unit |
animateTo(targetValue: T, onEnd: (AnimationEndReason, T) -> Unit)
|
Unit |
animateTo(targetValue: T, anim: AnimationBuilder<T>, onEnd: (AnimationEndReason, T) -> Unit)
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 |
animateTo(targetValue: T, anim: AnimationBuilder<T>)
|
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.
|
|
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>
AnimatedValue(valueHolder: ValueHolder<T>)
AnimatedValue is an animatable value holder. It can hold any type of value, and automatically
animate the value change when the value is changed via animateTo. AnimatedValue supports value
change during an ongoing value change animation. When that happens, a new animation will
transition AnimatedValue from its current value (i.e. value at the point of interruption) to the
new target. This ensures that the value change is always continuous.
Parameters |
valueHolder: ValueHolder<T> |
A value holder whose value field will be updated during animations |