Extends
Members
(readonly) onScreen :Boolean
The state of the cursor
(readonly) type :String
The type of the cursor
x :Number
The x position of the vector
y :Number
The y position of the vector
Methods
add(v) → {Vector2}
Modifies the x and y values of the vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
addScalar(s) → {Vector2}
Modifies the x and y values of the vector by the given scalar value
Parameters:
Name | Type | Description |
---|---|---|
s |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
addVectors(v1, v2) → {Vector2}
Sets the x and y values of the vector to the sum of the two given vectors
Parameters:
Name | Type | Description |
---|---|---|
v1 |
Vector2 | |
v2 |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
angleTo(v) → {Number}
Returns the angle between this and the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Numberceil() → {Vector2}
Sets the vector x and y values to the smallest integer greater than or equal to it's value
- Inherited From:
- Source:
Returns:
Vector2this
copy(v) → {Vector2}
Copies the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
cross(v) → {Number}
Returns the 2D cross product between this and the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
NumberdistanceTo(v) → {Number}
Returns the distance between this and the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Numberdivide(v) → {Vector2}
Divides the x and y values of the vector by the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
divideScalar(s) → {Vector2}
Divides the x and y values of the vector by the given scalar value
Parameters:
Name | Type | Description |
---|---|---|
s |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
dot(v) → {Number}
Returns the dot product between this and the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Numberequals(v) → {Boolean}
Determines if the given vector is equal to this vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Booleanfloor() → {Vector2}
Sets the vector x and y values to the largest integer less than or equal to it's value
- Inherited From:
- Source:
Returns:
Vector2this
length() → {Number}
Returns the length of the vector
- Inherited From:
- Source:
Returns:
Numbermax(v) → {Vector2}
Sets the vector x and y values to the maximum from it's value and the given vector's value
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
min(v) → {Vector2}
Sets the vector x and y values to the minimum from it's value and the given vector's value
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
multiply(v) → {Vector2}
Multiplies the x and y values of the vector by the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
multiplyScalar(s) → {Vector2}
Multiplies the x and y values of the vector by the given scalar value
Parameters:
Name | Type | Description |
---|---|---|
s |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
negate() → {Vector2}
Negates the vectors x and y values
- Inherited From:
- Source:
Returns:
Vector2this
rotate(rad) → {Vector2}
Rotates the vector by a given radian
Parameters:
Name | Type | Description |
---|---|---|
rad |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
round() → {Vector2}
Sets the vector x and y values to the nearest integer to it's value
- Inherited From:
- Source:
Returns:
Vector2this
set(x, y) → {Vector2}
Sets the x and y values of the vector
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
setLength(v) → {Vector2}
Sets the length of the vector to the length of the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
setX(x) → {Vector2}
Sets the x value of the vector
Parameters:
Name | Type | Description |
---|---|---|
x |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
setY(y) → {Vector2}
Sets the y value of the vector
Parameters:
Name | Type | Description |
---|---|---|
y |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
sub(v) → {Vector2}
Modifies the x and y values of the vector by the given vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
subScalar(s) → {Vector2}
Modifies the x and y values of the vector by the given scalar value
Parameters:
Name | Type | Description |
---|---|---|
s |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
subVectors(v1, v2) → {Vector2}
Sets the x and y values of the vector to the subtraction of the two given vectors
Parameters:
Name | Type | Description |
---|---|---|
v1 |
Vector2 | |
v2 |
Vector2 |
- Inherited From:
- Source:
Returns:
Vector2this
toAngle(rad) → {Vector2}
Rotates the vector to a given angle
Parameters:
Name | Type | Description |
---|---|---|
rad |
Number |
- Inherited From:
- Source:
Returns:
Vector2this
toString() → {String}
Returns the string value of the cursor
- Overrides:
- Source: