AnimationController

class AnimationController(var value: Double)

Class that represents an animation controller. It can be used to animate a value towards a target value over a specified time using a given easing function. The animation can be clipped to a specified range.

Constructors

Link copied to clipboard
constructor(value: Double)

Properties

Link copied to clipboard

The current value of the animation.

Functions

Link copied to clipboard
fun anim(target: Double, timeMs: Double, ease: (t: Double) -> Double)

Starts a new animation towards the target value over the specified time using the given easing function.

Link copied to clipboard
fun clip(lowerBound: Double, upperBound: Double): AnimationController

Sets the bounds for the animation value. When clipping is enabled, the value will be constrained within the specified lower and upper bounds.

Link copied to clipboard
fun update()

Updates the AnimationController instance. This method should be called regularly to update the animation state. It calculates the progress of the animation and updates the value accordingly. If clipping is enabled, the value is clipped to the specified bounds. The animation stops if it has reached the end.