class Animation<T, V>
An Animation encapsulates the information required to animate a single property of a Node.
T
- The animation's original value type.
V
- The animation's transformed value type.
interface BidirectionalValueTransformer<T, V> : Animation.ValueTransformer<T, V>
Interface that can transform type |
|
enum class RepeatMode
Repeat mode determines how a repeating animation should behave once it completes. |
|
interface ValueTransformer<T, V>
Interface that can transform type |
var duration: Long
Gets the duration of the animation. |
|
var interpolator: TimeInterpolator?
Returns the timing interpolator that this animation uses. If null, a LinearInterpolator will be used by default. |
|
var repeatCount: Long
Defines how many times the animation should repeat. The default value is 0. |
|
var repeatMode: Animation.RepeatMode
Defines what this animation should do when it reaches the end. |
|
var startDelay: Long
Gets the start delay of the animation. |
|
val totalDuration: Long
Gets the total duration of the animation in milliseconds, accounting for start delay and repeat count. Returns INFINITE if the repeat count is infinite. |
fun duration(duration: Long): Animation<T, V>
Sets the duration of the animation. |
|
fun getAnimatedValue(fraction: Float): V
Returns the animated value of this animation at the given fraction. |
|
fun interpolator(interpolator: TimeInterpolator?): Animation<T, V>
Sets the timing interpolator that this animation uses. If null, a LinearInterpolator will be used by default. |
|
fun repeatCount(repeatCount: Long): Animation<T, V>
Sets how many times the animation should be repeated. If the repeat count is 0, the animation is never repeated. If the repeat count is greater than 0 or INFINITE, the repeat mode will be taken into account. The repeat count is 0 by default. |
|
fun repeatMode(repeatMode: Animation.RepeatMode): Animation<T, V>
Defines what this animation should do when it reaches the end. This setting is applied only when the repeat count is either greater than 0 or INFINITE. Defaults to RepeatMode.RESTART. |
|
fun startDelay(startDelay: Long): Animation<T, V>
Sets the start delay of the animation. |
|
fun <W> transform(transformer: Animation.ValueTransformer<T, W>): Animation<T, W> fun <W> transform(transformer: (value: T) -> W): Animation<T, W>
Creates a new animation with original value type |
const val INFINITE: Long
This value used used with the repeatCount property to repeat the animation indefinitely. Also used to indicate infinite duration. |
fun ofArgb(vararg values: Int): Animation<Int, Int>
Constructs and returns an Animation that animates between color values. A single value implies that the value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when the animation is started. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation). fun ofArgb(vararg values: Keyframe<Int>): Animation<Int, Int>
Same as ofArgb except with Keyframes instead of color values. |
|
fun ofFloat(vararg values: Float): Animation<Float, Float>
Constructs and returns an Animation that animates between float values. A single value implies that the value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when the animation is started. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation). fun ofFloat(vararg values: Keyframe<Float>): Animation<Float, Float>
Same as ofFloat except with Keyframes instead of float values. |
|
fun ofFloatArray(vararg values: FloatArray): Animation<FloatArray, FloatArray>
Constructs and returns an Animation that animates between fun ofFloatArray(vararg values: Keyframe<FloatArray>): Animation<FloatArray, FloatArray>
Same as ofFloatArray except with Keyframes instead of |
|
fun ofPathMorph(vararg values: PathData): Animation<PathData, PathData>
Constructs and returns an Animation that animates between PathData values. A single value implies that the value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when the animation is started. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation). fun ofPathMorph(vararg values: Keyframe<PathData>): Animation<PathData, PathData>
Same as ofPathMorph except with Keyframes instead of |
|
fun ofPathMotion(path: Path): Animation<PointF, PointF>
Constructs and returns an Animation that animates through PointF values in order to simulate motion along the given path. Clients can use transform to transform the returned animation into one that outputs floats corresponding to the path's x/y coordinates. |