openrndr / org.openrndr.animatable / Animatable

Animatable

open class Animatable (source)

The Animatable base class.

Example usage:

Then construct a Foo object and cue an animation

In your animation loop you update the object's animation and use its animated fields:

Author
Edwin Jakobs

Constructors

<init>

Animatable(target: Any)
Animatable()
Animatable(createAtTime: Long)

Functions

add

Cues an additive animation for a single variable.

fun add(variable: String, target: Double, duration: Long): Unit

Cues an additive animation for a single variable using a given easing mode.

fun add(variable: String, target: Double, durationMillis: Long, easing: Easing): Unitfun add(variable: String, target: Double, durationMillis: Long, easer: Easer): Unit

animate

fun KMutableProperty0<Double>.animate(target: Double, duration: Long, easing: Easing): Unit
fun animate(variable: KMutableProperty0<*>, target: Double, durationMillis: Long, easing: Easing = Easing.None): Unit

Animates a single variable.

fun animate(variable: String, target: Double, durationMillis: Long): Unit
fun animate(variable: String, target: Double, durationMillis: Long, easing: Easing): Unit
fun animate(variable: String, target: Double, durationMillis: Long, easer: Easer): Unit

animationCount

Returns the number of playing plus queued animations

fun animationCount(): Int

cancel

Cancels all animations.

fun cancel(): Unit

Cancels selected animations

fun cancel(fields: Array<String>): Unit

cancelQueued

Cancels all queued animations. Running animations will run until end.

fun cancelQueued(): Unit

complete

fun complete(variable: String): Unit

Wait for the last cued animation to complete before starting the next animation and install a completion call back that is called when the last queued animation ends.

fun complete(callback: (Animatable) -> Unit): Unit

Wait for the last cued animation in the given animatable to complete before starting the next animation.

fun complete(animatable: Animatable): Unit

Wait for the animation to complete in the given animatable to complete before starting the next animation and install a completion call back that is called when the last queued animation ends.

fun complete(animatable: Animatable = this, callback: ((Animatable) -> Unit)? = null): Unit

delay

Wait for a given time before cueing the next animation.

fun delay(durationMillis: Long, durationNanos: Long = 0): Unit

duration

Returns the duration of the animation in milliseconds

fun duration(): Long

ease

Sets the easing mode for the last cued animation.

fun ease(easing: Easing): Unitfun ease(easer: Easer): Unit

end

Ends running animations and cancels all cued animations. The behaviour of end() differs from cancel() in how animated variables are treated, end() sets the animated variables to their target value. Using end() will produce a pop in the animation.

fun end(): Unit

hasAnimations

Queries if animations are cued.

fun hasAnimations(): Boolean

Queries if animations matching any of the given variables are cued.

fun hasAnimations(vararg variables: String): Boolean

popTime

fun popTime(): Unit

pushTime

fun pushTime(): Unit

updateAnimation

Updates the animation state with a user supplied time

fun updateAnimation(time: Long = clock.timeNanos): Unit

velocity

Returns the current velocity of the animating variable

fun velocity(variable: String): Double

waitUntil

Wait until a the given timeMillis

fun waitUntil(timeMillis: Long, timeNanos: Long = 0): Unit

Companion Object Functions

array

fun array(variable: String, index: Int): String

clock

Globally sets the clock object to use. The default is a DefaultClock instance

fun clock(clock: Clock): Unit

Returns the global clock object

fun clock(): Clock