Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Util

Utilities

Excalibur utilities for math, string manipulation, etc.

Index

Variables

TwoPI

TwoPI: number = Math.PI * 2

Functions

addItemToArray

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

    • T

    Parameters

    • item: T
    • array: T[]

    Returns boolean

base64Encode

  • base64Encode(inputStr: string): string
  • Parameters

    • inputStr: string

    Returns string

canonicalizeAngle

  • canonicalizeAngle(angle: number): number
  • Parameters

    • angle: number

    Returns number

clamp

  • clamp(val: any, min: any, max: any): any
  • Parameters

    • val: any
    • min: any
    • max: any

    Returns any

contains

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

    • array: Array<any>
    • obj: any

    Returns boolean

extend

  • extend(deep: boolean, target: any, ...objects: Array<any>): any
  • extend(target: any, ...objects: Array<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: Array<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

    Parameters

    • target: any

      The target object to attach properties on

    • Rest ...objects: Array<any>

      The objects whose properties to merge

    Returns any

    Merged object with properties from other objects

getOppositeSide

  • Parameters

    Returns Side

getPosition

  • getPosition(el: HTMLElement): Vector
  • Parameters

    • el: HTMLElement

    Returns Vector

getSideFromVector

  • Parameters

    Returns Side

randomInRange

  • randomInRange(min: number, max: number): number
  • Parameters

    • min: number
    • max: number

    Returns number

randomIntInRange

  • randomIntInRange(min: number, max: number): number
  • Parameters

    • min: number
    • max: number

    Returns number

removeItemToArray

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

    • T

    Parameters

    • item: T
    • array: T[]

    Returns boolean

toDegrees

  • toDegrees(radians: number): number
  • Parameters

    • radians: number

    Returns number

toRadians

  • toRadians(degrees: number): number
  • Parameters

    • degrees: number

    Returns number