Class: ScaleComponent
Defined in: common/components/scale-component.ts:7
Component to represent the scale of an entity in 2D space.
Extends
Implements
Constructors
Constructor
new ScaleComponent(
x
,y
):ScaleComponent
Defined in: common/components/scale-component.ts:17
Creates an instance of ScaleComponent.
Parameters
x
number
= 1
The scale factor along the x-axis.
y
number
= 1
The scale factor along the y-axis.
Returns
ScaleComponent
Overrides
Properties
name
name:
symbol
Defined in: common/components/scale-component.ts:8
The unique name of the component.
Implementation of
x
x:
number
Defined in: math/vector2.ts:7
The x-coordinate component of the vector
Inherited from
y
y:
number
Defined in: math/vector2.ts:10
The y-coordinate component of the vector
Inherited from
symbol
readonly
static
symbol: typeofsymbol
Defined in: common/components/scale-component.ts:10
Accessors
down
Get Signature
get
static
down():Vector2
Defined in: math/vector2.ts:104
Returns a unit vector pointing downward (0, -1).
Returns
Inherited from
left
Get Signature
get
static
left():Vector2
Defined in: math/vector2.ts:111
Returns a unit vector pointing left (-1, 0).
Returns
Inherited from
one
Get Signature
get
static
one():Vector2
Defined in: math/vector2.ts:132
Returns a vector with components of 1 (1, 1).
Returns
Inherited from
right
Get Signature
get
static
right():Vector2
Defined in: math/vector2.ts:118
Returns a unit vector pointing right (1, 0).
Returns
Inherited from
up
Get Signature
get
static
up():Vector2
Defined in: math/vector2.ts:97
Returns a unit vector pointing upward (0, 1).
Returns
Inherited from
zero
Get Signature
get
static
zero():Vector2
Defined in: math/vector2.ts:125
Returns a zero vector (0, 0).
Returns
Inherited from
Methods
add()
add(
value
):Vector2
Defined in: math/vector2.ts:39
Returns a new vector that is the sum of this vector and another vector.
Parameters
value
The vector to add
Returns
A new Vector2 representing the sum
Inherited from
clone()
clone():
Vector2
Defined in: math/vector2.ts:179
Creates a deep copy of this vector.
Returns
A new Vector2 with the same component values
Inherited from
distanceTo()
distanceTo(
other
):number
Defined in: math/vector2.ts:213
Calculates the distance between this vector and another vector.
Parameters
other
The other vector
Returns
number
The distance between the two vectors
Inherited from
divide()
divide(
scalar
):Vector2
Defined in: math/vector2.ts:87
Divides this vector by a scalar value.
Parameters
scalar
number
The scalar value to divide by
Returns
A new Vector2 divided by the scalar
Inherited from
equals()
equals(
value
):boolean
Defined in: math/vector2.ts:196
Checks if this vector is equal to another vector.
Parameters
value
The vector to compare
Returns
boolean
True if the vectors have the same components, false otherwise
Inherited from
floorComponents()
floorComponents():
Vector2
Defined in: math/vector2.ts:171
Returns a new vector with components rounded down to the nearest integer.
Returns
A new Vector2 with floored components
Inherited from
magnitude()
magnitude():
number
Defined in: math/vector2.ts:140
Calculates the magnitude (length) of this vector.
Returns
number
The magnitude of the vector
Inherited from
magnitudeSquared()
magnitudeSquared():
number
Defined in: math/vector2.ts:149
Calculates the squared magnitude of this vector. This is faster than magnitude() as it avoids the square root.
Returns
number
The squared magnitude of the vector
Inherited from
multiply()
multiply(
scalar
):Vector2
Defined in: math/vector2.ts:63
Multiplies this vector by a scalar value.
Parameters
scalar
number
The scalar value to multiply by
Returns
A new Vector2 scaled by the input value
Inherited from
multiplyComponents()
multiplyComponents(
vector
):Vector2
Defined in: math/vector2.ts:75
Multiplies this vector's components by another vector's components.
Parameters
vector
The vector to multiply components with
Returns
A new Vector2 with multiplied components
Inherited from
normalize()
normalize():
Vector2
Defined in: math/vector2.ts:157
Returns a normalized (unit length) version of this vector.
Returns
A new Vector2 with magnitude 1 in the same direction
Inherited from
rotate()
rotate(
angleInRadians
):Vector2
Defined in: math/vector2.ts:222
rotates this vector by a given angle in radians.
Parameters
angleInRadians
number
The angle in radians to rotate the vector
Returns
A new Vector2 representing the rotated vector
Inherited from
set()
set(
value
):ScaleComponent
Defined in: math/vector2.ts:27
Sets this vector's components to match another vector.
Parameters
value
The vector to copy components from
Returns
ScaleComponent
This vector for chaining
Inherited from
subtract()
subtract(
value
):Vector2
Defined in: math/vector2.ts:51
Returns a new vector that is the difference between this vector and another vector.
Parameters
value
The vector to subtract
Returns
A new Vector2 representing the difference
Inherited from
toFloat32Array()
toFloat32Array():
Float32Array
Defined in: math/vector2.ts:204
Converts the 2d vector to a glsl-compatible float32 array.
Returns
Float32Array
The 2d vector array (e.g. [5, 3]
for a new Vector2(5, 3)
).
Inherited from
toString()
toString():
string
Defined in: math/vector2.ts:187
Returns a string representation of this vector.
Returns
string
A string in the format "(x, y)" with components rounded to 1 decimal place