a number
number
Calculates the arccosine (inverse cosine) in radians, returns angle whose cosine is the input.
Example: acos(1) → 0, acos(0) → π/2 (1.57), acos(-1) → π (3.14)
a number
number
Adds two numbers together. Example: 5 + 3 → 8, -2 + 7 → 5
two numbers
number
Calculates the arcsine (inverse sine) in radians, returns angle whose sine is the input.
Example: asin(0) → 0, asin(1) → π/2 (1.57), asin(0.5) → π/6 (0.524)
a number
number
Calculates the arctangent (inverse tangent) in radians, returns angle whose tangent is the input. Example: atan(0) → 0, atan(1) → π/4 (~0.785), atan(-1) → -π/4
a number
number
Rounds a number up to the nearest integer (toward positive infinity). Example: 3.2 → 4, -2.8 → -2, 5 → 5
a number
number
Constrains a value between a minimum and maximum value. Example: clamp(5, 0, 3) returns 3, clamp(-1, 0, 3) returns 0, clamp(1.5, 0, 3) returns 1.5
a number, min and max values
number clamped between min and max
Calculates the cosine of an angle in radians. Example: cos(0) → 1, cos(π/2) → ~0, cos(π) → -1
a number
number
Converts an angle from degrees to radians.
Example: 180° → π (3.14159), 90° → π/2 (1.5708), 360° → 2π
a number in degrees
number
Divides the first number by the second. Example: 10 ÷ 2 → 5, 7 ÷ 2 → 3.5
two numbers
number
Applies an easing function to interpolate smoothly between min and max values. Example: x=0.5 from [0,100] with easeInQuad → applies quadratic acceleration curve Useful for smooth animations with various acceleration/deceleration curves.
a number, min and max values, and ease type
number
Calculates e raised to the power of the input (exponential function). Example: e⁰ → 1, e¹ → ~2.718, e² → ~7.389
a number
number
Rounds a number down to the nearest integer (toward negative infinity). Example: 3.7 → 3, -2.3 → -3, 5 → 5
a number
number
Returns the fractional part of a number (removes integer part, keeps decimals). Example: 3.14 → 0.14, 5.9 → 0.9, -2.3 → 0.7 Useful for wrapping values and creating repeating patterns.
a number
fractional part (always positive)
Calculates the interpolation parameter t for a value between start and end (reverse of lerp). Example: Value 5 in range [0,10] → t=0.5, Value 2.5 in range [0,10] → t=0.25 Returns what t value would produce the given value in a lerp. Useful for finding relative position.
start value, end value, and the value to find t for
interpolation parameter (typically 0-1)
Linear interpolation between two values using parameter t (0 to 1). Example: From 0 to 100 at t=0.5 → 50, From 10 to 20 at t=0.25 → 12.5 When t=0 returns start, when t=1 returns end. Useful for smooth transitions.
start value, end value, and interpolation parameter t
interpolated value
Calculates the natural logarithm (base e) of a number. Example: ln(2.718) → ~1, ln(7.389) → ~2, ln(1) → 0
a number
number
Calculates the base 10 logarithm of a number. Example: log₁₀(100) → 2, log₁₀(1000) → 3, log₁₀(10) → 1
a number
number
Calculates the remainder after division (modulus operation). Example: 10 % 3 → 1, 17 % 5 → 2
two numbers and operator
Result of modulus operation
Moves a value toward a target by a maximum delta amount (never overshooting). Example: From 0 toward 10 by max 3 → 3, From 8 toward 10 by max 3 → 10 (reached) Useful for smooth movement with maximum speed limits.
current value, target value, and maximum delta
new value moved toward target
Multiplies two numbers together. Example: 5 × 3 → 15, -2 × 4 → -8
two numbers
number
Negates a number (flips its sign: positive becomes negative, negative becomes positive). Example: 5 → -5, -3 → 3, 0 → 0
a number
number
Creates and returns a number value (pass-through for number input). Example: Input 42 → 42, Input 3.14 → 3.14
a number to be created
number
Performs mathematical operations on a single number (absolute, negate, sqrt, trig functions, logarithms, etc.). Example: sqrt(5) → 2.236, abs(-3) → 3, sin(π/2) → 1
one number and operator action
Result of math operation
Returns the mathematical constant π (pi) ≈ 3.14159. Example: Outputs 3.141592653589793
A number PI
Creates a ping-pong (back-and-forth) effect that bounces a value between 0 and length. The value goes from 0→length, then back length→0, repeating this cycle. Example: With length=1: t=0→0, t=0.5→0.5, t=1→1 (peak), t=1.5→0.5, t=2→0, t=2.5→0.5 (repeats) Useful for creating bouncing animations like a ball or oscillating motion.
time value t and length
value bouncing between 0 and length
Raises the first number to the power of the second (exponentiation). Example: 2³ → 8, 5² → 25, 10⁻¹ → 0.1
two numbers
number
Converts an angle from radians to degrees. Example: π → 180°, π/2 → 90°, 2π → 360°
a number in radians
number
Generates a random decimal number between 0 (inclusive) and 1 (exclusive). Example: Outputs like 0.342, 0.891, or any value in [0, 1)
A random number between 0 and 1
Generates a random number within a specified range (low to high). Example: Range [0, 10] → outputs like 3.7, 8.2, or any value between 0 and 10
low and high numbers
A random number
Generates multiple random numbers within a specified range. Example: Range [0, 10] with 3 items → [2.5, 7.1, 4.8]
low and high numbers
A list of random numbers
Maps a number from one range to another range proportionally. Example: 5 from [0,10] to [0,100] → 50, 0.5 from [0,1] to [-10,10] → 0
one number and operator action
Result of mapping
Rounds a number to the nearest integer. Example: 3.7 → 4, 2.3 → 2, 5.5 → 6
a number
number
Rounds a number to specified decimal places and removes trailing zeros. Example: 1.32156 with 3 decimals returns 1.322, but 1.320000001 returns 1.32, and 1.000 returns 1
a number and decimal places
Result of rounding as a number without trailing zeros
Rounds a number to specified decimal places. Example: 1.32156 with 3 decimals returns 1.322
a number and decimal places
Result of rounding
Returns the sign of a number: -1 for negative, 0 for zero, 1 for positive. Example: -5 → -1, 0 → 0, 3.14 → 1 Useful for determining direction or polarity.
a number
-1, 0, or 1
Calculates the sine of an angle in radians. Example: sin(0) → 0, sin(π/2) → 1, sin(π) → ~0
a number
number
Hermite interpolation with smooth acceleration and deceleration (smoother than linear lerp). Example: x=0 → 0, x=0.5 → 0.5, x=1 → 1 (but with smooth S-curve in between) Input is automatically clamped to [0,1]. Output eases in and out smoothly. Great for animations.
a number between 0 and 1
smoothly interpolated value
Calculates the square root of a number. Example: √9 → 3, √2 → 1.414, √16 → 4
a number
number
Subtracts the second number from the first. Example: 10 - 3 → 7, 5 - 8 → -3
two numbers
number
Calculates the tangent of an angle in radians. Example: tan(0) → 0, tan(π/4) → ~1, tan(π/2) → infinity
a number
number
Raises 10 to the power of the input number. Example: 10² → 100, 10³ → 1000, 10⁻¹ → 0.1
a number
number
Formats a number as a string with a fixed number of decimal places (always shows trailing zeros). Example: 3.14159 with 2 decimals → '3.14', 5 with 3 decimals → '5.000'
a number to be rounded to decimal places
number
Performs basic arithmetic operations on two numbers (add, subtract, multiply, divide, power, modulus). Example: 5 + 3 → 8, 10 % 3 → 1, 2 ^ 3 → 8
two numbers and operator
Result of math operation action
Wraps a number within a specified range (creates repeating cycle). Example: 1.5 in range [0,1) → 0.5, -0.3 in range [0,1) → 0.7, 370° in range [0,360) → 10° Useful for angles, UVs, or any repeating domain. Like modulo but handles negatives properly.
a number, min and max values
wrapped value within range
Generated using TypeDoc
Returns the absolute value (removes negative sign, always positive or zero). Example: |-5| → 5, |3| → 3, |0| → 0
basics
abs
false