This is a selection of easing functions to make the movement of objects more pleasing to the eye.
Simple call the function (I have included separate functions to save space) and pass four variables:
t = how far through the current movement you are
d = the total duration of the movement
b = where the movement starts
c = the final change in value at the end.
For example, if you want an object to move from y = 20 to y = 100 in 30 update loops you would set:
t = the count, starting at 0 and ending at 30
d = 30
b = 20
c = 80
You can get some great effects and it really helps make movement that little bit more realistic.
Have fun and let me know if it's useful!
[Please log in to post a comment]