AnimationBlock

Allows block-style animations to be defined and started. These animations are then grouped and managed by a top-level Animation. Callers are then able to monitor/cancel the entire group using the returned value.

val animations = animate {
innerAnimation1 = 0f to 1f using (tween(...)).invoke {
}

innerAnimation2 = start(customAnimation) {
}
...
}.apply {
completed += ... // called once when all nested animations are done
}


animations.cancel() // cancels all animations started in the block

Functions

Link copied to clipboard
abstract operator fun <T, V> NumericAnimationPlan<T, V>.invoke(onChange: (T) -> Unit): Animator.NumericAnimationInfo<T, V>
Link copied to clipboard
abstract fun <T> start(animation: AnimationPlan<T>, onChanged: (T) -> Unit): Animation<T>

Starts a custom animation

Link copied to clipboard
abstract infix fun <T> Animation<T>.then(block: Animator.AnimationBlock.() -> Unit): Animation<Any>

Starts a new animation block after this animation completes. This animation is linked to the current one and will be canceled if the current one is.

Link copied to clipboard
abstract infix fun <T, V> Pair<T, T>.using(animation: Animator.NumericAnimationInfo<T, V>): Animation<T>

Initiates an Animation from a NumericAnimationInfo.