import { Texture, AnimatedSprite, Spritesheet } from 'pixi.js'; type EasingFunction = (t: number) => number; /** * Lightweight tween system integrated with PixiJS Ticker. * Zero external dependencies — no GSAP required. * * All tweens return a Promise that resolves on completion. * * @example * ```ts * // Fade in a sprite * await Tween.to(sprite, { alpha: 1, y: 100 }, 500, Easing.easeOutBack); * * // Move and wait * await Tween.to(sprite, { x: 500 }, 300); * * // From a starting value * await Tween.from(sprite, { scale: 0, alpha: 0 }, 400); * ``` */ declare class Tween { private static _tweens; private static _tickerAdded; /** * Animate properties from current values to target values. * * @param target - Object to animate (Sprite, Container, etc.) * @param props - Target property values * @param duration - Duration in milliseconds * @param easing - Easing function (default: easeOutQuad) * @param onUpdate - Progress callback (0..1) */ static to(target: any, props: Record, duration: number, easing?: EasingFunction, onUpdate?: (progress: number) => void): Promise; /** * Animate properties from given values to current values. */ static from(target: any, props: Record, duration: number, easing?: EasingFunction, onUpdate?: (progress: number) => void): Promise; /** * Animate from one set of values to another. */ static fromTo(target: any, fromProps: Record, toProps: Record, duration: number, easing?: EasingFunction, onUpdate?: (progress: number) => void): Promise; /** * Wait for a given duration (useful in timelines). * Uses PixiJS Ticker for consistent timing with other tweens. */ static delay(ms: number): Promise; /** * Kill all tweens on a target. */ static killTweensOf(target: any): void; /** * Kill all active tweens. */ static killAll(): void; /** Number of active tweens */ static get activeTweens(): number; /** * Reset the tween system — kill all tweens and remove the ticker. * Useful for cleanup between game instances, tests, or hot-reload. */ static reset(): void; private static ensureTicker; private static tick; /** * Get a potentially nested property (supports 'scale.x', 'position.y', etc.) */ private static getProperty; /** * Set a potentially nested property. */ private static setProperty; } /** * Sequential/parallel animation timeline built on top of Tween. * * @example * ```ts * const timeline = new Timeline(); * * // Sequential: one after another * timeline * .to(sprite1, { alpha: 1 }, 300) * .to(sprite2, { x: 200 }, 500) * .delay(200) * .call(() => console.log('done')); * * // Parallel: all at once * timeline.parallel( * () => Tween.to(sprite1, { x: 100 }, 300), * () => Tween.to(sprite2, { y: 200 }, 300), * ); * * await timeline.play(); * ``` */ declare class Timeline { private _steps; private _playing; private _cancelled; /** * Add a tween step (animate to target values). */ to(target: any, props: Record, duration: number, easing?: EasingFunction): this; /** * Add a tween step (animate from given values). */ from(target: any, props: Record, duration: number, easing?: EasingFunction): this; /** * Add a delay step. */ delay(ms: number): this; /** * Add a callback step. */ call(fn: () => void | Promise): this; /** * Add a parallel step — all functions run simultaneously, * step completes when all are done. */ parallel(...fns: Array<() => Promise>): this; /** * Play the timeline from start. * Returns a promise that resolves when all steps complete. */ play(): Promise; /** * Cancel the timeline. */ cancel(): void; /** * Clear all steps. */ clear(): this; /** Whether the timeline is currently playing */ get isPlaying(): boolean; } /** * Collection of easing functions for use with Tween and Timeline. * * All functions take a progress value t (0..1) and return the eased value. */ declare const Easing: Record & { readonly linear: EasingFunction; readonly easeInQuad: EasingFunction; readonly easeOutQuad: EasingFunction; readonly easeInOutQuad: EasingFunction; readonly easeInCubic: EasingFunction; readonly easeOutCubic: EasingFunction; readonly easeInOutCubic: EasingFunction; readonly easeInQuart: EasingFunction; readonly easeOutQuart: EasingFunction; readonly easeInOutQuart: EasingFunction; readonly easeInSine: EasingFunction; readonly easeOutSine: EasingFunction; readonly easeInOutSine: EasingFunction; readonly easeInExpo: EasingFunction; readonly easeOutExpo: EasingFunction; readonly easeInOutExpo: EasingFunction; readonly easeInBack: EasingFunction; readonly easeOutBack: EasingFunction; readonly easeInOutBack: EasingFunction; readonly easeOutBounce: EasingFunction; readonly easeInBounce: EasingFunction; readonly easeInOutBounce: EasingFunction; readonly easeOutElastic: EasingFunction; readonly easeInElastic: EasingFunction; }; /** * Helper for working with Spine animations in PixiJS v8. * * Optional — only works if @esotericsoftware/spine-pixi-v8 is installed. * Provides convenience methods for creating and playing Spine animations. * * @example * ```ts * // Load spine assets via AssetManager first * const spine = SpineHelper.create('char-data', 'char-atlas'); * app.stage.addChild(spine); * await SpineHelper.playAnimation(spine, 'idle', true); * await SpineHelper.playAnimation(spine, 'win'); * ``` */ declare class SpineHelper { private static _SpineClass; private static _loaded; /** * Ensure the Spine module is loaded. * Called automatically by create/playAnimation. */ static ensureLoaded(): Promise; /** * Create a Spine display object. * * @param skeletonAlias - Alias of the loaded .skel/.json asset * @param atlasAlias - Alias of the loaded .atlas asset * @param options - Additional Spine options * @returns Spine container (or null if Spine is not available) */ static create(skeletonAlias: string, atlasAlias: string, options?: { scale?: number; autoUpdate?: boolean; }): Promise; /** * Play a named animation on a Spine object. * Returns a promise that resolves when the animation completes. * For looping animations, the promise never resolves. * * @param spine - Spine display object * @param animationName - Name of the animation * @param loop - Whether to loop (default: false) * @param track - Animation track (default: 0) */ static playAnimation(spine: any, animationName: string, loop?: boolean, track?: number): Promise; /** * Queue an animation after the current one finishes. * * @param spine - Spine display object * @param animationName - Animation name * @param delay - Mix duration / delay before starting * @param loop - Loop the queued animation * @param track - Animation track */ static addAnimation(spine: any, animationName: string, delay?: number, loop?: boolean, track?: number): void; /** * Get all animation names available on a Spine skeleton. */ static getAnimationNames(spine: any): string[]; /** * Get all skin names available on a Spine skeleton. */ static getSkinNames(spine: any): string[]; /** * Set the active skin on a Spine skeleton. */ static setSkin(spine: any, skinName: string): void; } interface SpriteAnimationConfig { /** Frames per second (default: 24) */ fps?: number; /** Whether to loop (default: true) */ loop?: boolean; /** Start playing immediately (default: true) */ autoPlay?: boolean; /** Callback when animation completes (non-looping) */ onComplete?: () => void; /** Anchor point (default: 0.5 = center) */ anchor?: number | { x: number; y: number; }; } /** * Helper for creating frame-based animations from spritesheets. * * Wraps PixiJS `AnimatedSprite` with a convenient API for * common iGaming effects: coin showers, symbol animations, * sparkle trails, win celebrations. * * Cheaper than Spine for simple frame sequences. * * @example * ```ts * // From an array of textures * const coinAnim = SpriteAnimation.create(coinTextures, { * fps: 30, * loop: true, * }); * scene.addChild(coinAnim); * * // From a spritesheet with a naming pattern * const sheet = Assets.get('effects'); * const sparkle = SpriteAnimation.fromSpritesheet(sheet, 'sparkle_'); * sparkle.play(); * * // From a numbered range * const explosion = SpriteAnimation.fromRange(sheet, 'explosion_{i}', 0, 24, { * fps: 60, * loop: false, * onComplete: () => explosion.destroy(), * }); * ``` */ declare class SpriteAnimation { /** * Create an animated sprite from an array of textures. * * @param textures - Array of PixiJS Textures * @param config - Animation options * @returns Configured AnimatedSprite */ static create(textures: Texture[], config?: SpriteAnimationConfig): AnimatedSprite; /** * Create an animated sprite from a spritesheet using a name prefix. * * Collects all textures whose keys start with `prefix`, sorted alphabetically. * * @param sheet - PixiJS Spritesheet instance * @param prefix - Texture name prefix (e.g., 'coin_') * @param config - Animation options * @returns Configured AnimatedSprite */ static fromSpritesheet(sheet: Spritesheet, prefix: string, config?: SpriteAnimationConfig): AnimatedSprite; /** * Create an animated sprite from a numbered range of frames. * * The `pattern` string should contain `{i}` as a placeholder for the frame number. * Numbers are zero-padded to match the length of `start`. * * @param sheet - PixiJS Spritesheet instance * @param pattern - Frame name pattern, e.g. 'explosion_{i}' * @param start - Start frame index (inclusive) * @param end - End frame index (inclusive) * @param config - Animation options * @returns Configured AnimatedSprite */ static fromRange(sheet: Spritesheet, pattern: string, start: number, end: number, config?: SpriteAnimationConfig): AnimatedSprite; /** * Create an AnimatedSprite from texture aliases (loaded via AssetManager). * * @param aliases - Array of texture aliases * @param config - Animation options * @returns Configured AnimatedSprite */ static fromAliases(aliases: string[], config?: SpriteAnimationConfig): AnimatedSprite; /** * Play a one-shot animation and auto-destroy when complete. * Useful for fire-and-forget effects like coin bursts. * * @param textures - Array of textures * @param config - Animation options (loop will be forced to false) * @returns Promise that resolves when animation completes */ static playOnce(textures: Texture[], config?: SpriteAnimationConfig): { sprite: AnimatedSprite; finished: Promise; }; /** * Get all textures from a spritesheet that start with a given prefix. * Results are sorted alphabetically by key. */ static getTexturesByPrefix(sheet: Spritesheet, prefix: string): Texture[]; } export { Easing, SpineHelper, SpriteAnimation, Timeline, Tween }; export type { SpriteAnimationConfig };