xxxxxxxxxx
75
class Strip{
constructor(x,y,length,angle){
this.x = x;
this.y = y;
this.length = length;
this.angle = angle;
this.size = 30;
}
update(){
this.angle+=1;
if(this.angle > 360){
this.angle = 0;
}
}
display(){
push();
rotateY(this.angle);
translate(this.x,this.y);
let border_w = this.length * 0.03;
let cell_h = y_space * 0.7;
let cell_w = this.size;
let start_y = -this.length/2;
noStroke();
noFill();
for(let i=0; i<this.length; i+=this.size){
if(i >= this.length/2){
fill(random( [125,90,200,220,255]));
rect(start_y + i ,0,cell_w,cell_h * 0.9);
}else{
fill(random(['#3A353B','#7B565D']));
rect(start_y + i ,0,cell_w,cell_h * 0.9);
}
}
stroke(0);
fill(0);
push();
rotateX(45);
rect(-this.length/1.85,0,border_w,cell_h * 1.8);
pop();
push();
rotateX(360-45);
rect(this.x + this.length/2.112,0,border_w,cell_h * 1.8);
pop();
pop();
}
}