UNPKG

@koreez/phaser2-animate

Version:
115 lines (114 loc) 3.01 kB
export interface IAnimateData { s: string[]; i: string[]; l: IAnimateLayerData[]; m: { f: number; }; } interface IAnimateLayerData { f: IAnimateFrameData[]; } interface IAnimateFrameData { e: Array<{ s: IAnimateFrameElementSymbolInstance; }>; } interface IAnimateFrameElementSymbolInstance { t: IDecomposedMatrix; s: number; i: number; c: IAnimateFrameElementSymbolInstanceColor; } interface IAnimateFrameElementSymbolInstanceColor { m: string; rm: number; gm: number; bm: number; am: number; ro: number; go: number; bo: number; ao: number; tc: string; tm: number; } interface IDecomposedMatrix { p: string; r: number; s: string; } export declare class Animate extends Phaser.Sprite { /** * Specifies the number of the frame in which the playhead is located in * the timeline of the Animate instance. */ readonly currentFrame: number; /** * The total number of frames in the Animate instance. */ readonly totalFrames: number; loop: boolean; /** * A Boolean value that indicates whether a movie clip is curently playing. */ readonly isPlaying: boolean; private _layers; private _totalFrames; private _currentFrame; private _startFrame; private _endFrame; private _paused; private _textureKey; private _loop; constructor(game: Phaser.Game, x: number, y: number, animationData: IAnimateData, textureKey?: string, loop?: boolean); /** * Starts playing the Animate file at the specified frame. * * @param frame A number representing the frame number, to which the playhead is sent. * @param endFrame A number representing the frame number, to which the playhead is stop. * */ gotoAndPlay(frame: number, endFrame?: number): void; /** * Brings the playhead to the specified frame of the Animate and stops it there. * * @param frame A number representing the frame number, to which the playhead is sent. */ gotoAndStop(frame: number): void; /** * Brings the playhead to the specified frame. * * @param startFrame A number representing the frame number, to which the playhead is sent. * @param endFrame A number representing the frame number, to which the playhead is loop. */ gotoAndLoop(startFrame: number, endFrame: number): void; /** * Sends the playhead to the next frame and stops it. * */ nextFrame(): void; /** * Sends the playhead to the previous frame and stops it. * */ prevFrame(): void; /** * Moves the playhead in the timeline of the Animate. * */ play(): void; /** * Stops the playhead in the Animate. * */ stop(): void; update(): void; private onNextFrame; private clearFrames; private drawFrames; private goTo; private playFrames; private static parse; } export {};