xxxxxxxxxx
68
let i = 0;
let j = 0;
function setup() {
createCanvas(900, 2700);
center = createVector(width / 2, height / 2);
cols = ["#001219","#005f73","#0a9396","#94d2bd","#e9d8a6","#ee9b00","#ca6702","#bb3e03","#ae2012","#9b2226"];
curves = [];
count = cols.length;
ch = height / count;
r1 = random(100, 200);
r2 = random(100, 200);
r3 = random(100, 200);
r4 = random(100, 200);
r5 = random(100, 200);
r6 = random(100, 200);
r7 = random(100, 200);
r8 = random(100, 200);
for(i = 0; i < count; i++){
curves[i] = new Curve(width / 2, 1, curves.length);
}
noFill();
strokeWeight(0.1);
background(0);
}
function draw() {
for(j = 0; j < curves.length; j++){
curves[j].update();
}
}
class Curve {
constructor(x, y, index){
this.index = index;
this.a1 = createVector(width / 2, y * index * ch);
this.a2 = createVector(width / 2, y * index * ch + ch);
this.con = createVector(width / 2, y * index * ch + ch / 2 - height);
this.c1 = createVector(0, 0);
this.c2 = createVector(0, 0);
this.rate = 0;
this.c = floor(this.index)
this.col = color(cols[this.c % cols.length]);
}
update(){
stroke(this.col);
this.con.y = this.con.y + 0.5;
this.a1 = createVector(width / 2 + map(noise(this.a1.y * 0.001 + frameCount * 0.00005) + noise(this.a1.y * 0.001) * 0.2, 0, 1.2, -1, 1) * width * 0.25, this.con.y - ch / 2);
this.a2 = createVector(width / 2 + map(noise(this.a2.y * 0.001 + frameCount * 0.00005) + noise(this.a2.y * 0.001) * 0.2, 0, 1.2, -1, 1) * width * 0.25, this.con.y + ch / 2);
this.c1 = createVector((sin(this.con.y * 0.01 + this.index * 0.5)) * width * 0.5 + width / 2, this.con.y + ch / 4);
this.c2 = createVector((sin(this.con.y * 0.01 + this.index * 0.5 + 1)) * width * 0.5 + width / 2, this.con.y - ch / 4);
bezier(this.a1.x, this.a1.y, this.c1.x, this.c1.y, this.c2.x, this.c2.y, this.a2.x, this.a2.y);
// bezier(this.a3.x, this.a3.y, this.c1.x, this.c1.y, this.c2.x, this.c2.y, this.a4.x, this.a4.y);
// if(this.con.y - ch / 2 > height){
// this.con.y = 0 - ch / 2;
// }
}
}