import { ClientRemoteObject, RemoteClient } from 'jibo-client-framework'; import { Event, EventContainer } from 'jibo-typed-events'; import { PlayStatus } from 'jibo-common-types'; import { DOFSet } from 'animation-utilities'; /** * @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 */ export declare enum AnimationState { INVALID = "INVALID", PLAYING = "PLAYING", STOPPED = "STOPPED", STOPPING = "STOPPING", CANCELLED = "CANCELLED", PAUSED = "PAUSED", RESUMED = "RESUMED", STARTED = "STARTED", REJECTED = "REJECTED", } /** * @interface AnimationInstanceEvents * @description Typed Events for an `AnimationInstance`. * @prop {Event} 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} audio Emits when animation encounters an audio event. Passes in an * object with a `file` property. * @prop {Event} pixi Emits when animation encounters a pixi event. Passes in an * object with a `file` property. * @prop {Event} holdSafe Emits when the animation encounters a "HOLD_SAFE" event. * @prop {Event} stopped Emits when the animation stops. Usually use the resolution of `play` * to determine when this happens. * @prop {Event} started Emits when the animation starts. * @prop {Event} cancelled Emits when the animation is canceled by a higher priority system. * @prop {Event} rejected Emits when the animation is is rejected since a higher priority * animation is currently playing. */ export declare class AnimationEvents extends EventContainer { general: Event<{ name: string; payload: any; }>; audio: Event<{ file: string; }>; pixi: Event<{ file: string; layerNum: number; attach: boolean; offset: string; }>; holdSafe: Event; stopped: Event; cancelled: Event; rejected: Event; started: Event; stateChange: Event; } /** * Handle to an animation instance. Can only be played *once*. * @class AnimationInstance */ export declare class AnimationInstance extends ClientRemoteObject { protected client: RemoteClient; id: string; dofs: DOFSet; /** * Set of animation event emitters. * @type {AnimationInstanceEvents} * @name AnimationInstance#events */ events: AnimationEvents; AnimationState: typeof AnimationState; /** * Current state of the animation. * @type {AnimationState} * @name AnimationInstance#state */ state: AnimationState; private played; /** * Set of dofs this animation acts on. * @type {DOFSet} * @name AnimationInstance#dofs */ constructor(client: RemoteClient, instanceId: number, id: string, dofs: DOFSet, didPlay?: boolean); /** * Plays this animation on the robot. * @param {string} [requestor='Behavior'] The system making the animation request. * @returns {Promise} Resolves when the animation is finished playing or is canceled. * @method AnimationInstance#play */ play(requestor?: string): Promise; /** * Stops this animation if it is running. * @returns {Promise} Resolves when the animation is stopped. * @method AnimationInstance#stop */ stop(): Promise; /** * Pauses this animation if it is running. * @returns {Promise} Resolves when the animation is paused. * @method AnimationInstance#pause */ pause(): Promise; /** * Resumes this animation if it is paused. * @returns {Promise} Resolves when the animation is resumed. * @method AnimationInstance#resume */ resume(): Promise; /** * Removes all event listensers and * @method AnimationInstance#destroy */ destroy(): void; private setState(newState); private onEvent(eventName, payload); }