If true, the animation will clamp when finished
the object this component is attached to. Note that this is a threejs Object3D with some additional features
the unique identifier for this component
Set to true to loop the animation
true
Optional
minThe normalized offset to start the animation at. This will override startTime
undefined
Optional
minThe animation min-max speed range
undefined
If true, the animation will start playing when the component is enabled
If true, the animation will start at a random time. This is used when the animation component is enabled
true
Optional
sourceholds the source identifier this object was created with/from (e.g. if it was part of a glTF file the sourceId holds the url to the glTF)
The animation actions
true if the object is enabled and active in the hierarchy
Get the first animation clip in the animations array
Set the first animation clip in the animations array
true if this component was destroyed (this.destroy()
) or the whole object this component was part of
Is any animation playing?
the layer of the gameObject this component is attached to
the name of the gameObject this component is attached to
shorthand for this.context.scene
the scene of the context
Is the gameObject marked as static
the tag of the gameObject this component is attached to
The time in seconds of the first running animation action
0
Optional
earlyOptional
lateOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onCallback when this component joins a xr session (or becomes active in a running XR session)
Optional
onCallback when this component exists a xr session (or when it becomes inactive in a running XR session)
Optional
onOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onCallback when a xr session updates (while it is still active in XR session)
Optional
onOptional
onXRControllerCallback when a controller is connected/added while in a XR session
OR when the component joins a running XR session that has already connected controllers
OR when the component becomes active during a running XR session that has already connected controllers
Optional
onXRControllerPlay an animation clip or an clip at the specified index.
the animation clip, index or name to play. If undefined, the first animation in the animations array will be played
Optional
options: PlayOptionsthe play options. Use to set the fade duration, loop, speed, start time, end time, clampWhenFinished
a promise that resolves when the animation is finished (note that it will not resolve if the animation is looping)
Optional
resolveOptional
startstarts a coroutine (javascript generator function)yield
will wait for the next frame:
yield WaitForSeconds(1)
to wait for 1 second.yield WaitForFrames(10)
to wait for 10 frames.yield new Promise(...)
to wait for a promise to resolve.generator function to start
event to register the coroutine for (default: FrameEvent.Update). Note that all coroutine FrameEvent callbacks are invoked after the matching regular component callbacks. For example FrameEvent.Update
will be called after regular component update()
methods)
the generator function (use it to stop the coroutine with stopCoroutine
)
onEnable() { this.startCoroutine(this.myCoroutine()); }
private *myCoroutine() {
while(this.activeAndEnabled) {
console.log("Hello World", this.context.time.frame);
// wait for 5 frames
for(let i = 0; i < 5; i++) yield;
}
}
Stops a specific animation clip or index. If clip is undefined then all animations will be stopped
Optional
clip: anyOptional
opts: Pick<PlayOptions, "fadeDuration">Stops all currently playing animations
Optional
opts: Pick<PlayOptions, "fadeDuration">Stop a coroutine that was previously started with startCoroutine
the routine to be stopped
the frame event to unregister the routine from (default: FrameEvent.Update)
Optional
supportsXROptional callback, you can implement this to only get callbacks for VR or AR sessions if necessary.
true if the mode is supported (if false the mode is not supported by this component and it will not receive XR callbacks for this mode)
Generated using TypeDoc
Animation component to play animations on a GameObject