AnimationScene
Introduction
vtkAnimationScene orchestrates the playback of multiple animation cues. It manages global time, supports looping, and dispatches tick events to all registered cues each frame. Scenes can be played, paused, stopped, and seeked to arbitrary times.
Methods
addCue
Add a cue to this scene.
| Argument | Type | Required | Description |
|---|---|---|---|
cue | vtkAnimationCue | Yes | The animation cue to add. |
extend
Method used to decorate a given object (publicAPI+model) with vtkAnimationScene characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IAnimationSceneInitialValues | No | (default: {}) |
getCue
Get a cue by index.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes | The cue index. |
getCues
Get a copy of the list of cues in this scene.
getCuesByReference
Get the list of cues without copying it.
getFrameRate
Get the frames per second used in PlayMode.SEQUENCE.
getLoop
Get whether the scene loops.
getNumberOfCues
Get the number of cues in this scene.
getPlayMode
Get how the scene turns a tick into a time step.
isInPlay
Alias of isPlaying().
newInstance
Method used to create a new instance of vtkAnimationScene.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IAnimationSceneInitialValues | No | for pre-setting some of its content |
pause
Pause the scene and every cue it holds. Does nothing unless the scene plays. A caller that drives the scene itself can stop ticking it instead.
play
Play the scene and every cue it holds. A playing scene ignores the call, a paused scene continues from the time it holds, and a stopped scene plays again from the start time.
removeAllCues
Remove every cue from this scene.
removeCue
Remove a cue from this scene.
| Argument | Type | Required | Description |
|---|---|---|---|
cue | vtkAnimationCue | Yes | The animation cue to remove. |
seek
Alias of setAnimationTime().
| Argument | Type | Required | Description |
|---|---|---|---|
time | number | Yes | The time to move to, clamped to the scene bounds. |
setAnimationTime
Move to a time without changing the state, so a paused scene stays paused. A cue outside the time stops, and a cue inside it moves to that same time and reports it through its own tick event.
| Argument | Type | Required | Description |
|---|---|---|---|
time | number | Yes | The time to move to, clamped to the scene bounds. |
setCueState
Move the scene to a state and carry that state into every cue. Does nothing when the scene already holds that state. Read it back with the inherited getCueState().
| Argument | Type | Required | Description |
|---|---|---|---|
state | number | Yes | One of SceneState. |
setFrameRate
Set the frames per second used in PlayMode.SEQUENCE.
| Argument | Type | Required | Description |
|---|---|---|---|
frameRate | number | Yes |
setLoop
Set whether the scene should loop.
| Argument | Type | Required | Description |
|---|---|---|---|
loop | boolean | Yes | True to enable looping. |
setPlayMode
Set how the scene turns a tick into a time step. In PlayMode.SEQUENCE every tick advances by one frame of the frame rate, whatever the caller reports, so a run is repeatable. In PlayMode.REALTIME every tick advances by the delta the caller reports, which is what a render loop supplies.
| Argument | Type | Required | Description |
|---|---|---|---|
playMode | number | Yes | One of PlayMode. |
setPlayModeToRealTime
Play by the time step the caller reports.
setPlayModeToSequence
Play by steps of one frame, the same on every run.
start
Alias of play().
stop
Stop the scene, reset it to the start time and stop every cue. Does nothing when the scene is already stopped, so a scene that ran to its end time keeps reporting that end time until it starts again.
tick
Advance the scene and every cue it holds. The scene owns its clock, so it moves by deltaTime and ignores the time the caller reports. The unused first argument keeps the signature of the cue this class derives from.
| Argument | Type | Required | Description |
|---|---|---|---|
currentTime | number | Yes | Unused. |
deltaTime | number | Yes | The time delta since last frame. |
clockTime | number | No | Wall clock time, handed down to the cues. |