fidget-pincher
Version:
- [jsDelivr CDN](https://cdn.jsdelivr.net/npm/fidget-pincher/): `<script src="https://cdn.jsdelivr.net/npm/fidget-pincher/dist/bundle.min.js"></script>` - [unpkg CDN](https://unpkg.com/fidget-pincher/): `<script src="https://unpkg.com/fidget-pincher/dist
48 lines (47 loc) • 1.88 kB
TypeScript
import { TransformationMatrix } from './TransformationMatrix';
import { Pinch } from './core-math';
interface InertiaOptions {
minimumTime: number;
minimumSnapshots: number;
brakingTime: number;
maximumPinchReleaseTime: number;
}
export interface InertiaApplyResult {
isRunning(): boolean;
stop(): void;
}
export interface TranslationSnapshot {
dx: number;
dy: number;
dt: number;
}
export interface TranslationInertia {
vx: number;
vy: number;
}
export declare function calculateTranslateInertia(translationHistory: TranslationSnapshot[], options?: InertiaOptions): TranslationInertia | null;
export declare function applyTranslateInertia(inertia: TranslationInertia, callback: (dx: number, dy: number) => void, options?: InertiaOptions): InertiaApplyResult;
export interface PinchSnapshot {
pinch: Pinch;
dt: number;
}
export interface FidgetSpinInertia {
angularVelocity: number;
scalingConstant: number;
}
export declare function calculateFidgetSpinInertia(pinchHistory: PinchSnapshot[], options?: InertiaOptions): FidgetSpinInertia | null;
export declare function applyFidgetSpinInertia(inertia: FidgetSpinInertia, callback: (rotation: number, scale: number) => void, options?: InertiaOptions): InertiaApplyResult;
export interface PinchInertia {
angularVelocity: number;
scalingConstant: number;
transformOrigin: {
x: number;
y: number;
} | null;
velocityX: number;
velocityY: number;
}
export declare function calculatePinchInertia(pinchHistory: PinchSnapshot[], options?: InertiaOptions): PinchInertia | null;
export declare function applyPinchInertia(inertia: PinchInertia, callback: (transform: TransformationMatrix) => void, options?: InertiaOptions): InertiaApplyResult;
export declare function isPinchRelease(time: number, options?: InertiaOptions): boolean;
export {};