xxxxxxxxxx
38
// Perlin noise map generator
//
// Jared Donovan 2022
//
// Generates an infinitely scrolling landscape from perlin noise.
let seaColor = "#1B1BBE";
let landColor = "#27DF71";
let beachColor = "#FFEB3B";
function setup() {
createCanvas(400, 400);
noStroke();
}
function draw() {
background(220);
let offsetX = frameCount * 0.1;
let offsetY = frameCount * 0.2;
for (let x = 0; x <= width; x = x + 4){
for (let y = 0; y <= height; y = y + 4){
//stroke(random(255));
let samp = noise(offsetX + x * 0.01, offsetY + y * 0.01);
if (samp < 0.5){
fill(seaColor);
} else if (samp < 0.55){
fill(beachColor);
} else {
fill(landColor);
}
square(x, y, 4);
}
}
//noLoop();
}