Timing

Started by
2 comments, last by Armera 22 years, 8 months ago
Quick question on timing. I simply just want to draw a 2D quad on the screen. I want to make it slide in to the center of the screen from the right. what would i do to the 4 values of the quad to make it achieve this over a period of 2 seconds? =] Jer
It's not reverse engineering, unless you get caught.
Advertisement
well you pop open your high school physics book to find that:

v = d/t

say d = 100units or something and t=2
the v = 50u/s

well, know you need to find the change in time, deltaT, since the last frame...i''ll let you figure that one out(check the other threads concerning Frame Rate)

know if your using something like OpenGL do something like:


deltaD += v * deltaT;
glTranslatef(deltaD,0.0f,0.0f); // since you wanted to move right
DrawThePrettyQuad();
BTW, that's pretty hand-wavy. But you should be able to figure out the details.

Edited by - Parveen Kaler on July 23, 2001 5:20:34 PM
Got it thanks!
It's not reverse engineering, unless you get caught.

This topic is closed to new replies.

Advertisement