Thanks so much! Appreciate it.
Depending on what you want to do @glv’s method can be better I think.
The issue with mine is that you need to store the position of all the points. I limited the number of points created with the minDist
variable but still, if you run it long enough, you might have a really long array of point and it might start running slow over time. It will depend on the hardware and the use case.
Okay. I’ll play with both codes for a bit to find out which one fits my use.
Hello,
I added this to draw to display number of points and frameRate every 10 frames:
if (frameCount%10 == 0)
surface.setTitle(str(pts.size()) + " " + str(frameRate));
It does indeed slow down after a while; I noticed dropping after 600 points here.
:)
I tried for fun: lost 1 FPS after 3500 points.
ah i see you treat lines like image and change transparancy with tint()
this my code:
PGraphics pg;
void setup()
{
size(640, 480);
pg = createGraphics(width, height);
textSize(130);
textAlign(CENTER, CENTER);
}
void draw()
{
background(200);
text("TOP", width/2, height/3);
pg.beginDraw();
pg.line(pmouseX, pmouseY, mouseX, mouseY);
pg.strokeWeight(5);
pg.stroke(255,0,255);
pg.endDraw();
tint(255, 0, 255, 50);
image(pg, 0, 0);
text("BOT", width/2, 2*height/3);
}