# 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.

## 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 on other sites
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 on other sites

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 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 on other sites
Your absolutly right, thank you. That solved my problem.

1. 1
Rutin
41
2. 2
3. 3
4. 4
5. 5

• 10
• 27
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633402
• Total Posts
3011670
• ### Who's Online (See full list)

There are no registered users currently online

×