Skip to content

Instantly share code, notes, and snippets.

@codeblooded
Created October 27, 2012 21:29
Show Gist options
  • Save codeblooded/3966376 to your computer and use it in GitHub Desktop.
Save codeblooded/3966376 to your computer and use it in GitHub Desktop.
Starting with Processing.org
/* 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