Skip to content

Instantly share code, notes, and snippets.

@slambert
Created February 7, 2018 17:36
Show Gist options
  • Select an option

  • Save slambert/4a73b9483ede74882ef83d969bdcb493 to your computer and use it in GitHub Desktop.

Select an option

Save slambert/4a73b9483ede74882ef83d969bdcb493 to your computer and use it in GitHub Desktop.
/* If/then, click and drag, variable, || etc v0.1
/* If/then, click and drag, variable, || etc v0.1
Steve Lambert February 7, 2018
todo:
gravity
*/
color darkBlue = color(34, 83, 120);
color medBlue = color(22, 149, 163);
color lightBlue = color(172, 240, 242);
color offWhite = color(243, 255, 226);
color orange = color(235, 127, 0);
int whichThird = 2;
void setup() {
noStroke();
size(1000, 1000);
} // end setup
void draw() {
if (mouseX < width/3) { // if in right third
whichThird = 0;
} else if (mouseX > width/3 && mouseX < width/3*2){
// mouseX > 333 AND mouseX < 666
whichThird = 1;
} else {
whichThird = 2;
}
println("whichThird = " + whichThird);
if (whichThird == 0 || mouseY >= 900){
background(lightBlue);
fill(darkBlue);
} else if (whichThird == 1){
background(medBlue);
fill(orange);
} else {
fill(offWhite);
background(orange);
}
ellipse(mouseX, mouseY, 50, 50);
}// end draw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment