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 › animation: breaking flow ..
Page Index Toggle Pages: 1
animation: breaking flow .. (Read 820 times)
animation: breaking flow ..
Feb 22nd, 2008, 2:25am
 
Hello..

   I'm new with Processing, and i have the following problem.When i try to display an animation, the moving object lacks of smooth continuity..
   I tried various frameRate values, but the same thing happens..the continuity breaks.I also checked my ati graphics card but i can't find something that solves the problem..
   Should i make a setting on Proseccing or there is a problem in my graphics card? What can i do to have smooth animation with fine motion flow?
   
Thanks for your attention.


animation: breaking flow ..
Reply #1 - Feb 22nd, 2008, 6:02am
 
i think that my problem is animation flickering...
The motion isnt steady, and the image flickers..
Please help!!
Re: animation: breaking flow ..
Reply #2 - Feb 22nd, 2008, 5:00pm
 
do you have the same problem with all animations? can you give us an example - some code or whatever?
Re: animation: breaking flow ..
Reply #3 - Feb 22nd, 2008, 5:58pm
 
Quote:


int xpos = width/2;
int ypos = height/2;
int ballWth ;
int ballHgt ;
int xspeed ;
int yspeed ;

void setup(){
 size(800, 800);
 background(123);
 noStroke();
 frameRate(25);
 smooth();
 xspeed = 18;
 yspeed = 18;
 ballWth = 80;
 ballHgt = 80;
}
void draw(){
 background(123);
 ellipse(xpos, ypos, ballWth, ballHgt);
 
 
 
 xpos += xspeed;
 ypos += yspeed;
 if (xpos >= width  || xpos <=0){
     xspeed *= -1;
 }
 if (ypos >= height || ypos <= 0){
   yspeed *=-1;
 
}
}







this is my very simple animation code...
i can see the problem of non smooth movement in all renderers.. the ball in this code flickers a bit when moves and you can clearly see jumps on the movement..

i had the same problem in vvvv and flash, but in flash its better with bigger frameRate..For this reason i checked my graphics card and i also benchmarked, but i cant see any problem in my card!!

Please help, i like processing very much but its very annoying this problem!!
Re: animation: breaking flow ..
Reply #4 - Feb 22nd, 2008, 7:12pm
 
well, you're ball is jumping a distance of about 25pixels. Obviously you'll perceive that as "flickering". try a higher framerate and way smaller speeds. changing your speed / pos variables to float might be necessary. Also, opengl animates much smoother than the 2D renderer in my experience.

Quote:


import processing.opengl.*;

float xpos;
float ypos;
int ballWth ;
int ballHgt ;
float xspeed ;
float yspeed ;

void setup(){
 size(800, 800, OPENGL);
 background(123);
 noStroke();
 frameRate(100);
 smooth();
 xpos = width/2.0;
 ypos = height/2.0;
 xspeed = .3+random(2.5);
 yspeed = .3+random(2.5);
 ballWth = 80;
 ballHgt = 80;
}

void draw(){
 background(123);
 ellipse(xpos, ypos, ballWth, ballHgt);
 xpos += xspeed;
 ypos += yspeed;  
 if (xpos >= width  || xpos <=0){
   xspeed *= -1;
 }
 
 if (ypos >= height || ypos <= 0){
   yspeed *=-1;
 }
}

Page Index Toggle Pages: 1