Skip to content

Instantly share code, notes, and snippets.

@slambert
Created September 13, 2016 21:52
Show Gist options
  • Save slambert/4b5152b85324f5fbb2125c5de2c1c855 to your computer and use it in GitHub Desktop.
Save slambert/4b5152b85324f5fbb2125c5de2c1c855 to your computer and use it in GitHub Desktop.
conditionals, variables example September 13, 2016
// declare boolean variable
boolean switchstatus = false;
void setup(){
size(500,500);
background(0);
}
void draw(){
// Conditional colors
if(switchstatus == true){
fill(255,0,0); // red
} else {
fill(255); // white
}
// Draw the circle
background(0); //make it black!
// make a circle that wont go away
noStroke();
// fill(255);
ellipse(mouseX,mouseY,30,30);
println("Switch is: " + switchstatus);
} //draw
void mouseReleased(){
switchstatus = !switchstatus;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment