BaseAnimatedValue

sealed class BaseAnimatedValue<T> : DynamicTargetAnimation<T>
kotlin.Any
   ↳ androidx.animation.BaseAnimatedValue

This is the base class for AnimatedValue. It contains all the functionality of AnimatedValue. It is intended to be used as a base class for the other classes (such as AnimatedFloat to build on top of.

Summary

Public methods

open Unit
animateTo(targetValue: T)

open Unit
animateTo(targetValue: T, onEnd: (AnimationEndReason, T) -> Unit)

open 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.

open Unit
animateTo(targetValue: T, anim: AnimationBuilder<T>)

open Unit
snapTo(targetValue: T)

Sets the current value to the target value immediately, without any animation.

open Unit

Stops any on-going animation.

Properties

open Boolean

Indicates whether the animation is running.

open T

The target of the current animation.

open T

Current value of the animation.

Public methods

animateTo

open fun animateTo(targetValue: T): Unit

animateTo

open fun animateTo(
    targetValue: T,
    onEnd: (AnimationEndReason, T) -> Unit
): Unit

animateTo

open fun animateTo(
    targetValue: T,
    anim: AnimationBuilder<T>,
    onEnd: (AnimationEndReason, T) -> Unit
): 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.

Parameters
targetValue: T The new value to animate to
anim: AnimationBuilder<T> The animation that will be used to animate from the current value to the new target value
onEnd: (AnimationEndReason, T) -> Unit A callback that will be invoked when the animation finished by any reason.

animateTo

open fun animateTo(
    targetValue: T,
    anim: AnimationBuilder<T>
): Unit

snapTo

open fun snapTo(targetValue: T): Unit

Sets the current value to the target value immediately, without any animation.

Parameters
targetValue: T The new target value to set value to.

stop

open fun stop(): Unit

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

isRunning

open var isRunning: Boolean

Indicates whether the animation is running.

targetValue

open var targetValue: T

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.

value

open var value: T

Current value of the animation.