API Documentation

for 0.0.1
Show:

Math Class

Math class gives easy access to some basics calculations that are frequently used in interactive computer graphics

Item Index

Methods

Methods

clamp

(
  • value
  • min
  • max
)
static

Clamp a value between a minimum and a maximum

Parameters:

  • value Number
  • min Number
  • max Number

degToRad

(
  • val
)
static

Converts degrees to radians

Parameters:

  • val Float

dist

(
  • x1
  • y1
  • x2
  • y2
)
static

Calculates the distance between two 2D points

Parameters:

  • x1 Float
  • y1 Float
  • x2 Float
  • y2 Float

lerp

(
  • value
  • dest
  • amount
)
static

Lerps a value to the destination value with the given amount

Parameters:

  • value Float
  • dest Float
  • amount Float

map

(
  • value
  • low1
  • high1
  • low2
  • high2
)
static

Maps a number between 2 sets of float values

Parameters:

  • value Float

    the value to map

  • low1 Float

    the 1st origin value

  • high1 Float

    the 2nd destination value

  • low2 Float

    the 1st destination value

  • high2 Float

pointIsInside

(
  • x
  • y
  • points
)
static

Finds if a point is inside an array of vertices

Parameters:

  • x Number
  • y Number
  • points Vector2 Array

    vertices {x,y}

radToDeg

(
  • val
)
static

Converts radians to degrees

Parameters:

  • val Float

randomFromTo

(
  • from
  • to
)
static

Generates a random number between 2 float values

Parameters:

  • from Float
  • to Float