Hi all,
I'm still new to this, so please excuse what may be a dumb question.
When I do animations, or any drawing that evolves over time, after several seconds (about 30 or so), the motion becomes extremely jerky. See my drawing below for an example - give it about 30 seconds and it's terrible on my computer (a nice fast Mac G5, running 10.4.11, Processing 0135.
I have a feeling it is related to how I'm calculating time (float t = frameCount/frameRate), but it's not obvious to me how else to calculate time.
Thanks in advance for your help,
jim
Quote:
static final int sz = 800;
static final float fr = 30f;
static final float f1 = 1f;
static final float r1 = 0.3;
static final float f2 = 11f;
static final float r2 = 0.07;
static final float f3 = 55f;
static final float r3 = 0.02;
float t;
void setup() {
size(sz, sz);
stroke(0);
smooth();
frameRate(24);
}
void draw() {
background(255);
t = frameCount/frameRate;
translate(width/2, height/2);
for (int c = 0; c <= 1000; c++) {
float cf = (float) c;
float cfrac = cf / 1000f;
pushMatrix();
rotate(cfrac*f1*TWO_PI);
translate(r1*sz, 0);
pushMatrix();
rotate(cfrac*f2*TWO_PI);
translate((1f+sin(0.8*t))*0.5*r2*sz, 0);
pushMatrix();
rotate(cfrac*f3*TWO_PI);
translate((1f+sin(0.7*t))*0.5*r3*sz, 0);
point(0,0);
popMatrix();
popMatrix();
popMatrix();
}
}