xxxxxxxxxx
function setup() {
createCanvas(400, 400, WEBGL);
noCursor();
rectMode(CENTER);
angleMode(DEGREES);
}
function draw() {
background(1);
steps(0, 50, 0, 255, 0, 255, 100);
steps(0, 35, 120, 1, 0, 0, 50);
steps(0, 25, 160, 255, 0, 255, 20);
steps(60, 25, 160, 255, 0, 255, 20);
steps(-60, 25, 160, 255, 0, 255, 20);
steps(30, 25, 190, 1, 0, 0, 20);
steps(-30, 25, 190, 1, 0, 0, 20);
steps(0, 25, 260, 255, 0, 255, 20);
steps(30, 25, 260, 255, 0, 255, 20);
steps(-30, 25, 260, 255, 0, 255, 20);
steps(-10, 20, 290, 1, 0, 0, 10);
steps(10, 20, 290, 1, 0, 0, 10);
steps(0, 20, 310, 255, 0, 255, 10);
steps(20, 20, 310, 255, 0, 255, 10);
steps(-20, 20, 310, 255, 0, 255, 10);
bgBox(0, -120, -500, 300, 300);
whiteBG(0, -100, -500);
push();
translate(0,-100,-450);
fill(1);
rotateY(millis() / 50);
box(50,100,50);
pop();
}
function steps(x, y, z, r, g, b, s) {
push();
noStroke();
fill(r, g, b);
translate(x, y, z);
rotateX(90);
rotateZ(millis() / 10);
box(s);
pop();
}
function bgBox(x, y, z, l, w) {
push();
noFill();
stroke(255, 0, 255);
strokeWeight(5);
translate(x, y, z);
rotateX(90);
rotateZ(millis() / 10);
box(l, w);
pop();
}
function whiteBG(x, y, z) {
push();
noStroke();
translate(x, y, z);
fill(255);
rect(0, 0, 150, 150);
circle(0, -80, 150);
pop();
}