rhb-server/mes-ui/rhb-app/node_modules/gl-vec2/lerp.js
2025-10-20 11:14:41 +08:00

18 lines
444 B
JavaScript

module.exports = lerp
/**
* Performs a linear interpolation between two vec2's
*
* @param {vec2} out the receiving vector
* @param {vec2} a the first operand
* @param {vec2} b the second operand
* @param {Number} t interpolation amount between the two inputs
* @returns {vec2} out
*/
function lerp(out, a, b, t) {
var ax = a[0],
ay = a[1]
out[0] = ax + t * (b[0] - ax)
out[1] = ay + t * (b[1] - ay)
return out
}