@enable3d/three-graphics
Version:
3D library wrapping three.js and ammo.js
75 lines • 2.23 kB
TypeScript
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2021 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|LGPL-3.0}
*/
import { SimpleSprite } from './simpleSprite.js';
import { Texture } from 'three';
interface Frame {
name: string;
index: number;
width: number;
height: number;
}
interface Anims {
name: string;
rate: number;
repeat: number;
timeline: number[];
}
export declare abstract class ActionSprite extends SimpleSprite {
private _eventEmitter;
private _anims;
protected _flipX: boolean;
protected _frame: Frame;
get frame(): Frame;
private _currentIndex;
private _currentAnimationName;
get anims(): {
add: (name: string, frameOptions: {
start?: number;
end?: number;
rate?: number;
repeat?: number;
timeline?: number[];
}) => void;
get: (name: string) => Anims;
play: (name: string) => {
onComplete: (cb: Function) => void;
};
stop: () => void;
getName: () => string;
name: string;
};
interval: number;
constructor(texture: Texture);
/** Set the frame you want to show. */
abstract setFrame(frame: number | string): void;
/**
* Set the offset of the Texture.
* @param x A number from 0 to 1.
* @param y A number from 0 to 1.
*/
protected abstract offsetTexture(x: number, y: number): void;
/**
* Set the size of the Frame.
* @param width A number from 0 to 1.
* @param height A number from 0 to 1.
*/
protected abstract sizeFrame(width: number, height: number): void;
/**
* Scale the texture to the frame size.
*/
protected abstract scaleFrame(): void;
abstract flipX(flip: boolean): void;
getAnimationByName(name: string): Anims;
private _add;
private _stop;
private _play;
protected get _events(): {
emit: (event: string) => void;
once: (event: string, callback: Function) => void;
};
}
export {};
//# sourceMappingURL=actionSprite.d.ts.map