Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "Util/Util"

Index

Variables

Const TwoPI

TwoPI: number = Math.PI * 2

Two PI constant

Functions

addItemToArray

  • addItemToArray<T>(item: T, array: T[]): boolean
  • Type parameters

    • T

    Parameters

    • item: T
    • array: T[]

    Returns boolean

base64Encode

  • base64Encode(inputStr: string): string

canonicalizeAngle

  • canonicalizeAngle(angle: number): number

clamp

  • clamp(val: number, min: number, max: number): number
  • Clamps a value between a min and max inclusive

    Parameters

    • val: number
    • min: number
    • max: number

    Returns number

contains

  • contains(array: Array<any>, obj: any): boolean
  • Parameters

    • array: Array<any>
    • obj: any

    Returns boolean

extend

  • extend(deep: boolean, target: any, ...objects: any[]): any
  • extend<T1, T2>(target: T1, object2: T2): T1 & T2
  • extend<T1, T2, T3>(target: T1, object2: T2, object3: T3): T1 & T2 & T3
  • extend(target: any, ...objects: any[]): any
  • Merges one or more objects into a single target object

    Parameters

    • deep: boolean

      Whether or not to do a deep clone

    • target: any

      The target object to attach properties on

    • Rest ...objects: any[]

      The objects whose properties to merge

    Returns any

    Merged object with properties from other objects

  • Merges one or more objects into a single target object

    Type parameters

    • T1

    • T2

    Parameters

    • target: T1

      The target object to attach properties on

    • object2: T2

      The second object whose properties to merge

    Returns T1 & T2

    Merged object with properties from other objects

  • Merges one or more objects into a single target object

    Type parameters

    • T1

    • T2

    • T3

    Parameters

    • target: T1

      The target object to attach properties on

    • object2: T2

      The second object whose properties to merge

    • object3: T3

      The third object whose properties to merge

    Returns T1 & T2 & T3

    Merged object with properties from other objects

  • Merges one or more objects into a single target object

    Parameters

    • target: any

      The target object to attach properties on

    • Rest ...objects: any[]

      The objects whose properties to merge

    Returns any

    Merged object with properties from other objects

getOppositeSide

getPosition

  • getPosition(el: HTMLElement): Vector

getSideFromVector

randomInRange

  • randomInRange(min: number, max: number, random?: Random): number
  • Parameters

    • min: number
    • max: number
    • Default value random: Random = new Random()

    Returns number

randomIntInRange

  • randomIntInRange(min: number, max: number, random?: Random): number
  • Parameters

    • min: number
    • max: number
    • Default value random: Random = new Random()

    Returns number

removeItemFromArray

  • removeItemFromArray<T>(item: T, array: T[]): boolean
  • Type parameters

    • T

    Parameters

    • item: T
    • array: T[]

    Returns boolean

toDegrees

  • toDegrees(radians: number): number

toRadians

  • toRadians(degrees: number): number