File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,6 +275,45 @@ if (typeof p5 !== "undefined") {
275275 * </div>
276276 */
277277
278+ /**
279+ * @method smoothstep
280+ * @description
281+ * A shader function that performs smooth Hermite interpolation between `0.0`
282+ * and `1.0`.
283+ *
284+ * This function is equivalent to the GLSL built-in
285+ * `smoothstep(edge0, edge1, x)` and is available inside p5.strands shader
286+ * callbacks. It is commonly used to create soft transitions, smooth edges,
287+ * fades, and anti-aliased effects.
288+ *
289+ * - Returns `0.0` when `x` is less than or equal to `edge0`
290+ * - Returns `1.0` when `x` is greater than or equal to `edge1`
291+ * - Smoothly interpolates between `0.0` and `1.0` when `x` is between them
292+ *
293+ * @param {Number } edge0
294+ * Lower edge of the transition
295+ * @param {Number } edge1
296+ * Upper edge of the transition
297+ * @param {Number } x
298+ * Input value to interpolate
299+ *
300+ * @returns {Number }
301+ * A value between `0.0` and `1.0`
302+ *
303+ * @example
304+ * <div modernizr='webgl'>
305+ * <code>
306+ * function material() {
307+ * let t = uniformFloat();
308+ * combineColors.begin();
309+ * let fade = smoothstep(0.2, 0.8, sin(t * 0.001));
310+ * combineColors.opacity *= fade;
311+ * combineColors.end();
312+ * }
313+ * </code>
314+ * </div>
315+ */
316+
278317/**
279318 * @method beforeVertex
280319 * @private
You can’t perform that action at this time.
0 commit comments