I'm currently using the Pointillism example with some small changes to draw an image. What I'd like to do is let the sketch run for a specified amount of time (ex. 2 mins) and then have the sketch clear and start again. This is what I currently have:
PImage img;
int top, left;
void setup() {
size(700, 700);
img = loadImage("image.jpg");
noStroke();
background(0);
smooth();
frameRate(150);
// center the image on the screen
left = (width - img.width) / 2;
top = (height - img.height) / 2;
}
void draw() {
drawImage();
}
void drawImage() {
float pointillize = random(10);
int x = int(random(img.width));
int y = int(random(img.height));
color pix = img.get(x, y);
fill(pix, 100);
rect(left + x, top + y, pointillize, pointillize);
}
Any suggestions or points towards the right direction would be greatly appreciated! Thanks