From 83168ee5958bf3955dd98de29753600eeec20be8 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Wed, 16 Sep 2020 21:11:45 +0200 Subject: [PATCH] add lerpv3 --- src/tools.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools.js b/src/tools.js index bd4b719..39d7132 100644 --- a/src/tools.js +++ b/src/tools.js @@ -11,3 +11,9 @@ export function lerp(value1, value2, amount) { amount = amount > 1 ? 1 : amount; return value1 + (value2 - value1) * amount; }; + +export function lerpv3(v1, v2, amount) { + v1.x = lerp(v1.x, v2.x, amount); + v1.y = lerp(v1.y, v2.y, amount); + v1.z = lerp(v1.z, v2.z, amount); +};