# Different types of smooth object movement

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.

etc...

(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:

MoveObject(time)


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?

• what about MoveObject(sin(time * 180))? Commented Mar 30, 2013 at 19:08
• This type of method would vary from 0 to 1 then again to 0 Commented Mar 30, 2013 at 19:10
• Here's an interesting read about easing equations: sol.gfxile.net/interpolation Commented Mar 30, 2013 at 19:18
• so there is tanh function, but it needs some preparations before using... maybe MoveObject((tanh(time * 180 - 90) + 1) / 2) Commented Mar 30, 2013 at 20:13