Take the 2-minute tour ×

In a game I have a specific object and two positions the object will move from and to. I already have the function for calculating current position in specific time.

It works like this:

Inputting 0 will move the object to Position 1.

Inputting 1 will move the object to Position 2.

Inputting 0.5 will move the object in the middle of the two positions.


(In the examples below, time is varying from 0 to 1) When I want to start the object slowly and stop it when it is moving fast, I use:

MoveObject(sin(time * 90))

When I want to start the object fast and stop it as it is getting slower, I use:

MoveObject(1 - cos(time * 90))

Without the effects, it's:


How do I make the object start moving slowly, move fast in the center of two positions and then get slower while reaching the second position?

share|improve this question
what about MoveObject(sin(time * 180))? –  Ali.S Mar 30 '13 at 19:08
This type of method would vary from 0 to 1 then again to 0 –  Laimonas Mileška Mar 30 '13 at 19:10
Here's an interesting read about easing equations: sol.gfxile.net/interpolation –  Alayric Mar 30 '13 at 19:18
That's pretty much the answer. Thanks! –  Laimonas Mileška Mar 30 '13 at 19:22
so there is tanh function, but it needs some preparations before using... maybe MoveObject((tanh(time * 180 - 90) + 1) / 2) –  Ali.S Mar 30 '13 at 20:13

1 Answer 1

You are looking for easing functions...

Here you have some desription: http://www.gizma.com/easing/#expo1

I wrote a reply about them here with my own implemntation in C#


share|improve this answer

Your Answer


