xxxxxxxxxx
31
// 2D Perlin noise
//
// Jared Donovan 2022
//
// Simple demo of 2-dimensional perlin noise
// Based on example 15_09 from the Processing handbook
function setup() {
let xSample = 0;
let ySample = 0;
let inc = 0.02;
createCanvas(700, 100);
for (let y = 0; y < height; y = y + 1) {
for (let x = 0; x < width; x = x + 1) {
let gray = noise(xSample, ySample) * 255;
stroke(gray);
point(x, y);
// Increment x sample point
xSample = xSample + inc;
}
// Reset x sample point
xSample = 0;
// Increment y sample point
ySample = ySample + inc;
}
}