Vector2.setOppositeAxis()

Read the axis given as parameter and set the other one with value given as parameter

Parameters

NameTypeDescription
1axisAxisNames2dThe name of the axis. either 'x' or 'y'
2valuenumber

Return value

Vector2

The vector with its new axis value

Usage

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

let vector = new Vector2(1,1);
console.log(vector); //(1,1)
vector.setOppositeAxis('x', 2);
console.log(vector); //(1,2)