xxxxxxxxxx
53
function setup() {
createCanvas(800, 800);
background(0);
stroke(255);
noFill();
}
function draw() {
drawCircle();
drawSquare();
drawTriangle();
drawRectangle();
drawTrapezoid();
drawParallelogram();
noLoop();
}
function drawCircle() {
ellipse(400, 400, 200, 200);
}
function drawSquare() {
rectMode(CENTER);
rect(400, 400, 200, 200);
}
function drawTriangle() {
triangle(400, 300, 500, 500, 300, 500);
}
function drawRectangle() {
rectMode(CENTER);
rect(400, 400, 300, 150);
}
function drawTrapezoid() {
beginShape();
vertex(350, 300);
vertex(450, 300);
vertex(500, 500);
vertex(300, 500);
endShape(CLOSE);
}
function drawParallelogram() {
beginShape();
vertex(300, 350);
vertex(500, 350);
vertex(550, 450);
vertex(350, 450);
endShape(CLOSE);
}