A way to "ease in/ease out" movements?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
weeix
Posts: 23
Joined: Fri Jul 09, 2010 5:07 am

A way to "ease in/ease out" movements?

Post by weeix »

Hello,
I wonder if there is a way to "ease in/ease out" movements like Adobe After Effects?

If you never used Aftere Effects please take a look the illustrate in this document: http://jjgifford.com/expressions/basics ... ation.html

I'm trying to create a function which can move a node to any specific position. I'd be great if I can make it moves smoothly.

Thanks, V.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Sin function would work nicely for this.

Try something like:

Code: Select all

currentSpeed = fullSpeed * Sin(journeyRatio * (PI / 2));
Where fullSpeed is the speed you want it to travel at the middle of the journey and journeyRatio is a value from 0 to 1 that says how far along it is (DistanceTravelled / TotalDistance).

Hope that works! (Didn't test :P )

EDIT: Oops just realised you should do:

Code: Select all

currentSpeed = initialSpeed + fullSpeed * Sin(journeyRatio * (PI / 2));
Where initialSpeed is a slow speed it will travel at the start and end, otherwise it won't move at all at the start and the speed will stay a constant 0!
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
weeix
Posts: 23
Joined: Fri Jul 09, 2010 5:07 am

Post by weeix »

I never think of using sin function.

Thanks! :D
Post Reply