UNPKG

@phantasy/live2d-sdk

Version:

Reusable SDK for Live2D models with TTS and lip sync integration

99 lines (98 loc) 2.55 kB
/** * Main Phantasy Live2D SDK Class * Integrates Live2D models with TTS and lip sync functionality */ import { SDKEventEmitter } from './EventEmitter'; import type { PhantasyLive2DConfig, SDKDefaults } from '../types/config'; import type { Live2DModel } from '../types/live2d'; export declare class PhantasyLive2D extends SDKEventEmitter { private static defaults; private config; private configManager; private ttsManager; private modelManager; private lipSyncEngine; private logger; private container; private isInitialized; private isDestroyed; constructor(config: PhantasyLive2DConfig); /** * Set global default configuration */ static setDefaults(defaults: SDKDefaults): void; /** * Initialize the SDK - loads model and sets up all systems */ initialize(): Promise<void>; /** * Speak text using TTS with lip sync */ speak(text: string): Promise<void>; /** * Set model expression */ setExpression(expression: string): void; /** * Get current model instance */ getModel(): Live2DModel | null; /** * Update SDK configuration */ updateConfig(newConfig: Partial<PhantasyLive2DConfig>): void; /** * Stop current speech */ stopSpeech(): void; /** * Enable orbit controls for zoom and pan functionality */ enableOrbitControls(): void; /** * Disable orbit controls */ disableOrbitControls(): void; /** * Set zoom level * @param zoom - Zoom factor (0.1 to 3.0) */ setZoom(zoom: number): void; /** * Set pan position * @param x - Horizontal pan offset * @param y - Vertical pan offset */ setPan(x: number, y: number): void; /** * Reset orbit controls to default position and zoom */ resetOrbitControls(): void; /** * Get current orbit controls state * @returns Object with zoom, panX, and panY values, or null if not available */ getOrbitControlsState(): { zoom: number; panX: number; panY: number; } | null; /** * Destroy SDK instance and clean up resources */ destroy(): void; /** * Get SDK status */ getStatus(): { initialized: boolean; destroyed: boolean; hasModel: boolean; ttsReady: any; lipSyncActive: any; }; private resolveContainer; private ensureInitialized; private setupEventForwarding; private connectTTSToLipSync; }