Jump to content

  • Log In with Google      Sign In   
  • Create Account





- - - - -

Easing along, one step at a time

Posted by , in Code snippets 02 March 2013 · 2,362 views

interpolation easing tweening


BounceEase was annoying me alot. I was trying to figure out how it worked, but I'm not very good with math and algorithm-thinking.

The original code looked like this:
http://ideone.com/14kyLm

And trying to figure out all the magic numbers, I eventually broke it down to this:
http://ideone.com/wGCTU9

I never figured out how the '7.5625f' value was calculated, but the others are resolved. http://public.gamedev5.net//public/style_emoticons/default/laugh.png

Unfortunately, changing the value of 'bounciness' or 'bounces' produces poor results (probably from the constant!), so I didn't bother including the code with the rest of the equations.
http://img811.imageshack.us/img811/9171/custombounceeaseeasein.png


Links that were useful in understanding and converting the equations:
http://www.robertpenner.com/easing/ (The guy who made most of these now-common equations)

http://sol.gfxile.net/interpolation/index.html (also has good descriptions and explanations)
http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html
http://msdn.microsoft.com/en-us/library/ee308751.aspx

Some nice graphs:
http://easings.net/










I prefer to make the the whole thing template based - so I can interpolate floats, ints, doubles, vectors as well as quaternions (anything that has the + and  * operator overloaded :D And yeah, interpolators are awesome :) here's my code : http://ideone.com/RTEmf5

Good idea about the templates! I think I'll leave that for some future, though.

Recent Entries

Recent Comments

Latest Visitors

PARTNERS