AnimationCue
Introduction
vtkAnimationCue represents a single animation cue that can be played, paused, and stopped. It tracks elapsed time between a start and end time and fires tick events each frame to drive animation logic. Cues are typically managed by a vtkAnimationScene.
Methods
checkEndCue
True when an active cue reaches its end time.
| Argument | Type | Required | Description |
|---|---|---|---|
time | number | Yes |
checkStartCue
True when an uninitialized cue reaches its start time.
| Argument | Type | Required | Description |
|---|---|---|---|
time | number | Yes |
extend
Method used to decorate a given object (publicAPI+model) with vtkAnimationCue 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 | IAnimationCueInitialValues | No | (default: {}) |
finalize
End a running cue without waiting for the time to leave its window. This invokes the end event.
getAnimationTime
Get the time this cue holds, on the timeline of the scene that drives it.
getClockTime
Get the wall clock time the last tick reported.
getCueState
Get the state this cue holds. Distinct from the vtkObject getState() that serializes the object.
getDeltaTime
Get the time step of the last tick.
getEndTime
Get the end time of this cue.
getStartTime
Get the start time of this cue.
getTime
Alias of getAnimationTime().
getTimeMode
Get how the cue reads its own start and end times.
initialize
Reset the cue to UNINITIALIZED for another run.
invokeEndCueEvent
Invoke the end event with the given event data.
| Argument | Type | Required | Description |
|---|---|---|---|
event | object | Yes | The event data. |
invokeStartCueEvent
Invoke the start event with the given event data.
| Argument | Type | Required | Description |
|---|---|---|---|
event | object | Yes | The event data. |
invokeTickEvent
Invoke the tick event with the given event data.
| Argument | Type | Required | Description |
|---|---|---|---|
event | object | Yes | The tick event data. |
isActive
Check if the cue is active (playing or paused).
isCueStarted
True while the cue runs, that is between the two checks above.
isPlaying
Check if the cue is currently playing.
newInstance
Method used to create a new instance of vtkAnimationCue.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IAnimationCueInitialValues | No | for pre-setting some of its content |
onEndCueEvent
Register a callback function invoked when the time leaves the cue window.
| Argument | Type | Required | Description |
|---|---|---|---|
callback | Function | Yes | Function invoked with { time }. |
onStartCueEvent
Register a callback function invoked when the time enters the cue window.
| Argument | Type | Required | Description |
|---|---|---|---|
callback | Function | Yes | Function invoked with { time }. |
onTickEvent
Register a callback function invoked on each tick.
| Argument | Type | Required | Description |
|---|---|---|---|
callback | Function | Yes | Function invoked with { time, deltaTime, clockTime }. |
pause
Pause the cue. Does nothing unless the cue is playing.
play
Start playing the cue. A paused active cue continues from the time it holds; an uninitialized or inactive cue starts from the start time.
seek
Alias of setAnimationTime().
| Argument | Type | Required | Description |
|---|---|---|---|
time | number | Yes | Time within the cue, clamped to its bounds. |
setAnimationTime
Move to a time inside the cue and report it through the tick event without changing its lifecycle state, so a scene can scrub without starting it.
| Argument | Type | Required | Description |
|---|---|---|---|
time | number | Yes | Time within the cue, clamped to its bounds. |
setEndTime
Set the end time of this cue.
| Argument | Type | Required | Description |
|---|---|---|---|
endTime | number | Yes | The end time. |
setStartTime
Set the start time of this cue.
| Argument | Type | Required | Description |
|---|---|---|---|
startTime | number | Yes | The start time. |
setTimeMode
Set how the cue reads its own start and end times.
| Argument | Type | Required | Description |
|---|---|---|---|
timeMode | number | Yes | One of TimeMode. |
setTimeModeToNormalized
Read the start and end times as fractions of the scene duration.
setTimeModeToRelative
Read the start and end times on the timeline of the scene.
stop
Stop the cue and reset it to the start time. Does nothing when the cue is already stopped at the start time.
tick
Called by the animation scene to update cue time each frame. An UNINITIALIZED cue enters its window on its own and an INACTIVE cue ignores subsequent ticks.
| Argument | Type | Required | Description |
|---|---|---|---|
currentTime | number | Yes | Time the scene held before this step. |
deltaTime | number | Yes | Length of this step. |
clockTime | number | No | Wall clock time, reported by getClockTime(). |