xxxxxxxxxx
26
let size = 60;
let smiley = []; let cols = 5; let rows = 5;
function setup() {
createCanvas(400, 400);
rectMode(CENTER);
for (let i=0; i<cols; i++) {
smiley[i] = [];
for (let j=0; j<rows; j++) {
smiley[i][j] = new Smiley(i*size, j*size);
}
}
}
function draw() {
background(220);
translate(size/2-size*cols/2, size/2-size*rows/2);
translate(width/2, height/2);
for (let i=0; i<cols; i++) {
for (let j=0; j<rows; j++) {
smiley[i][j].display();
}
}
}