Vector2.setArray()
Set the x and y values of the vector from the array given as parameter. array[0] for x, array[1] for y
Parameters
Name | Type | Description | |
---|---|---|---|
1 | array | number[] | The array containing values for X and Y axis |
2 | offset | ?number | the starting index of the array |
Return value
Vector2
The vector with its new values
Usage
import {Vector2} from '@lcluber/type6js';
// set from array
let vector = new Vector2([2,2]);
console.log(vector); //(2,2)
vector.setArray([1,1]);
console.log(vector); //(1,1)