TargetBasedAnimation
This is a convenient animation wrapper class that works for all target based animations, i.e. animations that has a pre-defined end value, unlike decay.
It assumes that the starting value and velocity, as well as ending value do not change throughout the animation, and cache these values. This caching enables much more convenient query for animation value and velocity (where only playtime needs to be passed into the methods).
Note: When interruptions happen to the TargetBasedAnimation, a new instance should be created that use the current value and velocity as the starting conditions. This type of interruption handling is the default behavior for both com.jakewharton.mosaic.animation.Animatable and com.jakewharton.mosaic.animation.Transition. Consider using those APIs for the interruption handling, as well as built-in animation lifecycle management.
Parameters
the com.jakewharton.mosaic.animation.VectorizedAnimationSpec that will be used to calculate value/velocity
the start value of the animation
the end value of the animation
the com.jakewharton.mosaic.animation.TwoWayConverter that is used to convert animation type T from/to V
the start velocity of the animation in the form of AnimationVector
See also
Constructors
Creates a TargetBasedAnimation with the given start/end conditions of the animation, and the provided animationSpec.
Properties
This amount of time in nanoseconds that the animation will run before it finishes
Whether or not the Animation represents an infinite animation. That is, one that will not finish by itself, one that needs an external action to stop. For examples, an indeterminate progress bar, which will only stop when it is removed from the composition.
This is the value that the Animation will reach when it finishes uninterrupted.
Functions
Returns the value of the animation at the given play time.
Returns the velocity of the animation at the given play time.
Returns the velocity (in AnimationVector form) of the animation at the given play time.
Returns whether the animation is finished at the given play time.