Canvas Toolkit
← Class index

CAbstractAnimation

Animation · extends CObject

Forward playback time in milliseconds, with repeat and value-direction control. currentTime()/setCurrentTime() use elapsed time across all loops, independent of direction. currentLoopTime() is the directed position within one loop. duration() is one loop; totalDuration() is all loops, or -1 for endless playback. autoReverse alternates the value direction on odd loops. Each leg counts once.

Module animation/CAbstractAnimation.js. This class is available through the browser modules in the download.

Declared members

readonly stateChanged: CSignal<[CAnimationState, CAnimationState]>;
readonly finished: CSignal<[]>;
readonly destroyed: CSignal<[]>;
readonly currentTimeChanged: CSignal<[number]>;

Emitted after value updates when total elapsed playback time changes.

readonly currentLoopChanged: CSignal<[number]>;
readonly directionChanged: CSignal<[CAnimationDirection]>;
isDestroyed(): boolean;
isExternallyDriven(): boolean;
setDrivenBackward(backward: boolean): void;

@internal A containing group supplies both time and traversal direction.

setExternalClock(external: boolean): void;

@internal Groups may supply time instead of scheduling an independent clock.

state(): CAnimationState;
duration(): number;
currentTime(): number;
currentLoop(): number;
loopCount(): number;
direction(): CAnimationDirection;
autoReverse(): boolean;
currentDirection(): CAnimationDirection;

Effective direction of the value, including alternating and containing groups.

totalDuration(): number;
currentLoopTime(): number;
setLoopCount(count: number): void;
setDirection(direction: CAnimationDirection): void;
setAutoReverse(enabled: boolean): void;
setDuration(duration: number): void;
applyCurrentValue(): void;

Reapplies the current value without changing playback time or state.

setCurrentTime(time: number): void;

Seeks elapsed playback time across all loops; a running endpoint seek finishes.

start(): void;

Starts a new run. Direction Backward starts with the last value.

pause(): void;
resume(): void;
stop(): void;

Stops without emitting finished and retains displayed time/value.

protected updateState(_state: CAnimationState, _previous: CAnimationState): void;
protected updateCurrentLoop(_loop: number, _previous: number): void;

Called before currentLoopChanged when the elapsed-time loop changes.

protected abstract updateCurrentTime(time: number): void;
destroy(): void;