xxxxxxxxxx
71
function setup() {
createCanvas(900, 900);
dots = [];
cols = ["#001219","#005f73","#0a9396","#94d2bd","#e9d8a6","#ee9b00","#ca6702","#bb3e03","#ae2012","#9b2226"];
count = 900
for(i = 0; i < count; i++){
dots[dots.length] = new Dot(width / count * i, height / 2);
}
p1 = 0.01
p2 = 0.0025
strokeWeight(2)
}
function draw() {
background(0);
for(i = 0; i < dots.length; i++){
dots[i].update();
}
}
class Dot{
constructor(x, y){
this.pt1 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt2 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt3 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt4 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt5 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt6 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt7 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt8 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt9 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
this.pt10 = createVector(x, (sin(x * 0.05) + sin(x * 0.01)) * height * 0.1 + height * 0.5);
}
update(){
this.pt1 = createVector(this.pt1.x, (sin(this.pt1.x * p1 + frameCount * 0.01) + sin(this.pt1.x * p2 + frameCount * 0.027)) * height * 0.25 + height * 0.5);
stroke(cols[0]);
point(this.pt1.x, this.pt1.y);
this.pt2 = createVector(this.pt2.x, (sin(this.pt2.x * p1 + frameCount * 0.01 + 0.02) + sin(this.pt2.x * p2 + frameCount * 0.027 + 0.02)) * height * 0.25 + height * 0.5);
stroke(cols[1]);
point(this.pt2.x, this.pt2.y);
this.pt3 = createVector(this.pt3.x, (sin(this.pt3.x * p1 + frameCount * 0.01 + 0.04) + sin(this.pt3.x * p2 + frameCount * 0.027 + 0.04)) * height * 0.25 + height * 0.5);
stroke(cols[2]);
point(this.pt3.x, this.pt3.y);
this.pt4 = createVector(this.pt4.x, (sin(this.pt4.x * p1 + frameCount * 0.01 + 0.06) + sin(this.pt4.x * p2 + frameCount * 0.027 + 0.06)) * height * 0.25 + height * 0.5);
stroke(cols[3]);
point(this.pt4.x, this.pt4.y);
this.pt5 = createVector(this.pt5.x, (sin(this.pt5.x * p1 + frameCount * 0.01 + 0.08) + sin(this.pt5.x * p2 + frameCount * 0.027 + 0.08)) * height * 0.25 + height * 0.5);
stroke(cols[4]);
point(this.pt5.x, this.pt5.y);
this.pt6 = createVector(this.pt6.x, (sin(this.pt6.x * p1 + frameCount * 0.01 + 0.1) + sin(this.pt6.x * p2 + frameCount * 0.027 + 0.1)) * height * 0.25 + height * 0.5);
stroke(cols[5]);
point(this.pt6.x, this.pt6.y);
this.pt7 = createVector(this.pt7.x, (sin(this.pt7.x * p1 + frameCount * 0.01 + 0.12) + sin(this.pt7.x * p2 + frameCount * 0.027 + 0.12)) * height * 0.25 + height * 0.5);
stroke(cols[6]);
point(this.pt7.x, this.pt7.y);
this.pt8 = createVector(this.pt8.x, (sin(this.pt8.x * p1 + frameCount * 0.01 + 0.14) + sin(this.pt8.x * p2 + frameCount * 0.027 + 0.14)) * height * 0.25 + height * 0.5);
stroke(cols[7]);
point(this.pt8.x, this.pt8.y);
this.pt9 = createVector(this.pt9.x, (sin(this.pt9.x * p1 + frameCount * 0.01 + 0.16) + sin(this.pt9.x * p2 + frameCount * 0.027 + 0.16)) * height * 0.25 + height * 0.5);
stroke(cols[8]);
point(this.pt9.x, this.pt9.y);
this.pt10 = createVector(this.pt10.x, (sin(this.pt10.x * p1 + frameCount * 0.01 + 0.18) + sin(this.pt10.x * p2 + frameCount * 0.027 + 0.18)) * height * 0.25 + height * 0.5);
stroke(cols[9]);
point(this.pt10.x, this.pt10.y);
}
}