Jump to content
  • Advertisement
Sign in to follow this  
Wolfdog

Animation Ration Equation

This topic is 4579 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am doing animation based on time in seconds. Every frame I increase the number of seconds that have gone by using QueryPerformanceCounter so it is quite accurate. For animation purposes I use the amount that has gone by sense the animation started over the amount of time the animation is supposed to take. This gives me a ratio between 0.0 and 1.0 that I use to Interpolate the Animation. The problem is that it feels kindof dead or static, there is no acceleration involved. If I were to graph my current equation for doing animation it would be the time ratio on the x axis and the Animation Ratio on the y axis. Currently the graph would be y = x. A diagonal line. I think what I need is a graph that would resemble more of a porabla up until it gets near the time of 1.0 then it would slowly level out. Anyone know the equation, or even where to look to create this kind of acceleration effect. I tried a sin wave but that of course goes slowly accelerating to 1.0 or it accelerates to one then decelerates to 0.0, I need it to accelerate to the middle go fast for a short period then deaccelerate. I hope all that made sense.

Share this post


Link to post
Share on other sites
Advertisement
y = sin(x*pi/2) will give you an animation that eases in and out. There are more complicated curves you can use, but this works fine and has a simple explicit solution (unlike some of the more complicated curves, which are expressed as differential equations).

Share this post


Link to post
Share on other sites
Thanks for your reply.

The sin equation dosent excatly give me what I need. That equation eases from 0.0 to 1.0 then back to 0.0. I need one that starts slowly from 0.0 then moves to fast then slows down again as it approches 1.0.

Share this post


Link to post
Share on other sites
Quote:
That equation eases from 0.0 to 1.0 then back to 0.0.
No it doesn't. Within the domain [0,1] the function y=sin(x*pi/2) starts at 0 and ends at 1. if it goes back down to 0, you're probably forgetting the /2.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!