Hello all.
I am trying to solove this problem almost 1.5 day… but not solved yet…
If there is someone who has any knowledges, please share the solution.
Problem
Recording into PDF always stops at specific frame count.
DrawLoop animation on window stops as well.
The specific frame count depends on numbers of ball objects.
What I want to do
I want to export many frames into one file with screen display.
At least, I want to export 10,000 ~ 20,000 frames into one file.
This PDF is for printing A1 size poster.
What I want to draw
I want to fill window with bunch of color balls using with ArrayList objects.
ArrayList objects are initialize each 1,000 frame,
then balls start to fill window over again from initialized random positions.
What I did for solving ( but not solved yet)
(1) Changing memory setting from IDE preference.
(2) Clearing ArrayList per 1000frame.
(3) Testing both enviroment / iMac(2012/27icn with 32G memory) and Window10(Dell XPS15 with 32G memory)
(4) Changing number of balls ( 750 / 1,500 / 3,000 )
For instance, numbers are like below. Specific number of balls are stopped drawing and exporting at specific frame count.
・750 balls are stopped at about 6,000 frame.
・1500 balls are stopped at about 3,000 frame.
・3000 balls are stopped at about 1,500 frame.
(5) Comented out the lines which relate PDF recording.
In this case, while I coment out the lines which relate PDF, recording is not never stopped! but It can’t acheve recording PDF…
My code
Here is my code which modified simpler and used for test.
import processing.pdf.*;
ArrayList<Ball> balls = new ArrayList<Ball>();
int ballNum = 750;
boolean record;
//-----------------------------------------------
void setup(){
size(500,500);
frameRate(120);
beginRecord(PDF, "../export/test.pdf");
for(int i = 0; i<ballNum; i++){
balls.add(new Ball());
}
}
//-----------------------------------------------
void draw(){
for( Ball b : balls ){
b.show();
b.move();
}
if(frameCount%1000 == 0) {
balls.clear();
for(int i = 0; i<ballNum; i++){
balls.add(new Ball());
}
}
println("frameCount /", frameCount);
}
class Ball {
PVector pos, vel;
float r;
Ball(){
pos = new PVector(random(width), random(height));
vel = new PVector(random(-2,2), random(-2,2));
r = random(5, 10);
}
void show(){
noStroke();
fill(random(255), random(255), random(255), random(255));
circle(pos.x, pos.y, r);
}
void move(){
pos.x += vel.x;
pos.y += vel.y;
}
}
void keyPressed(){
if (key =='p' || key =='P') record = true;
}
Thanks a lot for reading and your time.