Created
December 9, 2009 22:03
-
-
Save geoffa/252876 to your computer and use it in GitHub Desktop.
This file contains 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
PImage subject; | |
float baseStart; | |
float baseLength; | |
float xVector; | |
float yVector; | |
float hStart; | |
float hLength; | |
void setup() { | |
size(600, 440); | |
background(128); | |
subject = loadImage("trey.jpg"); | |
image(subject, 0, 0); | |
stroke(0, 0, 0, 75); | |
smooth(); | |
baseStart = 3; | |
baseLength = 20; | |
} | |
void draw() { | |
hStart = random(-baseStart, baseStart); | |
hLength = random(baseLength); | |
if (mousePressed == true) { | |
if (mouseX>=width/2) { | |
xVector = random(hLength); | |
} else { | |
xVector = -random(hLength); | |
} | |
if (mouseY>=height/2) { | |
yVector = random(hLength); | |
} else { | |
yVector = -random(hLength); | |
} | |
line(mouseX+hStart, mouseY+hStart, mouseX+xVector, mouseY+yVector); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment