There was an error while loading. Please reload this page.
Normalize a number from its current range into a value between 0 and 1.
Similar: constrain, normalize, remap, lerp.
function normalize(x, r, R) // x: a number // r: lower bound of current range // R: upper bound of current range
const xmath = require('extra-math'); xmath.normalize(20, 0, 50); // → 0.4 xmath.normalize(-10, 0, 100); // → -0.1