Animation

class cee.pt.Animation()

Controls time-step animation of a ParticleModel.

Access via ParticleModel.animation. Frames advance inside the render loop at the configured targetFrameRate.

Examples

const model = new cee.pt.ParticleModel({ preloadFrameCount: 5 });
await model.openModel(url);
await model.setFrame(0);

model.animation.targetFrameRate = 30;
model.animation.runAnimation(true);

Accessors

cee.pt.Animation.frameStride()
get frameStride(): number

Frames to advance per step. Default 1.

E.g. stride 5 with targetFrameRate = 30 gives a 150x speedup. Also used by setNextFrame and setPreviousFrame.

Returns: number

set frameStride(value: number): void

Parameters

value: number

Returns: void

cee.pt.Animation.loop()
get loop(): boolean

Wraps from the last frame to the first. Default true.

Returns: boolean

set loop(value: boolean): void

Parameters

value: boolean

Returns: void

cee.pt.Animation.targetFrameRate()
get targetFrameRate(): number

Target animation speed in frames per second. Actual speed may be lower if data is not yet cached.

Returns: number

set targetFrameRate(fps: number): void

Parameters

fps: number

Returns: void

Methods

cee.pt.Animation.isModelAnimationRunning()
isModelAnimationRunning(): boolean

Whether the animation is running.

Returns: boolean

cee.pt.Animation.runAnimation()
runAnimation(start: boolean): void

Start or stop playback.

Parameters

start: boolean

Returns: void

cee.pt.Animation.setAnimationFrameChangedCallback()
setAnimationFrameChangedCallback(callback: AnimationFrameChangedCallback): void

Register a callback invoked on each frame change.

Parameters

Returns: void

cee.pt.Animation.setFirstFrame()
setFirstFrame(): void

Seek to the first frame. Stops animation.

Returns: void

cee.pt.Animation.setLastFrame()
setLastFrame(): void

Seek to the last frame. Stops animation.

Returns: void

cee.pt.Animation.setNextFrame()
setNextFrame(): void

Advance by frameStride frames. Stops animation.

Returns: void

cee.pt.Animation.setPreviousFrame()
setPreviousFrame(): void

Rewind by frameStride frames. Stops animation.

Returns: void