Math: Arithmetic

Nodes in this category perform common arithmetic operations on numerical values (and where applicable, vec2 values).

Nodes

NodeDetailsPossible Types
Add

The addition operation (+) calculates the sum of two scalar numbers or vec2s.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Divide

The division operation (÷) calculates the quotient of two scalar numbers or vec2s.

Produces 0 for any division by 0. With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Exponent

The exponent operation (^) calculates the result of raising a number to a power.

With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Logarithm

The logarithmic function (log) calculates the logarithm of a number with a specified base. If the natural logarithm function (ln) is desired, set the base to "e".

With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Math f(x)

Evaluates a math expression written in terms of the single variable x, which carries the input value, or X when the input is a Transform.

The result is read as the chosen output type: an Integer rounds to the nearest whole number, a Bool reads exactly 0 or 1 as false or true, a Vec2 takes the X and Y of a vector like 3i + 4j, and a Transform takes a matrix like rotation(pi/4) + 5i. A boolean input reads as 0 or 1 and a Vec2 input as such a vector.

Number → Number
Number[] → Number[]
Number → Integer
Number[] → Integer[]
Number → Bool
Number[] → Bool[]
Number → Vec2
Number[] → Vec2[]
Number → Transform
Number[] → Transform[]
Integer → Number
Integer[] → Number[]
Integer → Integer
Integer[] → Integer[]
Integer → Bool
Integer[] → Bool[]
Integer → Vec2
Integer[] → Vec2[]
Integer → Transform
Integer[] → Transform[]
Bool → Number
Bool[] → Number[]
Bool → Integer
Bool[] → Integer[]
Bool → Bool
Bool[] → Bool[]
Bool → Vec2
Bool[] → Vec2[]
Bool → Transform
Bool[] → Transform[]
Vec2 → Number
Vec2[] → Number[]
Vec2 → Integer
Vec2[] → Integer[]
Vec2 → Bool
Vec2[] → Bool[]
Vec2 → Vec2
Vec2[] → Vec2[]
Vec2 → Transform
Vec2[] → Transform[]
Transform → Number
Transform[] → Number[]
Transform → Integer
Transform[] → Integer[]
Transform → Bool
Transform[] → Bool[]
Transform → Vec2
Transform[] → Vec2[]
Transform → Transform
Transform[] → Transform[]
Math f(…)

Evaluates a math expression across all of the input items at once. A full expression reads the items as a, b, c, …, or as A, B, C, … for Transforms, while a math operator or N-argument function name (like * or min) applies across every item.

The result is read as the chosen output type: an Integer rounds to the nearest whole number, a Bool reads exactly 0 or 1 as false or true, a Vec2 takes the X and Y of a vector like 3i + 4j, and a Transform takes a matrix like rotation(pi/4) + 5i. Boolean items read as 0 or 1 and Vec2 items as such vectors. Across Transforms, * and / compose in order, mean averages, and count counts.

Number[] → Number
Number[] → Integer
Number[] → Bool
Number[] → Vec2
Number[] → Transform
Integer[] → Number
Integer[] → Integer
Integer[] → Bool
Integer[] → Vec2
Integer[] → Transform
Bool[] → Number
Bool[] → Integer
Bool[] → Bool
Bool[] → Vec2
Bool[] → Transform
Vec2[] → Number
Vec2[] → Integer
Vec2[] → Bool
Vec2[] → Vec2
Vec2[] → Transform
Transform[] → Number
Transform[] → Integer
Transform[] → Bool
Transform[] → Vec2
Transform[] → Transform
Modulo

The modulo operation (%) calculates the remainder from the division of two scalar numbers or vec2s.

The sign of the result shares the sign of the numerator unless Always Positive is enabled.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Multiply

The multiplication operation (×) calculates the product of two scalar numbers, vec2s, or transforms.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Transform → Transform
Transform[] → Transform[]
Reciprocal

The reciprocal operation (1/x) calculates the multiplicative inverse of a number.

Produces 0 if the input is 0. With a vec2 input, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Vec2 → Vec2
Vec2[] → Vec2[]
Root

The nth root operation (√) calculates the inverse of exponentiation. Square root inverts squaring, cube root inverts cubing, and so on.

This is equivalent to raising the number to the power of 1/n. With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Subtract

The subtraction operation (-) calculates the difference between two scalar numbers or vec2s.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]