Skip to content

Instantly share code, notes, and snippets.

@claytical
Created February 1, 2016 16:24
Show Gist options
  • Save claytical/bee037f843d53ba7e93f to your computer and use it in GitHub Desktop.
Save claytical/bee037f843d53ba7e93f to your computer and use it in GitHub Desktop.
If with and
function setup() {
createCanvas(500,500);
}
function draw() {
background(255,255,255);
if (mouseY > height/2 && mouseX > width/2) {
fill(255,0,0);
ellipse(width/2, height/2, 50, 50);
}
if (mouseY > height/2 && mouseX < width/2) {
fill(255,255,0);
ellipse(width/2, height/2, 10, 10);
}
if (mouseY < height/2 && mouseX > width/2) {
fill(0,0,255);
rect(width/2, height/2, 50, 50);
}
if (mouseY < height/2 && mouseX < width/2) {
fill(0,255,0);
triangle(0, height, width/2, 0, width, height);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment