Skip to Content
API ReferenceAnimationController

AnimationController

live A time-driven animation controller that progresses from 0 to 1 (or 1 to 0) over a configurable duration. The controller applies an easing curve to the raw linear progress before notifying listeners. Create an AnimationController inside State.InitState, call Forward or Reverse to start playback, and dispose it inside State.Dispose. The controller registers itself with AnimationSystem automatically and is ticked once per frame by Tick.

Constructor

AnimationController

Creates an animation controller with the given duration and optional curve.

ParameterDescription
durationDuration of one full pass in seconds. Must be greater than zero.
curveThe easing curve to apply. Defaults to Linear when null.

Properties

Curve

The easing curve applied to the raw linear progress before exposing Value and notifying listeners. Defaults to Linear.

Duration

The duration of one full forward or reverse pass in seconds. Must be greater than zero.

Status

The current playback status of the controller.

Value

The current curved animation value in the range [0, 1] (or beyond for overshoot curves).

Methods

AddListener

Registers a callback to be invoked with the current curved Value on every tick during which the animation is running.

ParameterDescription
listenerThe callback to register. Must not be null.

Dispose

Stops playback, deregisters from the animation system, and clears all listeners. Safe to call multiple times.

Forward

Starts or resumes playback in the forward direction (toward 1). If the controller is already at 1, it restarts from 0.

RemoveListener

Removes a previously registered listener. If the listener is not registered, this is a no-op.

ParameterDescription
listenerThe callback to remove. Must not be null.

Reset

Stops playback and resets progress to 0 without notifying listeners.

Reverse

Starts or resumes playback in the reverse direction (toward 0). If the controller is already at 0, it restarts from 1.

Last updated on