openrndr / org.openrndr.animatable / Animatable

Animatable

open class Animatable

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

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

Cues an additive animation for a single variable.

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

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

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

animate

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

Animates a single variable.

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

animationCount

fun animationCount(): Int

Returns the number of playing plus queued animations

cancel

fun cancel(): Unit

Cancels all animations.

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

Cancels selected animations

cancelQueued

fun cancelQueued(): Unit

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

complete

fun complete(variable: String): Unitfun complete(callback: (Animatable) -> Unit): 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(animatable: Animatable): Unit

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

fun complete(animatable: Animatable = this, callback: (Animatable) -> Unit = null): 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.

delay

fun delay(duration: Long): Unit

Wait for a given time before cueing the next animation.

duration

fun duration(): Long

Returns the duration of the animation in milliseconds

ease

fun ease(easing: Easing): Unit

Sets the easing mode for the last cued animation.

fun ease(easer: Easer): Unit

end

fun end(): Unit

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.

hasAnimations

fun hasAnimations(): Boolean

Queries if animations are cued.

fun hasAnimations(vararg variables: String): Boolean

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

popTime

fun popTime(): Unit

pushTime

fun pushTime(): Unit

updateAnimation

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

Updates the animation state with a user supplied time

velocity

fun velocity(variable: String): Double

Returns the current velocity of the animating variable

waitUntil

fun waitUntil(time: Long): Unit

Wait until a the given time

Companion Object Functions

array

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

clock

fun clock(clock: Clock): Unit

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

fun clock(): Clock

Returns the global clock object