import type { Disposable } from "@goldenratio/core-utils"; import type { Karlib } from "./karlib.js"; import type { Texture } from "./texture.js"; import type { DrawTextureOptions } from "./types/types.js"; export interface AnimatedTextureOptions { /** * Ordered frames for the animation. */ readonly frames: readonly Texture[] | readonly string[]; /** * @default 0 */ readonly start_frame_index?: number; /** * Default per-frame duration (in milliseconds) * @default 100 */ readonly frame_duration?: number; /** * Number of times to loop. Use Infinity for infinite loop. * @default Infinity */ readonly loop?: number; /** * If true, play A->B->A (ping-pong). * @default false */ readonly ping_pong?: boolean; /** * Global playback speed multiplier. * @default 1 */ readonly speed?: number; /** * Start in playing state. * @default true */ readonly autoplay?: boolean; } export type DrawAnimatedTextureOptions = Omit; export declare class AnimatedTexture implements Disposable { private readonly kl; private readonly frames; private readonly frame_duration; private readonly ping_pong; private speed; private playing; private idx; private dir; private acc; private loops_remaining; private animation_complete_callback?; constructor(kl: Karlib, options: AnimatedTextureOptions); get_current_frame_index(): number; set_speed(value: number): void; set_on_animation_complete(fn: () => void): void; dispose(): void; stop(): void; play(): void; pause(): void; /** * Jump to the given frame index, clamped to [0, length-1]. */ goto_frame(frame_index: number): void; /** * Update loop * @param delta_time Scalar representing the delta time factor (value between 0 to 1) */ update(delta_time: number): void; /** * Draw */ draw(options?: DrawAnimatedTextureOptions): void; private animation_complete; private advance_index_by; private advance_index; }