Class: core/GestureFeature

core/GestureFeature(host, optionsopt, layers)

Gesture allows you to play animations on demand on one or more layers from script
or ssml. If gesture is played that is a QueueState, the queue will automatically
be progressed after a given hold time if a looping queued state is reached. Gesture
layers can optionally be automatically disabled when no gesture animation is
in progress.

Constructor

new core/GestureFeature(host, optionsopt, layers)

Parameters:
Name Type Attributes Description
host core/HostObject

Host object that owns the feature.

options Object <optional>

Optional options for the feature.

Properties
Name Type Attributes Default Description
holdTime number <optional>
3

Amount of time in seconds that must
elapse before advancing a gesture that's a QueueState when the current
state in the queue is set to loop infinitely.

minimumInterval number <optional>
0.25

The minimum amount of time
in seconds that must elapse before another gesture can be played.

layers Object

An object that maps layer names to layer options.
These are the layers that will be registered as tracked gesture layers. See
ManagedAnimationLayerInterface#registerLayer for more information
on expected format for each layer options object.

Implements:

Extends

Members

(readonly) host

Gets the host that manages the feature.

Overrides:

(readonly) owner

Gets the engine owner object of the host.

Overrides:

Methods

createGenericGestureArray(layersopt) → {Array.<string>}

Create an array that contains ssml mark syntax required to play each gesture
that does not have any associated words. The resulting array can be used as
an input for TextToSpeechUtils.autoGenerateSSMLMarks or
TextToSpeechUtils.addMarksToUnmarkedSentences to update a speech
string with the markup required to play random gestures at each unmarked
sentence in the string.

Parameters:
Name Type Attributes Description
layers Array.<string> <optional>

An array of names of managed layers to generate
marks for. If undefined, use all managed layers.

Returns:
Type
Array.<string>

createGestureMap() → {Object}

Create an object that maps ssml mark syntax required to play each gesture to
the words array associated with each gesture. Words arrays are defined at when
the gesture animation is registered. Gestures without associated words will
be excluded from the result. The resulting object can be used as an input
for TextToSpeechUtils.autoGenerateSSMLMarks to update a speech string
with the markup required to play gestures timed with their associated words.

Returns:
Type
Object

discard()

Clean up once the feature is no longer in use. Remove the feature namespace
from the host and remove reference to the host.

Overrides:
Implements:

emit(message, valueopt)

Emit feature messages from the host. Feature messages will be prefixed with
the class name of the feature.

Parameters:
Name Type Attributes Description
message string

The message to emit.

value any <optional>

Optional parameter to pass to listener callbacks.

Overrides:

installApi()

Adds a namespace to the host with the name of the feature to contain properties
and methods from the feature that users of the host need access to.

Overrides:

listenTo(message, callback)

Listen to a feature message from the host object.

Parameters:
Name Type Description
message string

Message to listen for.

callback function

The callback to execute when the message is received.

Overrides:

playGesture(layerName, animationName, optionsopt)

Play a managed gesture animation.

Parameters:
Name Type Attributes Description
layerName string

The name of the layer that contains the gesture
animation.

animationName string

The name of the gesture animation.

options Object <optional>

Optional gesture options.

Properties
Name Type Attributes Description
holdTime number <optional>

This option only applies to QueueState
gestures. When a QueueState gesture progresses to a looping state, this option
defines how many seconds should elapse before moving the queue forward. If
undefined, it will fall back first to the holdTime defined in the options when
the gesture animation was registered and then to the holdTime defined on the
feature.

minimumInterval number <optional>

The minimum amount of time that
must have elapsed since the last time a gesture was played.

registerAnimation(layerName, animationName, optionsopt)

Start tracking keeping track of whether an animation with the given name is
present on the host.

Parameters:
Name Type Attributes Description
layerName string

Name of the layer that will own the animation.

animationName string

Name of the animation to keep track of.

options Object <optional>

Options for the animation.

Implements:

registerLayer(name, optionsopt)

Start tracking keeping track of whether a layer with the given name is present
on the host.

Parameters:
Name Type Attributes Description
name string

Name of the layer to keep track of.

options Object <optional>

Options for the layer.

Properties
Name Type Attributes Description
blendTime number <optional>

Default amount of time to use when
manipulating layer weights on this layer.

easingFn function <optional>

Default easing function to use when
manipulating layer weights on this layer.

animations Object <optional>

Animations to keep track of on the layer.
Animations are represented as key/value pairs of animation names and their
options.

Implements:

stopListening(message, callbackopt)

Stop listening to a message from the host object.

Parameters:
Name Type Attributes Description
message string

Message to stop listening for.

callback function <optional>

Optional callback to remove. If none is defined,
remove all callbacks for the message.

Overrides:

stopListeningByRegexp(regexp, callbackopt)

Stop listening to a message matching the given regular expression from the
host object.

Parameters:
Name Type Attributes Description
regexp Regexp

The regular expression to stop listening for.

callback function <optional>

Optional callback to remove. If none is defined,
remove all callbacks for the message.

Overrides:

stopListeningToAll()

Stop listening to all messages.

Overrides:

update(deltaTime)

Executes each time the host is updated.

Parameters:
Name Type Description
deltaTime number

Amount of time since the last host update was
called.

Overrides: