1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

add lerpv3

This commit is contained in:
Kevin Levron 2020-09-16 21:11:45 +02:00
parent 859d82e4e3
commit 83168ee595

View File

@ -11,3 +11,9 @@ export function lerp(value1, value2, amount) {
amount = amount > 1 ? 1 : amount; amount = amount > 1 ? 1 : amount;
return value1 + (value2 - value1) * 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);
};