UNPKG

diginext-utils

Version:
21 lines 517 B
/** * Linear interpolation between two values. * Returns the value at a specific point between start and end. * * @param start - The starting value * @param end - The ending value * @param t - The interpolation factor (0 to 1) * @returns The interpolated value * * @example * ```ts * lerp(0, 10, 0.5); // 5 * lerp(0, 10, 0); // 0 * lerp(0, 10, 1); // 10 * lerp(20, 80, 0.25); // 35 * ``` */ export function lerp(start, end, t) { return start + (end - start) * t; } //# sourceMappingURL=lerp.js.map