UNPKG

@technobuddha/library

Version:
19 lines (18 loc) 596 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.lerp = void 0; /** * Performs linear interpolation between values a and b. Returns the value * between a and b proportional to x (when x is between 0 and 1. When x is * outside this range, the return value is a linear extrapolation). * * @param a A number. * @param b A number. * @param proportion The proportion between a and b. * @returns The interpolated value between a and b. */ function lerp(a, b, proportion) { return a + proportion * (b - a); } exports.lerp = lerp; exports.default = lerp;