@styleless-ui/react
Version:
Completely unstyled, headless and accessible React UI components.
24 lines (23 loc) • 967 B
TypeScript
/**
* Returns value wrapped to the inclusive range of `min` and `max`.
*/
export declare const wrap: (number: number, min: number, max: number) => number;
/**
* Returns value clamped to the inclusive range of `min` and `max`.
*/
export declare const clamp: (number: number, min: number, max: number) => number;
/**
* Linear interpolate on the scale given by `a` to `b`, using `t` as the point on that scale.
*/
export declare const lerp: (a: number, b: number, t: number) => number;
/**
* Inverse Linar Interpolation, get the fraction between `a` and `b` on which `v` resides.
*/
export declare const inLerp: (a: number, b: number, v: number) => number;
/**
* Remap values from one linear scale to another.
*
* `oMin` and `oMax` are the scale on which the original value resides,
* `rMin` and `rMax` are the scale to which it should be mapped.
*/
export declare const remap: (v: number, oMin: number, oMax: number, rMin: number, rMax: number) => number;