@kya-os/cli
Version:
CLI for MCP-I setup and management
168 lines • 4.01 kB
TypeScript
/**
* Motion Path Engine for Terminal Effects
* Provides sophisticated character movement with paths, waypoints, and bezier curves
*/
import { Coordinate, EasingFunction } from "./types.js";
/**
* Waypoint in a motion path
*/
export interface Waypoint {
id: string;
coordinate: Coordinate;
/** Optional bezier control point for curved paths */
bezierControl?: Coordinate;
/** Hold time at this waypoint (ms) */
holdTime?: number;
}
/**
* Motion segment between two waypoints
*/
export interface Segment {
start: Waypoint;
end: Waypoint;
distance: number;
/** Bezier curve points if applicable */
curvePoints?: Coordinate[];
}
/**
* Motion path for character movement
*/
export declare class Path {
readonly id: string;
private waypoints;
private segments;
private _isLooping;
private _speed;
private _easingFn?;
/** Current position along the path (0-1) */
private progress;
/** Current segment index */
private currentSegmentIndex;
/** Time spent at current waypoint (for holds) */
private holdTimeElapsed;
/** Total path distance */
private totalDistance;
constructor(id: string, speed?: number, easingFn?: EasingFunction);
/**
* Add a waypoint to the path
*/
newWaypoint(coord: Coordinate, waypointId?: string, bezierControl?: Coordinate, holdTime?: number): Waypoint;
/**
* Recalculate segments when waypoints change
*/
private recalculateSegments;
/**
* Calculate bezier curve points
*/
private calculateBezierPoints;
/**
* Calculate distance between two coordinates
*/
private calculateDistance;
/**
* Calculate total distance along a path of points
*/
private calculatePathDistance;
/**
* Set looping behavior
*/
setLooping(isLooping: boolean): void;
/**
* Set speed
*/
setSpeed(speed: number): void;
/**
* Get position at current progress
*/
getCurrentPosition(): Coordinate;
/**
* Get progress within current segment (0-1)
*/
private getSegmentProgress;
/**
* Update motion progress
*/
update(deltaTime: number): void;
/**
* Reset the path
*/
reset(): void;
/**
* Check if path is complete
*/
isComplete(): boolean;
/**
* Get waypoint count
*/
getWaypointCount(): number;
/**
* Get total path distance
*/
getTotalDistance(): number;
}
/**
* Motion event types
*/
export declare enum MotionEvent {
PATH_COMPLETE = "path_complete",
PATH_ACTIVATED = "path_activated",
WAYPOINT_REACHED = "waypoint_reached",
SEGMENT_ENTERED = "segment_entered"
}
/**
* Motion event handler
*/
export interface MotionEventHandler {
event: MotionEvent;
pathId?: string;
waypointId?: string;
callback: () => void;
}
/**
* Character motion manager
*/
export declare class CharacterMotion {
private paths;
private activePath;
private lastUpdateTime;
private eventHandlers;
private currentPosition;
constructor(initialPosition: Coordinate);
/**
* Create a new path
*/
newPath(pathId: string, speed?: number, easingFn?: EasingFunction): Path;
/**
* Get a path by ID
*/
queryPath(pathId: string): Path | undefined;
/**
* Activate a path
*/
activatePath(path: Path): void;
/**
* Set position directly
*/
setCoordinate(coord: Coordinate): void;
/**
* Update motion and get current position
*/
update(): Coordinate;
/**
* Register an event handler
*/
registerEvent(event: MotionEvent, pathId: string, callback: () => void, waypointId?: string): void;
/**
* Trigger an event
*/
private triggerEvent;
/**
* Reset all paths
*/
reset(): void;
/**
* Get current position
*/
getCurrentPosition(): Coordinate;
}
//# sourceMappingURL=motion-engine.d.ts.map