This module controls the animation happening. The properties of an animation are defined here in the Animation type.
Animations can be queued dynamically with queueAnimation
Or, to play existing clips, queue a clip for playing with queueClip
.
Methods
(static) findAnimation(idOrName) → {Promise}
Find and return an animation if it is currently runing.
Parameters:
Name | Type | Description |
---|---|---|
idOrName |
String |
|
Returns:
- Type
- Promise
(static) getClips() → {Array.<Clip>}
Return a list of clips available.
Returns:
- Type
- Array.<Clip>
(static) getTime() → {Number}
Return the current animation time.
Returns:
- Type
- Number
(static) initializeAutoRotate()
Initialize the AutoRotate capability on the player. This must be initialized before the scene renders (so call immediately after the scene has been fetched.)
Example
api.sceneIO.fetchAndUse(sceneId).then(function() {
api.animation.initializeAutoRotate();
})
(static) queueAnimation(attrs) → {Promise}
Queue an animation
Parameters:
Name | Type | Description |
---|---|---|
attrs |
Animation | the animation object |
Returns:
- Type
- Promise
(static) queueClip(clipId, attrs, options) → {Promise}
Queue a clip to be played
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
clipId |
String | the id of the clip to be queued. |
||||||
attrs |
Object | Attrs to override the clip settings. |
||||||
options |
Object |
Properties
|
Returns:
- Type
- Promise
Example
var clips = animation.getClips();
animation.queueClip(clips[0].id, {autoplay: true});
(static) removeAnimation(idOrName) → {Promise}
Remove an animation
Parameters:
Name | Type | Description |
---|---|---|
idOrName |
String |
|
Returns:
- Type
- Promise
(static) setTime(time)
Set the current animation time.
Parameters:
Name | Type | Description |
---|---|---|
time |
Number | in seconds |
(static) startPlaying()
Start time
(static) stopPlaying()
Stop time
(static) updateAnimationAttrs(name, attrs)
Update the attributes of a running animation.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | the name of the animation to update |
attrs |
Animation | the animation object attributes |