/** * Spring physics helpers. * * @module bquery/motion */ import type { Spring, SpringConfig, SpringVector } from './types'; /** * Create a spring-based animation for smooth, physics-based motion. * * Uses variable frame rate timing based on `requestAnimationFrame` timestamps * to ensure consistent animation speed across different devices and frame rates. * Large time deltas (e.g., from tab backgrounding) are clamped to maintain * simulation stability. * * @param initialValue - Starting value for the spring * @param config - Spring physics configuration * @returns Spring instance for controlling the animation * * @example * ```ts * const x = spring(0, { stiffness: 120, damping: 14 }); * x.onChange((value) => { * element.style.transform = `translateX(${value}px)`; * }); * await x.to(100); * ``` */ export declare const spring: (initialValue: number, config?: SpringConfig) => Spring; /** * Preset spring configurations for common use cases. * * Includes the original four bQuery presets plus three extended presets * (`wobbly`, `slow`, `molasses`) familiar from popular physics libraries. */ export declare const springPresets: { /** Gentle, slow-settling spring */ gentle: SpringConfig; /** Responsive, snappy spring */ snappy: SpringConfig; /** Bouncy, playful spring */ bouncy: SpringConfig; /** Stiff, quick spring with minimal overshoot */ stiff: SpringConfig; /** Lively, jiggly spring with pronounced wobble */ wobbly: SpringConfig; /** Heavy, slow spring suitable for large gestures */ slow: SpringConfig; /** Very heavy, ponderous spring */ molasses: SpringConfig; }; /** * Drive multiple coupled springs in parallel. * * Each named dimension has its own underlying scalar `spring`, and * `.to()` resolves only after every dimension has settled. Useful for * coordinated 2D / 3D / arbitrary-N motion. * * @param initial - Record of starting values per dimension * @param config - Shared spring physics configuration * * @example * ```ts * const pos = springVector({ x: 0, y: 0 }, springPresets.snappy); * pos.onChange(({ x, y }) => el.style.transform = `translate(${x}px, ${y}px)`); * await pos.to({ x: 100, y: 40 }); * ``` */ export declare const springVector: >(initial: T, config?: SpringConfig) => SpringVector; //# sourceMappingURL=spring.d.ts.map