Skip to content

format

typescript
Vector2.Sub(rhs)

class: Vector2

description

Subtracts the current vector object by another vector or a number, and returns the resulting vector.

parameter

param_nametypedescription
rhsnumber|Vector2The vector or number to subtract.

reture

typedescription
Vector2Returns a new Vector2 object representing the result of subtracting the current vector object by rhs.

code example

typescript
let v2 = new Vector2(-1, -2);
let sub_number = v2.Sub(1);
let sub_v2 = v2.Sub(new Vector2(2, 3));