Re: Smooth animation
Re: Smooth animation
- Subject: Re: Smooth animation
- From: Jake Repp <email@hidden>
- Date: Thu, 12 Dec 2002 11:27:15 -0800
Great information provided already (Thanks Douglas) but I would also
like to add that an animations perception of smoothness can also depend
on how you are integrating your time delta. In OSX the rendering engine
text and image compositing are actually extremely fast.
Say your object has a basic structure of:
typedef struct RenderObject
{
float pos[2], vel[2];
};
pos[0] = 0.f; pos[1] = screenHeight/2.f;
vel[0] = 1.f; vel[1] = 0.f;
You may currently be trying to do:
// render is called from a NSTimer
- (void) render:
{
pos[0] += vel[0];
}
But you should give this a try:
// pass in the delta time as a fraction of seconds
// since the last render pass
- (void) render: (float) delta
{
pos[0] += vel[0] * delta;
}
This may help to stabilize your animation by actually integrating the
motion over time.
-jake
On Tuesday, December 10, 2002, at 10:57 AM, Arthur VIGAN wrote:
Hi,
I am working on a quite simple screen saver which print a text on the
screen and translate it in the limits os the screen. The process used
to move it is very simple: every 1/50 of a second, I redraw the text
one pixel on the left of its previous position. The problem is that
this kind of animation is choppy. What could I do to make it smoother?
I think that I need to change the method of drawing, but I don't know
what better I can do. Maybe OpenGL, but I am not very interested in
using 3D. What else?
Thanks in advance,
Arthur
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.