Last active
September 20, 2016 21:56
-
-
Save slambert/fd2a02ddc31738160406499204de5a34 to your computer and use it in GitHub Desktop.
Track amount of times mouse has clicked and change sketch. More than a switch....
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // declare int variable | |
| int clickcount = 0; | |
| void setup(){ | |
| size(500,500); | |
| background(0); | |
| } | |
| void draw(){ | |
| // Conditional colors | |
| if(clickcount == 0){ | |
| background(255,0,0); // red | |
| } if (clickcount == 1){ | |
| background(255); // white | |
| } if (clickcount == 2){ | |
| background(255,0,255); // magenta | |
| } if (clickcount >=3){ | |
| background(random(255)); | |
| } | |
| // Draw the circle | |
| //background(0); //make it black! | |
| // make a circle that wont go away | |
| noStroke(); | |
| // fill(255); | |
| ellipse(mouseX,mouseY,30,30); | |
| println("Click count is: " + clickcount); | |
| } //draw | |
| void mouseReleased(){ | |
| clickcount = clickcount + 1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment