xxxxxxxxxx
60
let m = -200;
function art() {
for (let i = 10; i < 1000; i += 50) {
for (let j = 20; j < 1000; j += 100) {
push();
translate(j - i, i);
drawBox();
pop();
}
}
for (let i = 10; i < 1000; i += 50) {
for (let j = 20; j < 1000; j += 100) {
push();
translate(i, j - i);
drawBox();
pop();
}
}
for (let a = -350; a < 350; a += 30) {
push();
translate(a + 10, (m += 0.001));
drawBox(20, 50, 10);
pop();
}
}
//function for box
function drawBox() {
rotateX(frameCount * 0.01); //rotate about x-axis
rotateY(frameCount * 0.01); //rotate about y-axis
stroke(0);
noFill();
box(3, 3, 30); //draw box
//second box
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.05);
stroke(255, 255, 255);
noFill();
box(3, 3, 30);
}
function setup() {
createCanvas(750, 400, WEBGL);
background(220);
}
function draw() {
art();
}
function mousePressed() {
background(220);
}
//challenges faced
//