Animation
@JvmDefaultWithCompatibility
public interface Animation<T, V : AnimationVector>
This interface provides a convenient way to query from an VectorizedAnimationSpec
or
FloatDecayAnimationSpec
: It spares the need to pass the starting conditions and in some cases
ending condition for each value or velocity query, and instead only requires the play time to be
passed for such queries.
The implementation of this interface should cache the starting conditions and ending conditions of animations as needed.
Note: Animation
does not track the lifecycle of an animation. It merely reacts to play time
change and returns the new value/velocity as a result. It can be used as a building block for
more lifecycle aware animations. In contrast, Animatable
and Transition
are stateful and
manage their own lifecycles.
Functions
public fun getValueFromNanos(playTimeNanos: Long): T
Returns the value of the animation at the given play time.
Parameters
playTimeNanos | the play time that is used to determine the value of the animation. |
public fun getVelocityVectorFromNanos(playTimeNanos: Long): V
Returns the velocity (in AnimationVector
form) of the animation at the given play time.
Parameters
playTimeNanos | the play time that is used to calculate the velocity of the animation. |
public fun isFinishedFromNanos(playTimeNanos: Long): Boolean
Returns whether the animation is finished at the given play time.
Parameters
playTimeNanos | the play time used to determine whether the animation is finished. |