hi there -
i have been through the examples of exporting svgs from processing, at this url:
https://processing.org/reference/libraries/svg/index.html
i am looking for a solution that falls between these examples, though.
i’d like to use the space bar to generate a new image, display it on the screen, and export it as a file. attached below is the code that i tried to put together. it seems to be allowing new iterations of the image, but it does not seem to update the display. any help would be appreciated. thank you.
import processing.svg.*;
int horiz = 17;
int vert = 11;
void setup() {
size(400, 400);
background(100, 100, 10);
noLoop();
drawShapes();
}
void drawShapes() {
beginRecord(SVG, "filename.svg");
for (int x=0; x<horiz; x++){
pushMatrix();
translate(x*40, 0);
for (int y=0; y<vert; y++){
pushMatrix();
translate(0, y*40);
fill(color(10, 90, 10));
circle(0, random(90), random(20));
popMatrix();
};
popMatrix();
};
endRecord();
}
void keyReleased() {
if (key == 32) {
size(400, 400);
noLoop();
background(random(100), random(100), random(100));
drawShapes();
}
}