Skip to content

Instantly share code, notes, and snippets.

@kgn
Created January 6, 2011 07:24
Show Gist options
  • Save kgn/767648 to your computer and use it in GitHub Desktop.
Save kgn/767648 to your computer and use it in GitHub Desktop.
jQuery elasout easing function that is condensed but passes JSLint
//borrowed from jQuery easing plugin
//http://gsgd.co.uk/sandbox/jquery.easing.php
$.easing.elasout = function(x, t, b, c, d){
var s=1.70158, p=0, a=c;
if(t===0){return b;}
if((t/=d)===1){return b+c;}
if(!p){p=d*0.3;}
if(a < Math.abs(c)){a=c; s=p/4;}else{s = p/(2*Math.PI) * Math.asin(c/a);}
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment