AnimationState
AnimationState contains the necessary information to indicate the state of an animation. Once an AnimationState is constructed, it can only be updated/mutated by animations. If there's a need to mutate some of the fields of an AnimationState, consider using copy functions.
Parameters
com.jakewharton.mosaic.animation.TwoWayConverter to convert type T from and to AnimationVector
initial value of the AnimationState
initial velocity of the AnimationState, null (i.e. no velocity) by default.
last frame time of the animation, AnimationConstants.UnspecifiedTime by default
the time that the animation finished successfully, AnimationConstants.UnspecifiedTime until then
whether the AnimationState is currently being updated by an animation. False by default
Properties
The time when the animation finished successfully in the System.nanoTime timebase.
Indicates whether the given AnimationState is for an animation that has finished, indicated by AnimationState.finishedTimeNanos having a specified value.
Last frame time of the animation.
Current value of the AnimationState.
Velocity of type T, converted from velocityVector.
Current velocity vector of the AnimationState.
Functions
Decay animation that slows down from the current velocity and value captured in AnimationState until the velocity reaches 0. During the animation, the given AnimationState will be updated with the up-to-date value/velocity, frame time, etc. This is often used to animate the result of a fling gesture.
Target based animation that takes the value and velocity from the AnimationState as the starting condition, and animate to the targetValue, using the animationSpec. During the animation, the given AnimationState will be updated with the up-to-date value/velocity, frame time, etc.
Creates a new AnimationState from a given AnimationState. This function allows some of the fields to be different in the new AnimationState.
Creates a new AnimationState of Float value type from a given AnimationState of the same type. This function allows some of the fields to be different in the new AnimationState.