UNPKG

@humanspeak/svelte-motion

Version:

Framer Motion for Svelte 5. Declarative motion.<tag> components with AnimatePresence exit animations, gestures (hover, tap, drag, focus, in-view), variants, FLIP layout animations, shared-layout transitions, spring physics, and scroll-linked motion values

37 lines (36 loc) 1.69 kB
/** * Boundary physics options used during inertia→spring handoff. * * - `timeConstantMs` controls exponential decay during the inertia phase. * - `restDelta` and `restSpeed` define settle thresholds for both phases. * - `bounceStiffness` and `bounceDamping` configure the spring at the boundary. */ export type BoundaryPhysics = { timeConstantMs: number; restDelta: number; restSpeed: number; bounceStiffness: number; bounceDamping: number; }; /** * Derives boundary spring/inertia parameters from drag context. * * Behavior * - If `elastic` is truthy (> 0), use Framer-like defaults: `bounceStiffness=200`, `bounceDamping=40`. * - If falsy (`0`/`false`/`undefined`), use extremely large values to overdamp (no visible bounce). * - Applies overrides from `transition` (if provided) and maps `timeConstant` (seconds) → `timeConstantMs` (milliseconds). * * @param {number|undefined} elastic Elasticity value from drag context (`dragElastic`). * Values > 0 indicate elastic overdrag; `0`/`false` disables it. * @param {{ bounceStiffness?: number; bounceDamping?: number; timeConstant?: number; restDelta?: number; restSpeed?: number }=} transition * Optional transition overrides (typically from `dragTransition`). * - `timeConstant` is expressed in seconds and internally converted to milliseconds. * @returns {BoundaryPhysics} Fully resolved physics parameters for inertia and boundary spring. */ export declare const deriveBoundaryPhysics: (elastic: number | undefined, transition?: { bounceStiffness?: number; bounceDamping?: number; timeConstant?: number; restDelta?: number; restSpeed?: number; }) => BoundaryPhysics;