xxxxxxxxxx
48
var lines =[];
function setup() {
createCanvas(600, 400);
for (var i= 0; i<50; i++){
lines.push(new fawk());
}
}
function draw() {
background(51);
for (let i = 0; i < lines.length; i++) {
lines[i].show();
lines[i].move();
}
}
class fawk{
constructor(){
this.x1 = random(width);
this.y1 =random(height);
this.x2= random(width);
this.y2=random(height);
this.speed =2;
this.stroke =random(1,5);
this.r = random(255);
this.b = random(255);
this.g = random (255);
}
show(){
stroke(this.r,this.g,this.b,127);
strokeWeight(this.stroke);
line(this.x1,this.y1,this.x2,this.y2);
}
move(){
this.y1 =this.y1/this.speed/.5;
this.y2 =this.y2 /this.speed/.5;
this.x1 = this.x1 / this.speed;
this.x2 = this.x2 + this.speed;
}
}