Skip to main content

Units

This page describes all functions and operations available for units

Usage

Most basic unit is plain number, such as '1' or '4.5'. You can use variables with $ like '$example'. Each function requires name parenthesis and comma separated arguments e.g. 'min(PI, $example)'. You can combine as many as you want, e.g. 'min(PI, 10 + $example)'. You can do pretty complex infix, e.g. atan2($mouseY, $mouseX) - HALF_PI - HALF_PI / 2.

Constants
  • true - boolean true value, equal to 1.0
  • false - boolean false value, equal to 0.0
  • PI - number equal to 3.14159265358979323846
  • HALF_PI - number equal to 1.57079632679
  • TWO_PI - number equal to 6.28318530718
  • E - number equal to 2.7182818284590452354
Operations
  • -a
  • (a + b)
  • (a - b)
  • (a * b)
  • (a / b)
  • (a % b)
  • (a & b)
  • (a | b)
  • (a ^ b)
  • !a
  • (a << b)
  • (a >> b)
  • (a == b)
  • (a != b)
  • (a > b)
  • (a < b)
  • (a >= b)
  • (a <= b)
Functions
  • random()
  • time()
  • min(a, b)
  • max(a, b)
  • pow(a, b)
  • abs(a)
  • sin(a)
  • cos(a)
  • tan(a)
  • atan(a)
  • atan2(y, x)
  • deg(a)
  • rad(a)
  • log(a)
  • log10(a)
  • log1p(a)
  • sqrt(a)
  • sq(a)
  • floor(a)
  • ceil(a)
  • if(statement, trueUnit, falseUnit)