Created
October 27, 2012 21:29
-
-
Save codeblooded/3966376 to your computer and use it in GitHub Desktop.
Starting with Processing.org
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
/* The follow thru web */ | |
int previousX = 0; | |
int previousY = 0; | |
boolean isDrawing = true; | |
void setup() | |
{ | |
size(300, 300); | |
background(0); | |
strokeWeight(10.0); | |
} | |
void draw() | |
{ | |
int newX = mouseX; | |
int newY = mouseY; | |
// prevent redrawing on the same line | |
if (newX != previousX && newY != previousY) | |
{ | |
stroke(random(255), random(255), random(255)); | |
line(previousX, previousY, newX, newY); | |
previousX = newX; | |
previousY = newY; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment