xxxxxxxxxx
87
function setup() {
createCanvas(400, 400, WEBGL);
}
function draw() {
background(220);
// translate(mouseX-width/2,mouseY-height/2);
let dirX = (mouseX / width - 0.5) * 2;
let dirY = (mouseY / height - 0.5) * 2;
directionalLight(250, 250, 250, -dirX, -dirY, -1);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
rotateZ(frameCount * 0.01);
torus(150, 50, 10, 10);
push();
rotateX(frameCount * 0.01);
fill(20, 200, 50);
pop();
box(100, 100, 20);
fill(255, 200, 30);
mytorus2 = torus(15, 30, 5, 5);
fill(200, 255, 0);
// box([width], [Height], [depth], [detailX], [detailY])
// torus([radius], [tubeRadius], [detailX], [detailY])
push();
translate(100, 100, 100);
rotateY(frameCount * 0.01);
sphere(40);
pop();
fill(240, 40, 0);
push();
translate(30, 30, 30);
rotateY(frameCount * 0.01);
sphere(30);
pop();
fill(120, 120, 0);
push();
translate(-220, 150, 30);
rotateY(frameCount * 0.01);
sphere(40);
pop();
fill(240, 40, 0);
push();
translate(-22,-220,20);
rotateY(frameCount * 0.01);
sphere(40);
pop();
fill(250,60,0);
}