@ssgoi/core
Version:
Core animation engine for SSGOI - Native app-like page transitions with spring physics
34 lines • 1.42 kB
TypeScript
import { Integrator, IntegratorState } from './types';
export type ResistanceType = "linear" | "quadratic";
export interface InertiaIntegratorConfig {
/** Acceleration force (higher = faster acceleration) */
acceleration: number;
/** Resistance coefficient (higher = more resistance, lower terminal velocity) */
resistance: number;
/** Resistance type: 'linear' (proportional to v) or 'quadratic' (proportional to v²) */
resistanceType?: ResistanceType;
/** Minimum boundary value */
min?: number;
/** Maximum boundary value */
max?: number;
/** Spring stiffness for boundary bounce @default 500 */
bounceStiffness?: number;
/** Spring damping for boundary bounce @default 10 */
bounceDamping?: number;
/** Position threshold for settling detection @default 0.01 */
restDelta?: number;
}
export declare class InertiaIntegrator implements Integrator {
private readonly acceleration;
private readonly resistance;
private readonly resistanceType;
private readonly min;
private readonly max;
private readonly bounceStiffness;
private readonly bounceDamping;
private readonly restDelta;
constructor(config: InertiaIntegratorConfig);
step(state: IntegratorState, target: number, dt: number): IntegratorState;
isSettled(state: IntegratorState, target: number): boolean;
}
//# sourceMappingURL=inertia-integrator.d.ts.map