We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey I am trying to make a program that uses some vectors and I am having troubles using the ellipseMode(RADIUS) with the PDF library it seems to change the draw function back to ellipseMode(CENTER). Or at least it appears to be doing that, any information would be helpful.
import processing.pdf.*;
boolean record;
void setup() {
size(500, 500);
noSmooth();
noFill();
ellipseMode(RADIUS); // I believe this is where my problem is(?)
}void draw() {
if (record) {
beginRecord(PDF, "NotTheSameImage.pdf");
}arc(200, 200, 50, 50, 0, 40 * (TAU/64));
arc(200, 200, 20, 20, 40 * (TAU/64), TAU);
rect(10, 10, 400, 400);
ray(200,200,3 * TAU/4,50);
if (record) {
endRecord();
record = false;
}
}void keyPressed() {
// Use a key press so that it doesn't make a million files
if (key == 'r') {
record = true;
}
}void ray(float x, float y, float rad, float dist) {
float xx = x + (dist * cos(rad));
float yy = y + (dist * sin(rad));
line(x, y, xx, yy);
}
P.S. I need to re-read the section on posting code sorry about the lack of indentions.
Answers
Place all your styles in a separate function, and call that just after beginRecord().
An old example about that approach:
https://forum.Processing.org/two/discussion/4275/how-to-compile-a-series-of-functions-into-one-variable#Item_4