Created
September 15, 2015 16:40
-
-
Save slambert/8e3ead820543f262a337 to your computer and use it in GitHub Desktop.
offMouse
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
| /* | |
| Steve Lambert | |
| offMouse | |
| September 15, 2015 | |
| Note: where you declare your variable | |
| */ | |
| // Global Variables (usable in every loop/function we make) | |
| int offMouse = 0; //declare AND initialize the variable | |
| void setup(){ | |
| size(600,600); | |
| } | |
| void draw(){ | |
| offMouse = mouseX + 50; // calculate the change in position | |
| // when we calculated this in setup, it didn't change. We need it | |
| // to be continually recalculated as the mouse moves | |
| background(0); // black | |
| ellipse(offMouse,mouseY,20,20); | |
| println("X: " + mouseX + " | offMouse: " + offMouse + " | Y: " + mouseY); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment