Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Vector2

Hierarchy

  • Vector2

Implements

Index

Constructors

constructor

  • Returns Vector2

  • Parameters

    Returns Vector2

  • Parameters

    • x: number
    • y: number

    Returns Vector2

Accessors

x

  • get x(): number
  • set x(value: number): void
  • Returns number

  • Parameters

    • value: number

    Returns void

xy

  • get xy(): []
  • set xy(values: []): void
  • Returns []

  • Parameters

    • values: []

    Returns void

y

  • get y(): number
  • set y(value: number): void
  • Returns number

  • Parameters

    • value: number

    Returns void

Static INFINITY

  • Returns Vector2

Static INFINITY_NEGATIVE

  • Returns Vector2

Static ONE

  • Returns Vector2

Static ZERO

  • Returns Vector2

Methods

add

  • Parameters

    Returns this

at

  • at(index: number): number
  • Parameters

    • index: number

    Returns number

clamp

  • Parameters

    Returns this

copy

  • copy(): Vector2
  • copy<D>(dest: D): D
  • Returns Vector2

  • Type parameters

    Parameters

    • dest: D

    Returns D

deserializeObject

divide

  • Parameters

    Returns this

equals

  • equals(vector: unknown, threshold?: number): boolean
  • Parameters

    • vector: unknown
    • Default value threshold: number = EPSILON

    Returns boolean

floor

  • floor(dest?: this): this
  • Parameters

    • Default value dest: this = this

    Returns this

length

  • length(): number
  • Returns number

lerp

  • lerp(vector: IVector2, amount: number): this
  • Parameters

    Returns this

mod

  • mod(n: number): this
  • Parameters

    • n: number

    Returns this

multiply

  • Parameters

    Returns this

negate

  • negate(): Vector2
  • negate<D>(dest: D): D
  • Returns Vector2

  • Type parameters

    Parameters

    • dest: D

    Returns D

normalize

  • normalize(): this
  • normalize<D>(dest: D): D
  • Returns this

  • Type parameters

    Parameters

    • dest: D

    Returns D

offset

  • Parameters

    Returns this

raw

  • Returns IVector2

reset

  • reset(): void
  • Returns void

scale

  • scale(value: number): this
  • scale<D>(value: number, dest: D): D
  • Parameters

    • value: number

    Returns this

  • Type parameters

    Parameters

    • value: number
    • dest: D

    Returns D

serializeObject

squaredLength

  • squaredLength(): number
  • Returns number

subtract

  • Parameters

    Returns this

toRadians

  • toRadians(): number
  • Returns number

toString

  • toString(): string
  • Returns string

Static cross

  • Parameters

    Returns Vector3

  • Type parameters

    Parameters

    Returns D

Static difference

  • Parameters

    Returns Vector2

  • Type parameters

    Parameters

    Returns D

Static direction

  • Parameters

    Returns Vector2

  • Type parameters

    Parameters

    Returns D

Static distance

  • Parameters

    Returns number

Static dot

  • Parameters

    Returns number

Static forRange

Static fromSize

  • fromSize(size: { height: number; width: number }): Vector2
  • Parameters

    • size: { height: number; width: number }
      • height: number
      • width: number

    Returns Vector2

Static inRange

  • inRange(center: IVector2, range: number, includeCenter?: boolean): Stream<IVector2>
  • Parameters

    • center: IVector2
    • range: number
    • Default value includeCenter: boolean = false

    Returns Stream<IVector2>

Static is

  • is(thing: unknown): thing is IVector2
  • Parameters

    • thing: unknown

    Returns thing is IVector2

Static isDistanceWithin

  • isDistanceWithin(vector: IVector2, vector2: IVector2, distance: number): boolean
  • Parameters

    Returns boolean

Static mix

  • Parameters

    Returns Vector2

  • Type parameters

    Parameters

    Returns D

Static product

  • Parameters

    Returns Vector2

  • Type parameters

    Parameters

    Returns D

Static quotient

  • Parameters

    Returns Vector2

  • Type parameters

    Parameters

    Returns D

Static range

  • Parameters

    Returns Generator<number[], void, unknown>

Static squaredDistance

  • Parameters

    Returns number

Static sum

  • Parameters

    Returns Vector2

  • Type parameters

    Parameters

    Returns D

Generated using TypeDoc