Vector2.absolute()
Set each axis of this vector to its absolute value
Parameters
Name | Type | Description | |
---|---|---|---|
1 | axis | x | y | undefined | The axis you want to set or undefined if you want to change both axis |
Return value
Vector2
The vector with its new values
Usage
import {Vector2} from '@lcluber/type6js';
let vector = new Vector2(-1,-1);
console.log(vector); //(-1,-1)
vector.absolute('x');
console.log(vector); //(1,-1)
vector.absolute();
console.log(vector); //(1,1)