import { SpriteFrame } from "../sprites/types.js"; import { Animation, AnimationState, PlayOptions } from "./types.js"; //#region src/animation/AnimationController.d.ts type FrameCallback = (frame: SpriteFrame) => void; type EventCallback = (event: string, frameIndex: number) => void; /** * Controls animation playback and state. * * @example * ```typescript * const controller = new AnimationController(); * controller.addAnimation({ * name: 'walk', * frames: walkFrames, * fps: 12, * loop: true, * }); * controller.play('walk'); * * // In update loop * controller.update(deltaMs, (frame) => { * sprite.setFrame(frame); * }); * ``` */ declare class AnimationController { private animations; private current; private frameIndex; private elapsed; private playing; private paused; private loopCount; private speed; private direction; private options; /** * Add an animation definition. */ addAnimation(animation: Animation): this; /** * Add multiple animations. */ addAnimations(animations: Animation[]): this; /** * Remove an animation. */ removeAnimation(name: string): this; /** * Get an animation by name. */ getAnimation(name: string): Animation | undefined; /** * Get all animation names. */ getAnimationNames(): string[]; /** * Play an animation. */ play(name: string, options?: PlayOptions): this; /** * Pause the current animation. */ pause(): this; /** * Resume a paused animation. */ resume(): this; /** * Stop the current animation. */ stop(): this; /** * Go to a specific frame. */ gotoFrame(index: number): this; /** * Update animation state. * @param deltaMs Time since last update in milliseconds * @param onFrame Callback when frame changes * @param onEvent Callback when frame event fires */ update(deltaMs: number, onFrame?: FrameCallback, onEvent?: EventCallback): void; /** * Handle loop completion. * @returns true if should continue looping */ private handleLoopComplete; /** * Get current frame. */ getCurrentFrame(): SpriteFrame | null; /** * Get current animation state. */ getState(): AnimationState; /** * Check if an animation is playing. */ isPlaying(name?: string): boolean; /** * Get current animation name. */ get currentAnimation(): string | null; /** * Get playback speed. */ getSpeed(): number; /** * Set playback speed. */ setSpeed(speed: number): this; /** * Get animation duration in milliseconds. */ getAnimationDuration(name: string): number; /** * Dispose of resources. */ dispose(): void; } //#endregion export { AnimationController }; //# sourceMappingURL=AnimationController.d.ts.map