xxxxxxxxxx
55
function setup() {
createCanvas(600, 400);
circle(100, 100, 100);
}
function mousePressed() {
console.log(mouseX, mouseY);
}
function draw() {
background(220);
ellipse(mouseX, mouseY, 200);
// call, invoke, run
sandwich("blue", "red");
// shapes
// point
strokeWeight(10);
point(500, 50);
// point based shapes
line(300, 300, 400, 300);
// triangle
triangle(350, 100, 350, 200, 450, 200);
// quad
quad(150, 300, 250, 300, 200, 400, 100, 400);
// origin with size based shapes
circle(300, 100, 50);
ellipse(300, 100, 50, 20);
square(300, 200, 50);
rect(375, 225, 100, 100, 10, 20, 30, 50);
arc(500, 100, 100, 100, 0, PI * 1.5, OPEN);
}
// function declaration
function sandwich(jelly, butter) {
fill(jelly)
circle(100, 100, 100);
fill(butter);
rect(100, 100, 100);
}