length
length
Calculates the length of a vector, also known as its magnitude or size.
Core Advantages
Abstracts the complex `sqrt(x² + y² + z²)` mathematical formula into an intuitive 'length' concept. This greatly improves node graph readability and ensures optimal performance by mapping to the underlying GPU instruction.
Common Uses
Creating radial gradients or circular masks
Procedural displacement and deformation
Proximity detection and interactive effects
How to adjust
Adjust the rate of change of the output value by scaling its input vector (e.g., making a radial gradient's edge 'harder' or 'softer'). Move the effect's origin by changing the reference point used for the distance calculation (e.g., altering the `center` value in `uv().sub(center)`).
Code Examples
1// Calculate distance from the center of the UV space
2const dist = length( uv().sub( 0.5 ) );