Skip to content

Instantly share code, notes, and snippets.

@Chovanec
Created October 2, 2013 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chovanec/6799170 to your computer and use it in GitHub Desktop.
Save Chovanec/6799170 to your computer and use it in GitHub Desktop.
easeOutElastic easing function
// t: current time, b: begInnIng value, c: change In value, d: duration
function ani ($t, $b, $c, $d)
{
$s = 1.70158;
$p = 0;
$a = $c;
if ($t == 0) return $b;
if (($t /= $d) == 1) return $b + $c;
if (!$p) $p = $d * .3;
if ($a < abs($c))
{
$a = $c;
$s = $p / 4;
}
else $s = $p / (2 * pi()) * asin ($c / $a);
return $a * pow(2, -10 * $t) * sin(($t * $d - $s) * (2 * pi()) / $p ) + $c + $b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment