We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am new to processing and wanted to work with the Substrate code. When I try to insert saving functionality, it typically bounces back "Duplicate method draw() in type Substrate". I am trying to get the sketch to run, and because it iterates endlessly, save sequentially to a png image file every time X amount of frames pass. Here is what I'm trying to insert:
int x = 0;
void draw() {
background(204);
if (x < 100) {
line(x, 0, x, 100);
x = x + 1;
} else {
noLoop();
}
// Saves each frame as line-000001.png, line-000002.png, etc.
saveFrame("line-######.png");
}
Into the original code. Additionally, If its possible to make the sketch stop after x amount of frames, run again, and save the new files such as a_line-######.png, b_line-######.png, c_line-######.png, etc. so that it could left to run and save randomized sketches that would be helpful.
Reference Gif
Answers
you just need to call begin() to reinitialise the sketch from time to time.
i'd keep it simple like this (at bottom of draw()?):
so your filename will be line-xxxxyyyy.jpg where xxxx is the iteration and yyyy is the frame within the iteration, 100 to 9900. (no idea if these numbers are suitable)