Skip to content

Instantly share code, notes, and snippets.

@mimetaur
Last active November 1, 2019 16:41
Show Gist options
  • Save mimetaur/996da9e3eeb250091e23260f71dede97 to your computer and use it in GitHub Desktop.
Save mimetaur/996da9e3eeb250091e23260f71dede97 to your computer and use it in GitHub Desktop.
Code 1 2019 - Week 5 Sketch #2 Solution 02 (Theresa)
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255);
drawButton(100, 100, 200, 200);
if (mouseIsPressed &&
mouseX > 100 && mouseX < 300 &&
mouseY > 100 && mouseY < 300 ) {
fill(0, 255, 0);
} else {
fill(255, 0, 0);
}
print(mouseIsPressed);
}
function drawButton(x, y, w, h) {
rect(x, y, w, h, 10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment