mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
more example moving
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import processing.pdf.*; // Import PDF code
|
||||
|
||||
boolean saveOneFrame = false;
|
||||
|
||||
void setup() {
|
||||
size(600, 600);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
if (saveOneFrame == true) { // When the saveOneFrame boolean is true,
|
||||
beginRecord(PDF, "line-####.pdf"); // start recording to the PDF
|
||||
}
|
||||
background(255);
|
||||
stroke(0, 20);
|
||||
strokeWeight(20);
|
||||
line(mouseX, 0, width - mouseY, height);
|
||||
if (saveOneFrame == true) { // If the PDF has been recording,
|
||||
endRecord(); // stop recording,
|
||||
saveOneFrame = false; // and set the boolean value to false
|
||||
}
|
||||
}
|
||||
|
||||
void mousePressed() { // When a mouse button is pressed,
|
||||
saveOneFrame = true; // trigger PDF recording within the draw()
|
||||
}
|
||||
Reference in New Issue
Block a user