xxxxxxxxxx
32
let colors = ["#ffb000", "#ff4200", "#7da030", "#ff99cc", "#1d1d1b", "#f2f2e7"];
let layers = 40; // Number of sedimentary layers
let noiseScale = 0.01; // Scale for noise to control smoothness
let layerHeight = 15; // Vertical height of each layer
function setup() {
createCanvas(800, 600);
noLoop();
}
function draw() {
background("#f2f2e7");
noStroke();
for (let y = 0; y < height; y += layerHeight) {
fill(random(colors)); // Randomly select a color for each layer
beginShape();
// Generate smooth curves with Perlin noise
for (let x = 0; x <= width; x += 10) {
let yOffset = noise(x * noiseScale, y * noiseScale) * 100; // Adjust 100 for groove depth
curveVertex(x, y + yOffset);
}
// Finish the shape to fill the area
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
}
}