-
Notifications
You must be signed in to change notification settings - Fork 0
lerp
Subhajit Sahu edited this page Aug 8, 2022
·
2 revisions
Linearly interpolate a number between two numbers.
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