import { default as React } from 'react';
import { PuppetCharacterDef, CharacterAnimation, CharacterExpression, CharacterRuntimeState, AnimationFrameDef } from './puppetShowTypes';

export interface AnimationControllerOptions {
    fps?: number;
    onAnimationComplete?: (animationId: string) => void;
    onFrameEvent?: (animationId: string, event: string) => void;
}
export declare class PuppetAnimationController {
    private character;
    private currentAnimation;
    private frameIndex;
    private elapsed;
    private playing;
    private loop;
    private speed;
    private onComplete;
    private onEvent;
    constructor(character: PuppetCharacterDef, options?: AnimationControllerOptions);
    getCharacter(): PuppetCharacterDef;
    getCurrentAnimation(): CharacterAnimation | null;
    getCurrentFrameIndex(): number;
    isPlaying(): boolean;
    play(animationId: string, options?: {
        loop?: boolean;
        speed?: number;
        startFrame?: number;
    }): void;
    stop(): void;
    pause(): void;
    resume(): void;
    setSpeed(speed: number): void;
    update(deltaTime: number): void;
    private checkFrameEvent;
    getCurrentFrame(): AnimationFrameDef | null;
    getSpriteRect(): {
        x: number;
        y: number;
        w: number;
        h: number;
    } | null;
}
export interface CharacterRenderState {
    position: {
        x: number;
        y: number;
    };
    scale: number;
    rotation: number;
    opacity: number;
    flipX: boolean;
    visible: boolean;
}
export declare function renderCharacterToCanvas(ctx: CanvasRenderingContext2D, character: PuppetCharacterDef, spriteSheet: HTMLImageElement, animationController: PuppetAnimationController, state: CharacterRenderState): void;
export interface PuppetCharacterProps {
    character: PuppetCharacterDef;
    state: CharacterRuntimeState;
    spriteSheet?: HTMLImageElement;
    className?: string;
    style?: React.CSSProperties;
}
export declare function PuppetCharacter({ character, state, spriteSheet, className, style, }: PuppetCharacterProps): React.ReactElement | null;
export declare class CharacterRegistry {
    private characters;
    private spriteSheets;
    private loadingPromises;
    register(character: PuppetCharacterDef): void;
    unregister(id: string): void;
    get(id: string): PuppetCharacterDef | undefined;
    getAll(): PuppetCharacterDef[];
    loadSpriteSheet(characterId: string): Promise<HTMLImageElement>;
    getSpriteSheet(characterId: string): HTMLImageElement | undefined;
}
export declare function usePuppetAnimation(character: PuppetCharacterDef, options?: AnimationControllerOptions): {
    controller: PuppetAnimationController;
    currentFrame: AnimationFrameDef | null;
    frameIndex: number;
    isPlaying: boolean;
    play: (animationId: string, opts?: {
        loop?: boolean;
        speed?: number;
    }) => void;
    stop: () => void;
    pause: () => void;
    resume: () => void;
};
export declare function useCharacterRegistry(): {
    registry: CharacterRegistry;
    register: (character: PuppetCharacterDef) => void;
    get: (id: string) => PuppetCharacterDef | undefined;
    loadSpriteSheet: (id: string) => Promise<HTMLImageElement>;
};
export declare function createCharacterFromSpriteSheet(id: string, name: string, spriteSheetUrl: string, frameWidth: number, frameHeight: number, frameCount: number, columns: number): PuppetCharacterDef;
export declare function addAnimationToCharacter(character: PuppetCharacterDef, animationId: string, name: string, frameIds: string[], fps: number, loop: boolean, category?: CharacterAnimation['category']): PuppetCharacterDef;
export declare function addExpressionToCharacter(character: PuppetCharacterDef, expressionId: string, name: string, emotion: CharacterExpression['emotion'], frameId?: string, overlay?: string): PuppetCharacterDef;
//# sourceMappingURL=puppetCharacter.d.ts.map