How should I make a loop to make/display/save all successive images?
Here is what I mean.
My program has this structure:
- setup display an initial image,
- draw does nothing at all,
- keyPressed() modifies the image (according to the key I pressed),
- mousePressed saves it when I want.
setup(){
...
}
draw() {
}
void keyPressed() {
switch (key) {
...
}
}
void mousePressed() {
save(fname);
}
Now, I would like also to be able to do all keyPressed and save automatically.
I mean instead of pressing 'a' then save, then pressing 'b' then save, etc...,
I would like to generate and save all images.
But a loop inside keyPressed won't work cause the display is only updated after draw().
I try using redraw() inside such a loop, but it doesn't seems to work.
Any suggestion?