let colors=["#385380","#156ec9","#3c92bd","#7eaa96","#347f92"]
let sandColors=["#857a76","#942c26","#cb7628"]
createCanvas(windowWidth, windowHeight);
simplex= new openSimplexNoise(Date.now())
let d= map(noise(frameCount/1000), 0, 1, m*0.33, m*0.66)
let x= map(noise(d/(m*2), frameCount/400), 0, 1, width/3, width-width/3)
splootches.push(new splootch(x, height, d, 0))
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y ++) {
var index = (x + y * width) * 4;
let avalue = map(simplex.noise2D(x/3 , y/3 ), -1, 1, 0, 50)
pixels[index + 3] = avalue;
let d= abs(sin(frameCount/400))*(height*0.75)
let x= map(noise(d/m, frameCount/600), 0, 1, 0, width)
splootches.push(new splootch(x, height, d, ci%colors.length))
for(let s of splootches){
this.pos= createVector(x, y);
this.color= colorMixer(colors)
this.sandColor= colorMixer(sandColors)
this.sandColor.setAlpha(100)
let bigOTime= frameCount/400
let smallOTime= frameCount/100
let d= this.d* sin(this.sinPoint)
for(let i=PI; i<TAU; i+=TAU/600){
let bigOff= simplex.noise3D(sin(bscale), cos(bscale),bigOTime)*d/3
let smallOff= simplex.noise3D(sin(i*10), cos(i*12), smallOTime)*d/8
let finalH= d+bigOff+smallOff
let finalW= wScale+bigOff+smallOff
vertex(this.pos.x+cos(i)*finalW, this.pos.y+sin(i)*finalH)
for(let j=0; j<pts; j++){
point(this.pos.x+cos(i)*finalW+random(-20, 20), this.pos.y+sin(i)*finalH+random(-2, 20))
if(this.sinPoint>HALF_PI){
let index= splootches.indexOf(this)
splootches.splice(index, 1)
function colorMixer(colorArray) {
let c = noise(frameCount / 600) * 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))