Incular logoIncular
API ReferencePainting & Animation

AnimationController

Deterministic animation control with every drive, repeat, and listener method.

Cloneable and timer-free: advance with tick(now) -> bool. Defaults: bounds 0..1, value at lower bound, linear curve.

StatusMeaning
IdleNever driven (default)
Forward / ReverseAnimating toward a bound
Completed / DismissedAt upper / lower bound
StoppedHalted mid-flight

Driving

use incular::prelude::*;

fn main() {
    let anim = AnimationController::new(std::time::Duration::from_millis(300));
    let now = std::time::Instant::now();
    anim.forward(now);
    anim.tick(now);
    println!(
        "value: {}, active: {}, status: {:?}",
        anim.value(),
        anim.is_active(),
        anim.status()
    );
    anim.reverse(now);
    anim.reset();
}

with_bounds sets custom bounds; set_value clamps; animate_to/back/drive target values; repeat/repeat_forever loop with optional alternation.

Reading

tick (still active?), value, status, is_active, is_completed, elapsed, duration, bounds, curve, and listener registration (observe / add_listener / remove_listener) — value, is_active, and status print in the runnable program above.


[`AnimationStatus`](/docs/api/painting/animation): `Idle` (default), `Forward`, `Reverse`, `Completed`,
`Dismissed`, `Stopped`.

Related: [`Curves`](/docs/api/painting/curves), [`Tweens`](/docs/api/painting/tweens),
[`Physics`](/docs/api/painting/physics).

On this page