Skip to content

Instantly share code, notes, and snippets.

@slambert
Created September 15, 2015 16:26
Show Gist options
  • Save slambert/938ebeb1d61c25786d45 to your computer and use it in GitHub Desktop.
Save slambert/938ebeb1d61c25786d45 to your computer and use it in GitHub Desktop.
Done with one IF statement
/*
Steve Lambert
Super Stunning Psychedelic Booleans v0.1
September 15, 2015
Done with one IF statement
*/
void setup(){
size(800,600); // how big it is, you know this.
println("Welcome to Steve's Psychedelic Light Show");
println("Width: " + width); // dumb question, dumb answer
} // end setup
void draw(){
background(250); // dull
// THIS WORKS
if (mouseX <= width/4 || mouseX >= width/4 * 3) { // if we go to the left or right quarter
// then do this:
background(255,0,0); // paint the town red
println("X: " + mouseX);
}
//// THIS WORKS
//// Greater than or = to 600 turn red
//if (mouseX >= (width/4 * 3)) { // if we go to the right quarter
//// then do this:
// background(255,0,0); // paint the town red
// println("X: " + mouseX);
// }
} // end draw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment