We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › jerky animation
Page Index Toggle Pages: 1
jerky animation (Read 363 times)
jerky animation
Apr 23rd, 2008, 1:22am
 
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();
 }
}
   
 


Re: jerky animation
Reply #1 - Apr 23rd, 2008, 5:08am
 
you know, since the code is oscillating in behaviour, it's reasonable to assume that the jerkiness is due to it oscillating so quickly it looks jerky. I tried t+=0.1 and it's smooth.
Page Index Toggle Pages: 1