Constructors
constructor
- new Vec2(x?, y?): Vec2
Parameters
x: number = 0
y: number = x
Accessors
x
- get x(): number
Returns number
- set x(value): void
Returns void
y
- get y(): number
Returns number
- set y(value): void
Returns void
Methods
Optional
_onChangeCallback
- _onChangeCallback(): void
Returns void
set
- set(x?, y?): Vec2
Parameters
x: number = 0
y: number = x
- this Vec2 after being set
sub
- sub(vector?): Vec2
- this Vec2 after subtraction
subScalar
- subScalar(value?): Vec2
- this Vec2 after subtraction
multiply
- multiply(vector?): Vec2
- this Vec2 after multiplication
multiplyScalar
- multiplyScalar(value?): Vec2
- this Vec2 after multiplication
divideScalar
- divideScalar(value?): Vec2
-
max
- max(vector?): Vec2
- Vec2 with max values applied
min
- min(vector?): Vec2
- Vec2 with min values applied
equals
- equals(vector?): boolean
Returns boolean
- whether the Vec2 are equals or not
lengthSq
- lengthSq(): number
Returns number
- square length of this Vec2
length
- length(): number
Returns number
dot
- dot(vector?): number
Returns number
- dot product of the 2 Vec2
lerp
- lerp(vector?, alpha?): Vec2
Parameters
vector: Vec2 = ...
Optional
alpha: number = 1
- this Vec2 after linear interpolation
Really basic 2D vector class used for vector calculations
See