xxxxxxxxxx
83
let width =400;
let height=400;
let size = 50;
let shapes = [];
function setup() {
createCanvas(width , height);
rectMode(CENTER);
ellipseMode(CENTER);
angleMode(DEGREES);
let rows = width/size;
let cols = height/size;
for(let x=0; x<rows; x+=1){
for(let y=0; y<cols; y+=1){
let r = random(['L','M']);
let obj = new Panel(size,x * size + size/2,y * size + size/2,r);
shapes.push(obj);
}
}
}
function grid(){
for(let k =0; k<3; k++){
rotateY(90);
rotateZ(90);
let tmp = size * 0.5 + k;
for(let i=tmp; i < width; i+=size){
for(let j=tmp; j < height; j+=size){
push();
translate(i,j,width);
let r = random(['L','M']);
let obj = new Panel(size,i,j,r);
obj.chora();
pop();
}
}
}
}
function draw(){
background(255);
// translate(-width/2 + size,-height/2 + size);
for(let i=0; i<shapes.length; i++){
shapes[i].display();
}
noLoop();
}