xxxxxxxxxx
44
class Builder{
constructor(x, y, index){
this.opos = createVector(x, y);
this.pos = createVector(x, y);
this.vel = createVector(1, 0);
this.c = floor(random(cols.length));
this.col = color(cols[this.c]);
this.col.setAlpha(200)
this.index = index;
this.nscale = this.c + 100;
strokeWeight(1);
}
move(){
this.nscale = this.nscale + 0.5;
this.nf = noise((this.pos.x - (width / 2)) / this.nscale, (this.pos.y - (height / 2)) / this.nscale, this.c / 50);
this.vel.setHeading((this.nf * TWO_PI) * 4);
// this.vel.setMag(this.nf * 5)
this.pos.add(this.vel);
if(this.pos.x < 0){
this.pos = this.opos;
}
if(this.pos.y < 0){
this.pos = this.opos;
}
if(this.pos.x > width){
this.pos = this.opos;
}
if(this.pos.y > height){
this.pos = this.opos;
}
if(this.nscale > 500){
builders[this.index] = undefined;
}
stroke(this.col);
point(this.pos.x, this.pos.y);
// if(noise(this.pos.x / 800, this.pos.y / 800) > 0){
// stroke(this.col);
// point(this.pos.x, this.pos.y);
// }
}
}