Vector2.lerp()
Set the interpolation point between the two vectors given as first and second parameters using the normalized amount given as third parameter
Parameters
Name | Type | Description | |
---|---|---|---|
1 | min | Vector2 | |
2 | max | Vector2 | |
3 | amount | number | the amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.9 is very near the new vector. 0.5 is halfway in between. |
Return value
Vector2
The vector with its new values
Usage
import {Vector2} from '@lcluber/type6js';
let min= new Vector2(3,3);
let max= new Vector2(4,5);
let amount= 4;
let vector = new Vector2(2,1);
console.log(vector); //(1,1)
vector.lerp(min,max,amount);
console.log(vector);