@@ -306,25 +306,22 @@ if (typeof p5 !== "undefined") {
306306 * A value between `0.0` and `1.0`
307307 *
308308 * @example
309- * <div modernizr=' webgl' >
309+ * <div modernizr=" webgl" >
310310 * <code>
311- * // Example 1: Smooth fade across the canvas using coordinates (no uniforms)
311+ * // Example 1: A soft vertical fade using smoothstep (no uniforms)
312312 *
313313 * let fadeShader;
314314 *
315315 * function fadeCallback() {
316- * getColor((inputs, canvasContent ) => {
317- * // Normalized x coordinate ( 0 → 1 across the canvas)
316+ * getColor((inputs) => {
317+ * // x goes from 0 → 1 across the canvas
318318 * let x = inputs.texCoord.x;
319319 *
320- * // Narrow smooth transition band
321- * let t = smoothstep(0.4, 0.6, x);
322- *
323- * // Sample the original color
324- * let col = getTexture(canvasContent, inputs.texCoord);
320+ * // smoothstep creates a soft transition instead of a hard edge
321+ * let t = smoothstep(0.45, 0.55, x);
325322 *
326- * // Fade from black to the original image
327- * return [col.rgb * t, col.a ];
323+ * // Use t directly as brightness
324+ * return [t, t, t, 1 ];
328325 * });
329326 * }
330327 *
@@ -335,15 +332,13 @@ if (typeof p5 !== "undefined") {
335332 *
336333 * function draw() {
337334 * background(0);
338- * fill(255);
339- * rect(-100, -50, 200, 100);
340335 * filter(fadeShader);
341336 * }
342337 * </code>
343338 * </div>
344339 *
345340 * @example
346- * <div modernizr=' webgl' >
341+ * <div modernizr=" webgl" >
347342 * <code>
348343 * // Example 2: Animate the smooth transition using a uniform
349344 *
@@ -352,15 +347,14 @@ if (typeof p5 !== "undefined") {
352347 * function animatedFadeCallback() {
353348 * const time = uniformFloat(() => millis() * 0.001);
354349 *
355- * getColor((inputs, canvasContent ) => {
350+ * getColor((inputs) => {
356351 * let x = inputs.texCoord.x;
357352 *
358- * // Move the smoothstep band back and forth
353+ * // Move the smoothstep band back and forth over time
359354 * let center = 0.5 + 0.25 * sin(time);
360355 * let t = smoothstep(center - 0.05, center + 0.05, x);
361356 *
362- * let col = getTexture(canvasContent, inputs.texCoord);
363- * return [col.rgb * t, col.a];
357+ * return [t, t, t, 1];
364358 * });
365359 * }
366360 *
@@ -371,8 +365,6 @@ if (typeof p5 !== "undefined") {
371365 *
372366 * function draw() {
373367 * background(0);
374- * fill(255);
375- * rect(-100, -50, 200, 100);
376368 * filter(animatedShader);
377369 * }
378370 * </code>
0 commit comments