xxxxxxxxxx
44
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, 0, dots.length);
}
p1 = 0
p2 = 0.001
strokeWeight(1);
noFill();
}
function draw() {
background(0);
p1 = p1 + 0.000001
for(i = 0; i < dots.length; i++){
dots[i].update();
}
}
class Dot{
constructor(x, y, index){
this.opos = createVector(x, y);
this.pos = createVector(x, y);
this.npos = createVector(x, y);
this.index = index;
}
update(){
// this.npos = createVector(this.opos.x + noise(sin(this.opos.y * p1 + frameCount * 0.01), frameCount * 0.001) * width / 2, this.opos.y + noise(sin(this.opos.x * p2 + frameCount * 0.01), frameCount * 0.001) * height / 2);
this.npos = createVector(this.opos.x + sin(this.pos.y * p1, frameCount * 0.001) * width, this.opos.y + sin(noise(this.opos.x * p2, (frameCount + this.index) * 0.001, this.index * 0.01)) * height);
stroke(cols[this.index % cols.length]);
if(this.index > 0){
line(this.npos.x, this.npos.y, dots[this.index - 1].npos.x, dots[this.index - 1].npos.y);
}
this.pos = createVector(this.npos.x, this.npos.y);
}
}