AnimatedFloatModel
@Stable class AnimatedFloatModel : AnimatedFloat
Model class for AnimatedFloat. 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 |
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.
|
|
From class AnimatedFloat
Unit |
checkFinished(playtime: Long)
|
Unit |
setBounds(min: Float = Float.NEGATIVE_INFINITY, max: Float = Float.POSITIVE_INFINITY)
Sets up the bounds that the animation should be constrained to. When the animation
reaches the bounds it will stop right away, even when there is remaining velocity. Setting
a range will immediately clamp the current value to the new range. Therefore it is not
recommended to change bounds in a way that immediately changes current value during an
animation, as it would result in a discontinuous animation.
|
Unit |
snapTo(targetValue: Float)
Sets the current value to the target value immediately, without any animation.
|
|
Properties |
Float |
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>
AnimatedFloatModel(
initialValue: Float,
clock: AnimationClockObservable,
visibilityThreshold: Float = Spring.DefaultDisplacementThreshold)
Model class for AnimatedFloat. 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: Float |
The overridden value field that can only be mutated by animation |
clock: AnimationClockObservable |
The animation clock that will be used to drive the animation |
visibilityThreshold: Float = Spring.DefaultDisplacementThreshold |
a threshold to determine when the animation is considered close
enough to the target to terminate |
Properties
value
var value: Float
Current value of the animation.