import { Signal } from './signal.js'; import type { Game } from './game.js'; import type { Image } from '../display/image.js'; import type { FrameData } from './frame_data.js'; import type { Frame } from './frame.js'; export declare class Animation { game: Game; _parent: Image; _frameData: FrameData; name: string; _frames: number[]; delay: number; loop: boolean; loopCount: number; isFinished: boolean; isPlaying: boolean; isPaused: boolean; _pauseStartTime: number; _frameIndex: number; _frameDiff: number; _frameSkip: number; currentFrame: Frame | null; onStart: Signal; onUpdate: Signal | null; onComplete: Signal; onLoop: Signal; isReversed: boolean; _timeLastFrame: number; _timeNextFrame: number; /** * Creates a new Animation instance. * @param {Game} game - The game instance this animation belongs to. * @param {Image} parent - The Image object that owns this animation. * @param {string} name - The unique name of this animation. * @param {FrameData} frameData - The FrameData object that contains the frames for this animation. * @param {string[]|number[]} frames - An array of frame identifiers (names or indices) to use in this animation. * @param {number} frameRate - The frame rate at which this animation should play (frames per second). * @param {boolean} loop - Whether the animation should loop when it completes. */ constructor(game: Game, parent: Image, name: string, frameData: FrameData, frames: number[], frameRate: number, loop?: boolean); /** * Plays this animation. * @param {number} frameRate - The new frame rate to use for this animation (if null, uses the original frame rate). * @param {boolean} loop - Whether to loop this animation (if null, uses the original loop setting). * @returns {Animation} This Animation instance for chaining. */ play(frameRate?: number | null, loop?: boolean | null): this; /** * Restarts this animation from the beginning. */ restart(): void; /** * Reverses the direction of this animation. * @returns {Animation} This Animation instance for chaining. */ reverse(): this; /** * Reverses the animation direction once, then returns to normal direction. * @returns {Animation} This Animation instance for chaining. */ reverseOnce(): this; /** * Sets the current frame of this animation. * @param {string|number} frameId - The identifier (name or index) of the frame to set. * @param {boolean} useLocalFrameIndex - If true, treats frameId as an index into the local frames array. */ setFrame(frameId: string | number, useLocalFrameIndex?: boolean): void; /** * Stops this animation. * @param {boolean} resetFrame - If true, resets to the first frame. * @param {boolean} dispatchComplete - If true, dispatches the onComplete signal. */ stop(resetFrame?: boolean, dispatchComplete?: boolean): void; /** * Called when the game is paused. */ onPause(): void; /** * Called when the game is resumed. */ onResume(): void; /** * Updates this animation. * @returns {boolean} True if the animation was updated, false otherwise. */ update(): boolean; /** * Updates the current frame of this animation. * @param {boolean} signalUpdate - Whether to signal the update event. * @param {boolean} fromPlay - Whether this call is from play(). * @returns {boolean} True if the frame was updated, false otherwise. */ updateCurrentFrame(signalUpdate: boolean, fromPlay?: boolean): boolean; /** * Advances the animation to the next frame(s). * @param {number} quantity - The number of frames to advance by. */ next(quantity?: number): void; /** * Moves the animation to the previous frame(s). * @param {number} quantity - The number of frames to move back by. */ previous(quantity?: number): void; /** * Updates the frame data used by this animation. * @param {FrameData} frameData - The new FrameData object to use. */ updateFrameData(frameData: FrameData): void; /** * Destroys this animation and cleans up resources. */ destroy(): void; /** * Completes this animation, setting it to the final frame. */ complete(): void; /** * Gets whether this animation is currently paused. * @returns {boolean} True if the animation is paused, false otherwise. */ get paused(): boolean; /** * Sets whether this animation is currently paused. * @param {boolean} value - True to pause the animation, false to resume it. */ set paused(value: boolean); /** * Gets whether this animation is currently reversed. * @returns {boolean} True if the animation is reversed, false otherwise. */ get reversed(): boolean; /** * Sets whether this animation is currently reversed. * @param {boolean} value - True to reverse the animation, false to normal direction. */ set reversed(value: boolean); /** * Gets the total number of frames in this animation. * @returns {number} The total number of frames. */ get frameTotal(): number; /** * Gets the current frame index. * @returns {number} The current frame index. */ get frame(): number; /** * Sets the current frame index. * @param {number} value - The new frame index to set. */ set frame(value: number); /** * Gets the current animation speed (frame rate). * @returns {number} The frame rate in frames per second. */ get speed(): number; /** * Sets the animation speed (frame rate). * @param {number} value - The new frame rate in frames per second. */ set speed(value: number); /** * Gets whether the update signal is enabled. * @returns {boolean} True if the update signal is enabled, false otherwise. */ get enableUpdate(): boolean; /** * Sets whether the update signal is enabled. * @param {boolean} value - True to enable the update signal, false to disable it. */ set enableUpdate(value: boolean); } //# sourceMappingURL=animation.d.ts.map