Framerate based on mouse position?
in
Programming Questions
•
2 years ago
I am trying to create a program that will pointillize an image. From what I am seeing, it seems as though that the refresh rate isn't constant, rather, it only jumps to the 40,000 or so frames when my mouse is hovering over the sketch?
I'd rather have this program completely automated, so that the mouse doesn't have any affect and it will constantly run at the highest frame rate possible.
I'd rather have this program completely automated, so that the mouse doesn't have any affect and it will constantly run at the highest frame rate possible.
- PImage img;
int smallPoint = 2;
int largePoint = 18;
int top, left;
void setup() {
size(728, 1181);
img = loadImage("paradetl.jpg");
int x = int(random(img.width));
int y = int(random(img.height));
color pix = img.get(x, y);
background(pix);
noStroke();
smooth();
largePoint = min(width, height) / 10;
left = (width - img.width) / 2;
top = (height - img.height) / 2;
}
void draw() {
frameRate(40000);
float a = random(1, 80);
float transparency = random(0, 255);
float pointillize = map(a, 0, width, smallPoint, largePoint);
int x = int(random(img.width));
int y = int(random(img.height));
color pix = img.get(x, y);
fill(pix, transparency);
ellipse(left + x, top + y, pointillize, pointillize);
println(frameCount);
}
1