There was an error while loading. Please reload this page.
Linearly interpolate a number between two numbers.
Similar: constrain, normalize, remap, lerp.
function lerp(x, y, t) // x: start number // y: stop number // t: interpolant ∈ [0, 1]
const xmath = require('extra-math'); xmath.lerp(80, 320, 0.8); // → 272 xmath.lerp(80, 320, 0.20); // → 128 xmath.lerp(80, 320, 0.32); // → 156.8