Skip to content

Commit 01d63b0

Browse files
use canvas dimensions instead of arbitrary constants to make code more consistent and its purpose more readable
1 parent 983276d commit 01d63b0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/math/noise.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ let perlin; // will be initialized lazily by noise() or noiseSeed()
168168
* let noiseScale = 0.002;
169169
*
170170
* // Iterate from left to right.
171-
* for (let x = 0; x < 100; x += 1) {
171+
* for (let x = 0; x < width; x += 1) {
172172
* // Scale the input coordinates.
173173
* let nx = noiseScale * x;
174174
* let nt = noiseScale * frameCount;
@@ -195,9 +195,9 @@ let perlin; // will be initialized lazily by noise() or noiseSeed()
195195
* let noiseScale = 0.01;
196196
*
197197
* // Iterate from top to bottom.
198-
* for (let y = 0; y < 100; y += 1) {
198+
* for (let y = 0; y < height; y += 1) {
199199
* // Iterate from left to right.
200-
* for (let x = 0; x < 100; x += 1) {
200+
* for (let x = 0; x < width; x += 1) {
201201
* // Scale the input coordinates.
202202
* let nx = noiseScale * x;
203203
* let ny = noiseScale * y;
@@ -230,7 +230,7 @@ let perlin; // will be initialized lazily by noise() or noiseSeed()
230230
* let noiseScale = 0.009;
231231
*
232232
* // Iterate from top to bottom.
233-
* for (let y = 0; y < 100; y += 1) {
233+
* for (let y = 0; y < height; y += 1) {
234234
* // Iterate from left to right.
235235
* for (let x = 0; x < width; x += 1) {
236236
* // Scale the input coordinates.
@@ -361,9 +361,9 @@ p5.prototype.noise = function(x, y = 0, z = 0) {
361361
* let noiseScale = 0.02;
362362
*
363363
* // Iterate from top to bottom.
364-
* for (let y = 0; y < 100; y += 1) {
364+
* for (let y = 0; y < height; y += 1) {
365365
* // Iterate from left to right.
366-
* for (let x = 0; x < 50; x += 1) {
366+
* for (let x = 0; x < width / 2; x += 1) {
367367
* // Scale the input coordinates.
368368
* let nx = noiseScale * x;
369369
* let ny = noiseScale * y;

0 commit comments

Comments
 (0)