Overview
Applies one function—such as absolute value, rounding, or a trigonometric function—to
one number. Together with the two-input math_op, it is another fundamental building
block for numeric wiring.
Usage tips
- Rounding functions are especially useful in pixel art. Converting coordinates or
indices to integers with
Floor/Roundproduces motion that snaps to pixels. To turn a smooth waveform into stepped motion, combineFloorwith multiplication by the number of steps. Absfolds a round trip into one direction: a waveform from -1 to 1 becomes two peaks from 0 to 1.Sin/Cosexpect radians. To work in degrees, multiply by0.01745(π/180) in a precedingmath_op(Multiply).
Related nodes
math_op— two-input operationsexpression_float— write an expression such asfloor(x*4)/4in one noderemap— convert ranges, often before or after rounding
Functions
Abs- Absolute value. Converts a negative value to positive. Example:
-3 -> 3
- Absolute value. Converts a negative value to positive. Example:
Floor- Rounds down toward negative infinity. Example:
-1.2 -> -2
- Rounds down toward negative infinity. Example:
Ceil- Rounds up. Example:
3.2 -> 4
- Rounds up. Example:
Round- Rounds to the nearest integer. Example:
3.5 -> 4
- Rounds to the nearest integer. Example:
Fract- Extracts only the fractional part. Example:
3.8 -> 0.8
- Extracts only the fractional part. Example:
Sqrt- Square root. Example:
9 -> 3
- Square root. Example:
Sin/Cos/Tan- Trigonometric functions calculated in radians, not degrees.
Exp- Calculates
e^x, ore(approximately 2.718) to the power ofx. Example:3 -> 20.085...
- Calculates
Log- Natural logarithm
ln(x), usingeas the base.
- Natural logarithm
Negate- Reverses the sign, swapping positive and negative. Example:
3 -> -3
- Reverses the sign, swapping positive and negative. Example:
Sign- Tests the sign. Returns
-1.0for a negative value,0.0for zero, and1.0for a positive value.
- Tests the sign. Returns
Notes
Sqrtaccepts only inputs greater than or equal to0.Logaccepts only inputs greater than0.- The value currently returned at runtime is
Float, while the port contract isNumber.
Examples
- Use
Absto make values fromNoise Wavepositive. - Insert
FloorbeforeRemapto create steps. - Build periodic motion with
Sin/Cos. - Use
Signto switch direction depending on whether a value is positive or negative.