This API is experimental
Its behavior may change in a future version of p5.js.
A shader function that performs smooth Hermite interpolation between 0.0 and 1.0.
This function is equivalent to the GLSL built-in smoothstep(edge0, edge1, x) and is available inside p5.strands shader callbacks. It is commonly used to create soft transitions, smooth edges, fades, and anti-aliased effects.
Smoothstep is useful when a threshold or cutoff is needed, but with a gradual transition instead of a hard edge.
- Returns
0.0whenxis less than or equal toedge0 - Returns
1.0whenxis greater than or equal toedge1 - Smoothly interpolates between
0.0and1.0whenxis between them
Examples
Syntax
smoothstep(edge0, edge1, x)
Parameters
edge0
Number: Lower edge of the transition
edge1
Number: Upper edge of the transition
x
Number: Input value to interpolate
Returns
Number: A value between
0.0 and 1.0Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!