UNPKG

aura-glass

Version:

A comprehensive glassmorphism design system for React applications with 142+ production-ready components

144 lines 3.36 kB
/** * AuraGlass Physics Engine * A comprehensive 2D physics simulation system with collision detection, * spring dynamics, and gesture-based interactions */ import { Vector2D } from '../types/common'; /** * Physics body state representing position, velocity, and acceleration */ export interface PhysicsBodyState { position: Vector2D; velocity: Vector2D; acceleration: Vector2D; rotation: number; angularVelocity: number; mass: number; timestamp: number; } /** * Options for configuring a physics body */ export interface PhysicsBodyOptions { mass?: number; friction?: number; restitution?: number; fixedRotation?: boolean; gravityScale?: number; damping?: number; angularDamping?: number; initialPosition?: Vector2D; initialVelocity?: Vector2D; bounds?: { min: Vector2D; max: Vector2D; }; } /** * Collision event data */ export interface CollisionEvent { bodyA: string; bodyB: string; point: Vector2D; normal: Vector2D; penetration: number; timestamp: number; } /** * AuraGlass Physics Engine API */ export declare class AuraPhysicsEngineAPI { private bodies; private running; private lastTime; private animationFrameId; private gravity; private timeScale; constructor(); /** * Create a new physics body */ createBody(id: string, options?: PhysicsBodyOptions): string; /** * Remove a physics body */ removeBody(id: string): void; /** * Apply force to a body */ applyForce(id: string, force: Vector2D): void; /** * Apply impulse (instant velocity change) to a body */ applyImpulse(id: string, impulse: Vector2D): void; /** * Set velocity of a body */ setVelocity(id: string, velocity: Vector2D): void; /** * Set position of a body */ setPosition(id: string, position: Vector2D): void; /** * Get the current state of a body */ getBodyState(id: string): PhysicsBodyState | null; /** * Add collision listener to a body */ onCollision(id: string, listener: (event: CollisionEvent) => void): () => void; /** * Set gravity */ setGravity(gravity: Vector2D): void; /** * Set time scale (slow motion / speed up) */ setTimeScale(scale: number): void; /** * Start the physics simulation */ start(): void; /** * Stop the physics simulation */ stop(): void; /** * Force an update of the physics simulation */ forceUpdate(): void; /** * Main update loop */ private update; /** * Physics simulation step */ private step; /** * Simple collision detection */ private detectCollisions; /** * Get all body IDs */ getBodies(): string[]; /** * Clear all bodies */ clear(): void; } /** * Get the global physics engine instance */ export declare const getGlobalPhysicsEngine: () => AuraPhysicsEngineAPI; /** * Force update the global physics engine */ export declare const forcePhysicsEngineUpdate: () => void; /** * Get physics body state from the global engine */ export declare const getPhysicsBodyState: (bodyId: string) => PhysicsBodyState | null; //# sourceMappingURL=AuraPhysicsEngine.d.ts.map