85 lines
2.8 KiB
JavaScript
85 lines
2.8 KiB
JavaScript
|
|
/**
|
||
|
|
* @description Enum of animation states
|
||
|
|
* @typedef AnimationState
|
||
|
|
* @prop INVALID
|
||
|
|
* @prop PLAYING
|
||
|
|
* @prop STOPPED
|
||
|
|
* @prop STOPPING
|
||
|
|
* @prop CANCELLED
|
||
|
|
* @prop PAUSED
|
||
|
|
* @prop RESUMED
|
||
|
|
* @prop STARTED
|
||
|
|
* @prop REJECTED
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @interface AnimationInstanceEvents
|
||
|
|
* @description Typed Events for an `AnimationInstance`.
|
||
|
|
* @prop {Event<Object>} general Emits when any other event occurs. Passes in an object with
|
||
|
|
* a `name` property, which is the event name, and a `payload`
|
||
|
|
* property, which is the payload of the event.
|
||
|
|
* @prop {Event<Object>} audio Emits when animation encounters an audio event. Passes in an
|
||
|
|
* object with a `file` property.
|
||
|
|
* @prop {Event<Object>} pixi Emits when animation encounters a pixi event. Passes in an
|
||
|
|
* object with a `file` property.
|
||
|
|
* @prop {Event<void>} holdSafe Emits when the animation encounters a "HOLD_SAFE" event.
|
||
|
|
* @prop {Event<void>} stopped Emits when the animation stops. Usually use the resolution of `play`
|
||
|
|
* to determine when this happens.
|
||
|
|
* @prop {Event<void>} started Emits when the animation starts.
|
||
|
|
* @prop {Event<void>} cancelled Emits when the animation is canceled by a higher priority system.
|
||
|
|
* @prop {Event<void>} rejected Emits when the animation is is rejected since a higher priority
|
||
|
|
* animation is currently playing.
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle to an animation instance. Can only be played *once*.
|
||
|
|
* @class AnimationInstance
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set of animation event emitters.
|
||
|
|
* @type {AnimationInstanceEvents}
|
||
|
|
* @name AnimationInstance#events
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Current state of the animation.
|
||
|
|
* @type {AnimationState}
|
||
|
|
* @name AnimationInstance#state
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set of dofs this animation acts on.
|
||
|
|
* @type {DOFSet}
|
||
|
|
* @name AnimationInstance#dofs
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Plays this animation on the robot.
|
||
|
|
* @param {string} [requestor='Behavior'] The system making the animation request.
|
||
|
|
* @returns {Promise<PlayStatus>} Resolves when the animation is finished playing or is canceled.
|
||
|
|
* @method AnimationInstance#play
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Stops this animation if it is running.
|
||
|
|
* @returns {Promise<void>} Resolves when the animation is stopped.
|
||
|
|
* @method AnimationInstance#stop
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Pauses this animation if it is running.
|
||
|
|
* @returns {Promise<void>} Resolves when the animation is paused.
|
||
|
|
* @method AnimationInstance#pause
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Resumes this animation if it is paused.
|
||
|
|
* @returns {Promise<void>} Resolves when the animation is resumed.
|
||
|
|
* @method AnimationInstance#resume
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Removes all event listensers and
|
||
|
|
* @method AnimationInstance#destroy
|
||
|
|
*/
|