So I am trying to write images created with processing to a pdf to no avail.
I borrowed the script from the resources page. the last bit at the end is supposed to keep the script from writing thousands of frames but unfortunately it is writing many images. I would like to just write one pdf at a time from the image at mouse press or even better at keypress.
Any help would be greatly appreciated. Thanks in advance for any tips!
Here is the code im using and where it is placed in the script.
at top of script
int maxnum = 201;
int cnt = 0;
// minimum distance to draw connections
int mind = 333;
import processing.pdf.*;
boolean record;
at begin void draw
void draw() {
if (record) {
// Note that #### will be replaced with the frame number. Fancy!
beginRecord(PDF, "frame-####.pdf");
}
// move cities
for (int c=0;c<num;c++) {
cities[c].move();
Just discovered processing and am working with anothers script. I have no programing exp but was able to get it to work and save image on my pc. How can I save highres copy of what I see on screen? If anyone has a bit of script and the location I should place it it is greatly appreciated.
See actual script below.
void draw(){
line(20, 20, 80, 80);
// Saves a TIFF file named "diagonal.tif"
save("diagonal.tif");
// move discs
for (int c=0;c<num;c++) {
discs[c].move();
discs[c].render();
}
time++;
}
// OBJECTS
class Disc {
// index identifier
int id;
// position
float x,y;
// radius
float r;
// destination radius
float dr;
// velocity
float vx,vy;
// sand painters
int numsands = 3;
SandPainter[] sands = new SandPainter[numsands];
void render() {
// find intersecting points with all ascending discs
for (int n=id+1;n<num;n++) {
// find distance to other disc
float dx = discs[n].x-x;
float dy = discs[n].y-y;
float d = sqrt(dx*dx+dy*dy);
// intersection test
if (d<(discs[n].r+r)) {
// complete containment test
if (d>abs(discs[n].r-r)) {
// find solutions
float a = (r*r - discs[n].r*discs[n].r + d*d ) / (2*d);
float p2x = x + a*(discs[n].x - x)/d;
float p2y = y + a*(discs[n].y - y)/d;