UNPKG

@meganetaaan/mouse-follower

Version:

TypeScript library for creating animated sprites that smoothly follow mouse cursor or other targets using physics-based movement

54 lines 1.39 kB
import type { Position, SpriteConfig, SpriteDirection } from "./types.js"; /** * New Sprite class with separated concerns * Integrates Animation, Canvas, and DOM management */ export declare class Sprite { #private; constructor(config: SpriteConfig, parent?: HTMLElement); /** * Initialize sprite - load image and set up DOM */ initialize(): Promise<void>; /** * Attach sprite to DOM element */ attach(parent: HTMLElement): void; /** * Detach sprite from DOM */ detach(): void; /** * Destroy sprite and clean up resources */ destroy(): void; /** * Render sprite at given position with direction (ISprite compatible) */ render(position: Position, direction?: SpriteDirection): void; /** * Alternative render method accepting x, y coordinates */ renderAt(x: number, y: number, direction: SpriteDirection): void; /** * Play animation by name */ playAnimation(name: string): void; /** * Pause current animation */ pauseAnimation(): void; /** * Check if animation is currently playing */ isAnimating(): boolean; /** * Get current animation name */ getCurrentAnimation(): string; /** * Get current frame index */ getCurrentFrameIndex(): number; } //# sourceMappingURL=sprite.d.ts.map