let colors = ["#4e5a5a", "#919898", "#fff0b6", "#964301", "#560000"]
createCanvas(windowWidth, windowHeight);
simplex = new openSimplexNoise(Date.now())
skyTexture = createGraphics(width, height)
skyTexture.pixelDensity(1)
skyTexture.background("#8e939f");
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y += floor(random(0, 3))) {
let avalue = map(simplex.noise2D(x / 400, y / 65), -1, 1, 0, 255)
skyTexture.stroke(stroker)
let tinter = color("#a34eae")
rect(0, height * 0.9, width, height * 0.3)
for (let i = 0; i < 15; i++) {
rect(0, height * 0.9, width, height * 0.3)
for (let x = 0; x < width + height * 0.2; x += height * 0.25) {
let xOffset = simplex.noise2D(x, i / 5) * height * 0.2
let h = height * 0.5 + simplex.noise2D(x, i / 2) * height * 0.33
eroded(x + xOffset, height, h, height * 0.33, i / 2, shade)
image(g, 0, -height * 0.02)
image(g, 0, height * 0.1)
for (let x = 0; x < width; x += height * 0.25) {
let xOffset = simplex.noise2D(x, 3.5) * height * 0.2
let h = height * 0.5 + simplex.noise2D(x, 8) * height * 0.33
eroded(x + xOffset, height, h, height * 0.33, 8, 1)
function eroded(x, y, h, w, seed, shade) {
for (let elev = 0; elev < h; elev++) {
fill(colorMixer(elev, x / 10, seed, colors))
let adjW = map(elev, 0, h, w * 1.2, w * 0.3)
let rw = noise(elev / 100, x + y) * adjW
let jiggle = simplex.noise2D(elev / 20, x * 2) * (adjW * 0.01)
ellipse(jiggle, -elev, rw, 4)
for (let elev = 0; elev < h; elev++) {
let adjW = map(elev, 0, h, w * 1.2, w * 0.3)
let rw = noise(elev / 100, x + y) * adjW
let jiggle = simplex.noise2D(elev / 20, x * 2) * (adjW * 0.01)
let shading = map(noise(elev / 100, x + y), 0, 1, 255, 0)
arc(jiggle, -elev, rw, 4, 0, PI)
function colorMixer(elev, pos, seed, colorArray) {
let c = noise(elev / 75, pos, seed) * colorArray.length
let c2 = floor(c + 1) % colorArray.length
let color1 = colorArray[c1]
let color2 = colorArray[c2]
let coloring = color(spectral.mix(color1, color2, mix))