January 27, 2003
Elastic Tween
I use Robert Penners Tweening Equations in almost all of my projects. So I'm happily surprised that this tread on Flashcoders drove Robert into another great addition to this library. This one creates an elastic bounce tween:
Math.elasticTween = function (t, b, c, d, a, p) {
a = ((c>0 && a
if (p == undefined) p = d / 2;
return ((t==d) ? 0 : -a * (-Math.pow(2, -10 * t/d) + 1) + a) *
Math.sin ((t - p/(2*Math.PI) * Math.asin (c/a)) *
(2*Math.PI) / p) + b + c;
};
If you have no idea what I'm talking about you can check out Fluid's Tween Playground where you are able to try out all the various tweens (except for the new one).
Posted at January 27, 2003 11:08 PM | Further reading
