Space Animations & Environmental Effects
Control animations within your virtual spaces to create dynamic, living environments. Perfect for environmental storytelling, interactive elements, and creating engaging virtual experiences.
getAnimations
getAnimations(geometryId: string, callback: Function)
Returns the list of animations available for a specific geometry in the virtual space. Use this to create interactive environmental elements.
The geometryId
is the ID of the geometry, which can be found via getGeometries.
Virtual Environment Example:
// Get animations for an interactive space element (e.g., animated furniture, decorations)
api.getAnimations(geometryId, function(animations){
console.log('Space element animations:', animations); // Result: [{ name: 'rotate', speedRatio: 1 }]
// Create interactive controls for space elements
});
2
3
4
5
playAnimation
playAnimation(geometryId: string, animationId: string, callback: Function)
Plays an animation for a specific geometry in the virtual space. Perfect for creating interactive environmental elements or storytelling sequences. Get the animationId from the getAnimations list.
The geometryId
is the ID of the geometry, which can be found via getGeometries.
Interactive Space Example:
// Play an environmental animation (e.g., rotating display, moving decoration)
api.playAnimation(geometryId, 'rotate', function(){
console.log('Space element animation playing');
// Update space interaction state
});
2
3
4
5
pauseAnimation
pauseAnimation(geometryId: string, animationId: string, callback: Function)
Pauses the animation by animationId. Get the animationId from the getAnimations list.
The geometryId
is the ID of the geometry, which can be found via getGeometries.
api.pauseAnimation(geometryId, 'walk', function(){
console.log('Animation paused');
});
2
3
stopAnimation
stopAnimation(geometryId: string, animationId: string, callback: Function)
Stops the animation by animationId. Get the animationId from the getAnimations list.
The geometryId
is the ID of the geometry, which can be found via getGeometries.
api.stopAnimation(geometryId, 'walk', function(){
console.log('Animation stopped');
});
2
3
stopAnimations
stopAnimations(geometryId: string, callback: Function)
Stops all the animations.
The geometryId
is the ID of the geometry, which can be found via getGeometries.
api.stopAnimations(geometryId, function(){
console.log('All animations stopped');
});
2
3
setAnimationCycleMode
setAnimationCycleMode(geometryId: string, animationId: string, mode: 'loop' | 'once' , callback: Function)
Sets the animation cycle mode. (Default is once
). Get the animationId from the getAnimations list.
The geometryId
is the ID of the geometry, which can be found via getGeometries.
api.setAnimationCycleMode(geometryId, 'walk', 'loop', function(){
console.log('Animation cycle mode changed');
});
2
3
setAnimationSpeed
setAnimationSpeed(geometryId: string, speed: number, callback: Function)
Sets the global animation speed.
The geometryId
is the ID of the geometry, which can be found via getGeometries.
speed
is a speed factor (a number, default is 1). A negative value will play the animation in reverse.
api.setAnimationSpeed(geometryId, 1.5, function(){
console.log('Animation speed changed');
});
2
3