Hello @eoinfen,
The draw() canvas updates at the end of draw().
You are seeing the last frame for 5 seconds and are actually saving the current frame (in progress…) when you are pressing the right mouse button.
Example:
Thread newThread;
void setup()
{
size(200, 200);
textSize(48);
textAlign(CENTER, CENTER);
text(frameCount, width/2, height/2-20);
frameRate(1/5.0);
thread("requestData");
}
void draw()
{
background(0);
text(frameCount, width/2, height/2-20);
thread("requestData");
}
void mousePressed()
{
if (mouseButton == RIGHT)
{
save(frameCount + ".PNG");
println("mousePressed frameCount: ", frameCount);
}
}
void requestData()
{
println("frameCount: ", frameCount);
}
Reference:
thread() / Reference / Processing.org
thread() runs independently of the main animation loop and is showing the actual frameCount.
:)