round
Rounds the input floating-point number (or each component of a vector) to the nearest integer. It's a fundamental operation for converting smooth, continuous values (like time or UV coordinates) into discrete, stepped values.
Core Advantages
It transforms a smooth, continuous input signal (like `time`) into a discrete value that only changes at integer points, which is fundamental for creating 'ticking' animations, pixelation effects, or any visual that requires instant switching between states rather than smooth transitions.
Common Uses
Stepped Animation
Pixelation/Voxelization Effects
Generating Hard-Edged Geometric Patterns
How to adjust
Control the frequency of the stepped changes by multiplying the input by a factor. For example, `round(time.mul(10))` changes ten times faster than `round(time)`, turning a slow, second-by-second jump into a rapid strobe effect.
Code Examples
1// Convert continuous time into a stepped value (0.0 or 1.0)
2const factor = round( time.mul( 5 ) ).mod( 2.0 );