From 5c1872306d91490ffe5538978bb52346cf608a2a Mon Sep 17 00:00:00 2001 From: perminder Date: Thu, 21 May 2026 07:06:09 +0530 Subject: [PATCH 1/4] fixing-noise-reference-for-strands --- src/math/noise.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/math/noise.js b/src/math/noise.js index 2752115494..878b8f739f 100644 --- a/src/math/noise.js +++ b/src/math/noise.js @@ -71,7 +71,7 @@ function noise(p5, fn){ * @param {Number} [z] z-coordinate in noise space. * @return {Number} Perlin noise value at specified coordinates. * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -89,8 +89,9 @@ function noise(p5, fn){ * strokeWeight(5); * point(x, y); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -115,8 +116,9 @@ function noise(p5, fn){ * strokeWeight(5); * point(x, y); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -138,8 +140,9 @@ function noise(p5, fn){ * // Draw the line. * line(x, 0, x, y); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -166,8 +169,9 @@ function noise(p5, fn){ * line(x, 0, x, y); * } * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -196,8 +200,9 @@ function noise(p5, fn){ * * describe('A gray cloudy pattern.'); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -227,6 +232,7 @@ function noise(p5, fn){ * } * } * } + * ``` * * `noise()` can also be used in shaders with p5.strands, where it returns * values in the range 0 to 1. The following example uses `noise()` to create @@ -501,4 +507,4 @@ export default noise; if(typeof p5 !== 'undefined'){ noise(p5, p5.prototype); -} +} \ No newline at end of file From d9862e262fe69bdf301764e2d2a4cb7f22e7710b Mon Sep 17 00:00:00 2001 From: perminder Date: Thu, 21 May 2026 07:19:34 +0530 Subject: [PATCH 2/4] fixes --- src/math/noise.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/math/noise.js b/src/math/noise.js index 878b8f739f..c621633439 100644 --- a/src/math/noise.js +++ b/src/math/noise.js @@ -71,7 +71,11 @@ function noise(p5, fn){ * @param {Number} [z] z-coordinate in noise space. * @return {Number} Perlin noise value at specified coordinates. * - * ```js example + * `noise()` can also be used in shaders with p5.strands, where it returns + * values in the range 0 to 1. One of the examples below uses `noise()` to + * create a cloud-like texture effect in a filter shader. + * + * @example * function setup() { * createCanvas(100, 100); * @@ -89,9 +93,8 @@ function noise(p5, fn){ * strokeWeight(5); * point(x, y); * } - * ``` * - * ```js example + * @example * function setup() { * createCanvas(100, 100); * @@ -116,9 +119,8 @@ function noise(p5, fn){ * strokeWeight(5); * point(x, y); * } - * ``` * - * ```js example + * @example * function setup() { * createCanvas(100, 100); * @@ -140,9 +142,8 @@ function noise(p5, fn){ * // Draw the line. * line(x, 0, x, y); * } - * ``` * - * ```js example + * @example * function setup() { * createCanvas(100, 100); * @@ -169,9 +170,8 @@ function noise(p5, fn){ * line(x, 0, x, y); * } * } - * ``` * - * ```js example + * @example * function setup() { * createCanvas(100, 100); * @@ -200,9 +200,8 @@ function noise(p5, fn){ * * describe('A gray cloudy pattern.'); * } - * ``` * - * ```js example + * @example * function setup() { * createCanvas(100, 100); * @@ -232,13 +231,8 @@ function noise(p5, fn){ * } * } * } - * ``` * - * `noise()` can also be used in shaders with p5.strands, where it returns - * values in the range 0 to 1. The following example uses `noise()` to create - * a cloud-like texture effect in a filter shader. - * - * ```js example + * @example * let myFilter; * * function setup() { @@ -262,7 +256,6 @@ function noise(p5, fn){ * function draw() { * filter(myFilter); * } - * ``` */ fn.noise = function(x, y = 0, z = 0) { if (perlin == null) { From e7d4366bd5242a8ff5a04fd922b1b0d875ecc6db Mon Sep 17 00:00:00 2001 From: perminder Date: Thu, 21 May 2026 08:16:07 +0530 Subject: [PATCH 3/4] fixing --- src/math/noise.js | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/math/noise.js b/src/math/noise.js index c621633439..fcc26a42d8 100644 --- a/src/math/noise.js +++ b/src/math/noise.js @@ -65,17 +65,7 @@ function noise(p5, fn){ * three dimensions. These dimensions can be thought of as space, as in * `noise(x, y, z)`, or space and time, as in `noise(x, y, t)`. * - * @method noise - * @param {Number} x x-coordinate in noise space. - * @param {Number} [y] y-coordinate in noise space. - * @param {Number} [z] z-coordinate in noise space. - * @return {Number} Perlin noise value at specified coordinates. - * - * `noise()` can also be used in shaders with p5.strands, where it returns - * values in the range 0 to 1. One of the examples below uses `noise()` to - * create a cloud-like texture effect in a filter shader. - * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -93,8 +83,9 @@ function noise(p5, fn){ * strokeWeight(5); * point(x, y); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -119,8 +110,9 @@ function noise(p5, fn){ * strokeWeight(5); * point(x, y); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -142,8 +134,9 @@ function noise(p5, fn){ * // Draw the line. * line(x, 0, x, y); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -170,8 +163,9 @@ function noise(p5, fn){ * line(x, 0, x, y); * } * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -200,8 +194,9 @@ function noise(p5, fn){ * * describe('A gray cloudy pattern.'); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -231,8 +226,13 @@ function noise(p5, fn){ * } * } * } + * ``` * - * @example + * `noise()` can also be used in shaders with p5.strands, where it returns + * values in the range 0 to 1. The example below uses `noise()` inside a + * filter shader to create a cloud-like texture effect: + * + * ```js example * let myFilter; * * function setup() { @@ -256,6 +256,13 @@ function noise(p5, fn){ * function draw() { * filter(myFilter); * } + * ``` + * + * @method noise + * @param {Number} x x-coordinate in noise space. + * @param {Number} [y] y-coordinate in noise space. + * @param {Number} [z] z-coordinate in noise space. + * @return {Number} Perlin noise value at specified coordinates. */ fn.noise = function(x, y = 0, z = 0) { if (perlin == null) { From a33d206bccfa70839a640f7e5e5de01f8146ca3c Mon Sep 17 00:00:00 2001 From: perminder Date: Thu, 21 May 2026 08:23:44 +0530 Subject: [PATCH 4/4] fixing-random-and-millis --- src/math/random.js | 28 +++++++++++++++++----------- src/utilities/time_date.js | 17 +++++++++++------ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/math/random.js b/src/math/random.js index f6bc21eb3d..717c6bccc1 100644 --- a/src/math/random.js +++ b/src/math/random.js @@ -105,12 +105,7 @@ function random(p5, fn){ * For example, calling `random(-5, 10.2)` returns values from -5 up to but * not including 10.2. * - * @method random - * @param {Number} [min] lower bound (inclusive). - * @param {Number} [max] upper bound (exclusive). - * @return {Number} random number. - * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -126,8 +121,9 @@ function random(p5, fn){ * * describe('A black dot appears in a random position on a gray square.'); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -143,8 +139,9 @@ function random(p5, fn){ * * describe('A black dot appears in a random position on a gray square.'); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -165,8 +162,9 @@ function random(p5, fn){ * * describe('An animal face is displayed at random. Either a lion, tiger, or bear.'); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -187,8 +185,9 @@ function random(p5, fn){ * strokeWeight(5); * point(x, y); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -209,8 +208,9 @@ function random(p5, fn){ * strokeWeight(5); * point(x, y); * } + * ``` * - * @example + * ```js example * let x = 50; * let y = 50; * @@ -230,6 +230,7 @@ function random(p5, fn){ * // Draw the point. * point(x, y); * } + * ``` * * `random()` can also be used in shaders with p5.strands. The following example * uses `random()` to create varying colors on a shape. @@ -259,6 +260,11 @@ function random(p5, fn){ * sphere(30); * } * ``` + * + * @method random + * @param {Number} [min] lower bound (inclusive). + * @param {Number} [max] upper bound (exclusive). + * @return {Number} random number. */ /** * @method random diff --git a/src/utilities/time_date.js b/src/utilities/time_date.js index 5b85c4dcbb..5b0b4c154b 100644 --- a/src/utilities/time_date.js +++ b/src/utilities/time_date.js @@ -108,10 +108,8 @@ function timeDate(p5, fn){ * sketch includes asynchronous loading using `async`/`await`, then * `millis()` begins tracking time as soon as the asynchronous code * starts running. - * @method millis - * @return {Number} number of milliseconds since starting the sketch. * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -132,8 +130,9 @@ function timeDate(p5, fn){ * `The text 'Startup time: ${round(ms, 2)} ms' written in black on a gray background.` * ); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -154,8 +153,9 @@ function timeDate(p5, fn){ * // Display how long the sketch has run. * text(`Running time: ${nf(s, 1, 1)} sec`, 5, 50, 90); * } + * ``` * - * @example + * ```js example * function setup() { * createCanvas(100, 100); * @@ -174,8 +174,9 @@ function timeDate(p5, fn){ * // Draw the circle. * circle(x, 50, 30); * } + * ``` * - * @example + * ```js example * async function setup() { * // Load the GeoJSON. * await loadJSON('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson'); @@ -198,6 +199,7 @@ function timeDate(p5, fn){ * `The text "It took ${round(ms, 2)} ms to load the data" written in black on a gray background.` * ); * } + * ``` * * `millis()` can also be used in shaders with p5.strands. The following example * uses `millis()` to create time-based color transitions on a shape. @@ -228,6 +230,9 @@ function timeDate(p5, fn){ * sphere(30); * } * ``` + * + * @method millis + * @return {Number} number of milliseconds since starting the sketch. */ fn.millis = function() { if (this._millisStart === -1) {