Files
processing4/java/examples/Library/PDF Export/MousePress/MousePress.pde
benfry eb64b2d4fc
2011-01-26 19:22:19 +00:00

38 lines
549 B
Plaintext

/**
* Mouse Press.
*
* Saves one PDF of the contents of the display window
* each time the mouse is pressed.
*/
import processing.pdf.*;
boolean saveOneFrame = false;
void setup() {
size(600, 600);
frameRate(24);
}
void draw() {
if(saveOneFrame == true) {
beginRecord(PDF, "Line.pdf");
}
background(255);
stroke(0, 20);
strokeWeight(20.0);
line(mouseX, 0, width-mouseY, height);
if(saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}
void mousePressed() {
saveOneFrame = true;
}