Vector2.setFromArray()

Set the x and y values of the vector from the array given as parameter. array[0] for x, array[1] for y

Parameters

NameTypeDescription
1arraynumber[]The array containing values for X and Y axis
2offset?numberthe offset between X and Y values within the array

Return value

Vector2

The vector with its new values

Usage

import {Vector2} from '@lcluber/type6js';

let array = [2,2];
let vector = new Vector2(1,1);
console.log(vector); //(1,1)
vector.setFromAngle(array);
console.log(vector);