PImage pic; int px; int py; boolean run; boolean mouseDown; void setup() { size(600,400); frameRate(90); colorMode(HSB,255); background(0,0,0); smooth(); //amelie.jpg, cac.jpg, food.jpg, night.jpg, lime.jpg, toronto.jpg,vaneyck.jpg pic = loadImage("src/cac.jpg"); //image(pic,0,0); noFill(); run = true; mouseDown = false; px = round(width/2); py = round(height/2); } void draw() { //turn on of off if (mousePressed) { if (mouseDown == false) { mouseDown = true; if (run == false) { px = mouseX; py = mouseY; } run = !run; } }else{ mouseDown = false; } //draw image if (run == true) { makeImage(); } //save image if (keyPressed) { if (key == 'S' || key == 's') { String time = "savedImages/savedimage-"+month()+day()+year()+"_"+hour()+minute()+second()+"_"+millis()+".png"; //save(time); } } } void makeImage() { int range = 30; int x = px + round(random(range*-1,range)); int y = py + round(random(range*-1,range)); if (x > width) { x = width-(x-width); }else if (x < 0) { x = (range-x); } if (y > height) { y = height-(y-height); }else if (y < 0) { y = (range-y); } color c = pic.get(x,y); color cp = pic.get(px,py); float diff = abs( hue(c) - hue(cp) ); //diff between 1 - 255; stroke(c,150); strokeWeight(1); line(px,py,x,y); stroke(c,100); strokeWeight(1 + (diff/40)); ellipse(x,y,.5+diff/4,.5+diff/4); px = x; py = y; }