the-world-engine
Version:
three.js based, unity like game engine for browser
57 lines (56 loc) • 1.54 kB
TypeScript
import { Component } from "../../hierarchy_object/Component";
import type { ComponentConstructor } from "../../hierarchy_object/ComponentConstructor";
/**
* simple sprite atlas animator
*
* this component will switch sprite atlas index every interval time
*
*
* disallow multiple component
*
* require components: `CssSpriteAtlasRenderer`
*/
export declare class SpriteAtlasAnimator extends Component {
readonly disallowMultipleComponent: boolean;
readonly requiredComponents: ComponentConstructor[];
private _spriteAtlasRenderer;
private _animations;
private _playingAnimationName;
private _playingAnimation;
private _playingAnimationFrame;
private _playing;
private _frameDuration;
private _currentFrameDuration;
private _pendingPlayAnimation;
awake(): void;
update(): void;
/**
* play animation by name
* @param name animation name
* @returns
*/
playAnimation(name: string): void;
/**
* stop current animation
*/
stopAnimation(): void;
/**
* add animation from atlas index array
* @param name animation name
* @param animationFrames animation frames
* @returns
*/
addAnimation(name: string, animationFrames: number[]): void;
/**
* frame duration (default: 2)
*
* larger value means slower animation
*/
get frameDuration(): number;
/**
* frame duration (default: 2)
*
* larger value means slower animation
*/
set frameDuration(value: number);
}