UNPKG

@kya-os/cli

Version:

CLI for KYA-OS MCP-I setup and management

173 lines 4.25 kB
/** * Scene-Based Animation Engine for Terminal Effects * Provides sophisticated animation capabilities with scenes, frames, and events */ import { CharacterVisual, ColorPair, Color, EasingFunction } from "./types.js"; import { Gradient, GradientDirection } from "./gradient.js"; /** * Single frame in an animation scene */ export interface AnimationFrame { /** Symbol to display */ symbol: string; /** Frame duration in milliseconds */ duration: number; /** Colors for this frame */ colors?: ColorPair; /** Text effects (bold, italic, etc.) */ textEffects?: string[]; } /** * Sync metric for scene timing */ export declare enum SyncMetric { /** Sync to time */ TIME = "time", /** Sync to motion distance */ DISTANCE = "distance", /** Sync to motion steps */ STEP = "step" } /** * Animation scene - a sequence of frames */ export declare class Scene { readonly id: string; private frames; private currentFrameIndex; private frameStartTime; private _isLooping; private _isComplete; /** Sync metric for timing */ syncMetric: SyncMetric; /** Easing function for frame transitions */ easingFn?: EasingFunction; constructor(id: string); /** * Add a frame to the scene */ addFrame(symbol: string, duration: number, colors?: ColorPair): void; /** * Apply gradient to symbols across multiple frames */ applyGradientToSymbols(symbol: string, duration: number, gradient: Gradient, _direction?: GradientDirection): void; /** * Set looping behavior */ setLooping(isLooping: boolean): void; /** * Get current frame based on elapsed time */ getCurrentFrame(elapsedTime: number): AnimationFrame | null; /** * Reset the scene */ reset(): void; /** * Check if scene is complete */ isComplete(): boolean; /** * Get total duration of the scene */ getTotalDuration(): number; /** * Get frame count */ getFrameCount(): number; /** * Get current frame index */ getCurrentFrameIndex(): number; } /** * Event types for character animation */ export declare enum AnimationEvent { SCENE_COMPLETE = "scene_complete", SCENE_ACTIVATED = "scene_activated", FRAME_CHANGE = "frame_change" } /** * Event handler for animation events */ export interface AnimationEventHandler { event: AnimationEvent; sceneId?: string; callback: () => void; } /** * Character animation manager */ export declare class CharacterAnimation { private scenes; private activeScene; private sceneStartTime; private eventHandlers; /** Original character colors */ inputFgColor?: Color; inputBgColor?: Color; constructor(inputColors?: { fg?: Color; bg?: Color; }); /** * Create a new scene */ newScene(sceneId: string): Scene; /** * Get a scene by ID */ queryScene(sceneId: string): Scene | undefined; /** * Activate a scene */ activateScene(scene: Scene): void; /** * Update animation and get current visual */ update(): CharacterVisual | null; /** * Register an event handler */ registerEvent(event: AnimationEvent, sceneId: string, callback: () => void): void; /** * Trigger an event */ private triggerEvent; /** * Reset all scenes */ reset(): void; } /** * Enhanced character with animation capabilities */ export declare class AnimatedCharacter { readonly id: string; readonly originalSymbol: string; readonly animation: CharacterAnimation; /** Current visual state */ visual: CharacterVisual; /** Layer for z-ordering (higher = on top) */ layer: number; /** Visibility flag */ isVisible: boolean; constructor(id: string, symbol: string, inputColors?: { fg?: Color; bg?: Color; }); /** * Update character animation */ update(): void; /** * Set character layer */ setLayer(layer: number): void; /** * Set visibility */ setVisibility(isVisible: boolean): void; } //# sourceMappingURL=animation-engine.d.ts.map