Referencia smoothstep()

smoothstep()

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.0 when x is less than or equal to edge0
  • Returns 1.0 when x is greater than or equal to edge1
  • Smoothly interpolates between 0.0 and 1.0 when x is between them

Ejemplos

Sintaxis

smoothstep(edge0, edge1, x)

Parámetros

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.0
Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!

Referencias Relacionadas