Commands
VuppetMaster
All the following commands are functions of the api
object from new Vuppetmaster
.
constructor
Example:
vm = new VM.Vuppetmaster();
start
Parameter: options
object
The command start(options)
loads the project and starts the render and animation engine.
Options object:
ignore_aspect_ratio
: Normally the aspect ratio defined in STorybuilder will be used. With the parameter you can ignore the valuse [default: false]language
: set lanuage ('en','de',...)hideModelsAfterLoading
: [default: false]target
: div name to render
The command start
should be started only once per session. It is also important, that the size of the DIV target has allway a size greater then 0.
Example:
vm.api.start( { target: 'renderdiv' });
destroy
Stops rendering.
vm.api.destroy();
on
Parameter: event
string
Event | Description | Parameter |
---|---|---|
project.loaded | The project is loaded | |
model.progress | Called while loading the model | value of the loading progress |
With the event model.progress
you can handle an own loading progress bar. In this case, the internal orange progress bar will be not rendered.
Example:
vm.api.on('project.loaded', { () => { console.log('loaded') } };vm.api.on('model.progress', { (value) => { console.log('progress ',value * 100, '%')}}
playAnimationByName()
Parameter: name
string
With playAnimationByName
an animation created in Stroybuilder
can be started.
Example:
vm.api.playAnimationByName('animation1');
setSceneByName()
Parameter: name
string
setSceneByName
set the current scene.
Example:
vm.api.setSceneByName('Scene1');
playSequenceByName()
Parameter: name
string
With playSequenceByName
an sequence created in Stroybuilder
can be started.
Example:
vm.api.playSequenceByName('sequence1');
setCameraByName
Parameter: name
: [string] name of the camera
setCameraByName
moves the camera to in the project definded camera.
setCamera(name, duration);
Parameter:
name
: Name of the cameraoptions
: Options
{"duration": 500 //Duration of the camera movement in milliseconds}
speak
Sends a text sequence, which will be spoken by the avatar using a server sided TTS.
speak(jsonobject);
The json object has the following keys:
voice
: Voicenametext
: Text to speakendCB
: Function callback when the tts output has ended (optional)
The voice key defines the voice name of the Amazon Polly TTS. See list in http://docs.aws.amazon.com/polly/latest/dg/voicelist.html
Example
{"voice": "Marlene","text": "my name is Marlene"}
or a SSML text like:
{"voice": "Marlene","text": "<speak>my name is Marlene</speak>"}
See http://docs.aws.amazon.com/polly/latest/dg/supported-ssml.html for more information about SSML.
For compatibility reasons, it is also possible to call speak
with a normal string: speak('Hello');
speakStop
Stops the current running speak sound.
speakStop();