xxxxxxxxxx
45
let w = 0.1;
function setup() {
createCanvas(500, 500, WEBGL);
}
function draw() {
background(0, 0, 80);
animate();
draw_it();
}
function animate() {
rotateX(w);
rotateY(w);
w += 0.01;
}
function draw_it() {
let rd =10, w =100, h=50;
noStroke();
fill(200,200,0);
push();
translate(w/2,h/2,0);
sphere(rd);
pop();
push();
translate(-w/2,-h/2,0);
sphere(rd);
pop();
push();
translate(w/2,-h/2,0);
sphere(rd);
pop();
push();
translate(-w/2,h/2,0);
sphere(rd);
pop();
noStroke();
fill(200,0,0);
rect(-w/2,-h/2,w,h);
}