UNPKG

math-toolbox

Version:

Lightweight and modular math toolbox

14 lines (12 loc) 316 B
/** * Normalize a value between two bounds. * * @param {number} min - Minimum boundary. * @param {number} max - Maximum boundary. * @param {number} x - Value to normalize. * @return {number} Normalized value. */ function normalize (min, max, x) { return (x - min) / (max - min) } export { normalize }