xxxxxxxxxx
21
function setup() {
createCanvas(400, 400, WEBGL); // include WEBGL for 3D rendering
}
function draw() {
background(220);
// Rotate the canvas
rotateX(frameCount*0.01);
rotateY(frameCount*0.01);
// Coordinates for verteces of the pyramid
line(0,0,0,50,0,0);
line(50,0,0,50,50,0);
line(50,50,0,0,50,0);
line(0,50,0,0,0,0);
line(0,0,0,25,25,50);
line(50,0,0,25,25,50);
line(50,50,0,25,25,50);
line(0,50,0,25,25,50);
}