Skip to content

Commit c7e638b

Browse files
authored
Merge pull request #8417 from shuklaaryan367-byte/fix-noiseDetail-default-falloff-2x
Fix `noiseDetail()` in p5.js 2.x so that the `falloff` parameter defaults to `0.5` when omitted.
2 parents 595f354 + 532660d commit c7e638b

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

docs/parameterData.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,11 +1485,14 @@
14851485
"noiseDetail": {
14861486
"overloads": [
14871487
[
1488-
"Number",
1488+
"Number"
1489+
],
1490+
[
1491+
"Number",
14891492
"Number"
14901493
]
1491-
]
1492-
},
1494+
]
1495+
},
14931496
"noiseSeed": {
14941497
"overloads": [
14951498
[

src/math/noise.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ function noise(p5, fn){
343343
*
344344
* @method noiseDetail
345345
* @param {Number} lod number of octaves to be used by the noise.
346-
* @param {Number} falloff falloff factor for each octave.
346+
* @param {Number} [falloff=0.5] falloff factor for each octave.
347347
*
348348
* @example
349349
* <div>
@@ -388,7 +388,7 @@ function noise(p5, fn){
388388
* </code>
389389
* </div>
390390
*/
391-
fn.noiseDetail = function(lod, falloff) {
391+
fn.noiseDetail = function(lod, falloff=0.5) {
392392
if (lod > 0) {
393393
perlin_octaves = lod;
394394
}

src/strands/strands_api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export function initGlobalStrandsAPI(p5, fn, strandsContext) {
165165
strandsContext._noiseOctaves = null;
166166
strandsContext._noiseAmpFalloff = null;
167167

168-
fn.noiseDetail = function (lod, falloff) {
168+
fn.noiseDetail = function (lod, falloff = 0.5) {
169169
if (!strandsContext.active) {
170170
return originalNoiseDetail.apply(this, arguments);
171171
}

0 commit comments

Comments
 (0)