Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
Add Comment
Please, Sign In to add comment