Vector2.setDegree()
Set the x and y values of the vector from the angle in degrees given as parameter
Parameters
Name | Type | Description | |
---|---|---|---|
1 | angle | number | an angle in degree different than zero |
Return value
Vector2
The vector with its new axis value
Usage
import {Vector2} from '@lcluber/type6js';
// set vector from angle
let vector1 = new Vector2(1, 1);
let vector2 = new Vector2(1, 1);
vector1.setRadian(2.45);
console.log(vector1); //(-1.0894051357418622,0.9019362191158643)
vector2.setDegree('degree', 45);
console.log(vector2); //(1.0003980839587652, 0.9996017573460563)