extra low framerates in Processing
when you want to write a processing sketch, that doesn't redraw several times a second, but updates the main method only once in a while (for example once per hour or minute) the following code can be used to start a thread that triggers a redraw after a delay. Just make sure the setup method calls the noLoop() methode and than start the thread calling start( millisecondsToWait );
void setup() {
size(300,300);
smooth();
noLoop(); // <- turn off the processing loop
start( 20 * 1000 ); // <- start the thread
}
void draw() {
background( 255 );
// draw some random circles
for ( int i =0; i< 10; i++) {
color c = color(random( 255 ));
fill( c );
stroke( c );
int radius = int(random( 100 )+ 40);
ellipse( random( width ), random( height ), radius, radius );
}
}
void start( final int mil ) { //<- mil has to be final to be accessible in run()
new Thread() {
public void run() {
while( true ) {
delay( mil );
redraw();
}
}
}.start();
}
See also:
sketch experiment 7 - osc events
nested cubes in processing
processing phaseflower
Time Perception
de jong attractor
nested cubes in processing
processing phaseflower
Time Perception
de jong attractor