let colors = ["#ea9751", "#fd8637", "#d3661c", "#b8593f", "#e61111", "#4a727a", "#086253", "#2e201f"]
createCanvas(windowWidth, windowHeight);
simplex = new openSimplexNoise(Date.now())
for (let yer = 0; yer < height * 0.7; yer++) {
for (let x = -width / 50; x < width + width / 50; x++) {
let yoff = simplex.noise2D(yer / 20, x / 100) * (yer / 50)
let xoff = simplex.noise2D(yer / 100, x / 100) * (width / 40)
vertex(x + xoff, height * 0.4 + yer + yoff)
for (let x = 0; x < width; x += 2) {
let bh = randomGaussian(0, height / 10)
lights.push(new light(x + xoff, bh, 0))
lights.push(new light(x + xoff, bh, 1))
rect(0, height * 0.4, width, height * 0.6)
constructor(x, baseH, type) {
this.targetH = (height * 0.4) + abs(this.baseH) * -1
this.targetH = (height * 0.4) + abs(this.baseH) * 1.4
this.color = color(colorMixer(this.x, colors))
this.frames = abs(this.targetH - height * 0.4)
if (this.currentFrame < this.frames) {
let framesMap = map(this.currentFrame, 0, this.frames, 0, 1);
this.h = lerp(height * 0.4, this.targetH, easeOutQuart(framesMap))
let s = map(abs(this.h - height * 0.4), 0, height * 0.4, 4, 30)
ellipse(this.x, this.h, s)
let xoff = simplex.noise2D(this.h / 10, this.x / 70) * (this.h / 50)
let yoff = simplex.noise2D(this.h / 5, this.x / 200) * this.h / 100
ellipse(this.x + xoff, this.h + yoff, s)
if (this.currentFrame > this.frames) {
let index = lights.indexOf(this)
function easeOutQuart(x) {
return 1 - Math.pow(1 - x, 4);
function colorMixer(x, colorArray) {
let c = noise(x) * colorArray.length
let c2 = floor(c + 1) % colorArray.length
let color1 = colorArray[c1]
let color2 = colorArray[c2]
let coloring = spectral.mix(color1, color2, mix)