home *** CD-ROM | disk | FTP | other *** search
/ PC Active 2009 March / PCA223.ISO / Software / tuneup / TU2008TrialNL.exe / ie_jquery.easing.js18 < prev    next >
Encoding:
Text File  |  2008-05-27  |  4.8 KB  |  140 lines

  1. /*
  2.  * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
  3.  *
  4.  * Uses the built In easIng capabilities added In jQuery 1.1
  5.  * to offer multiple easIng options
  6.  *
  7.  * Copyright (c) 2007 George Smith
  8.  * Licensed under the MIT License:
  9.  *   http://www.opensource.org/licenses/mit-license.php
  10.  */
  11.  
  12. // t: current time, b: begInnIng value, c: change In value, d: duration
  13.  
  14. jQuery.extend( jQuery.easing,
  15. {
  16.     easeInQuad: function (x, t, b, c, d) {
  17.         return c*(t/=d)*t + b;
  18.     },
  19.     easeOutQuad: function (x, t, b, c, d) {
  20.         return -c *(t/=d)*(t-2) + b;
  21.     },
  22.     easeInOutQuad: function (x, t, b, c, d) {
  23.         if ((t/=d/2) < 1) return c/2*t*t + b;
  24.         return -c/2 * ((--t)*(t-2) - 1) + b;
  25.     },
  26.     easeInCubic: function (x, t, b, c, d) {
  27.         return c*(t/=d)*t*t + b;
  28.     },
  29.     easeOutCubic: function (x, t, b, c, d) {
  30.         return c*((t=t/d-1)*t*t + 1) + b;
  31.     },
  32.     easeInOutCubic: function (x, t, b, c, d) {
  33.         if ((t/=d/2) < 1) return c/2*t*t*t + b;
  34.         return c/2*((t-=2)*t*t + 2) + b;
  35.     },
  36.     easeInQuart: function (x, t, b, c, d) {
  37.         return c*(t/=d)*t*t*t + b;
  38.     },
  39.     easeOutQuart: function (x, t, b, c, d) {
  40.         return -c * ((t=t/d-1)*t*t*t - 1) + b;
  41.     },
  42.     easeInOutQuart: function (x, t, b, c, d) {
  43.         if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  44.         return -c/2 * ((t-=2)*t*t*t - 2) + b;
  45.     },
  46.     easeInQuint: function (x, t, b, c, d) {
  47.         return c*(t/=d)*t*t*t*t + b;
  48.     },
  49.     easeOutQuint: function (x, t, b, c, d) {
  50.         return c*((t=t/d-1)*t*t*t*t + 1) + b;
  51.     },
  52.     easeInOutQuint: function (x, t, b, c, d) {
  53.         if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  54.         return c/2*((t-=2)*t*t*t*t + 2) + b;
  55.     },
  56.     easeInSine: function (x, t, b, c, d) {
  57.         return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  58.     },
  59.     easeOutSine: function (x, t, b, c, d) {
  60.         return c * Math.sin(t/d * (Math.PI/2)) + b;
  61.     },
  62.     easeInOutSine: function (x, t, b, c, d) {
  63.         return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  64.     },
  65.     easeInExpo: function (x, t, b, c, d) {
  66.         return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  67.     },
  68.     easeOutExpo: function (x, t, b, c, d) {
  69.         return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  70.     },
  71.     easeInOutExpo: function (x, t, b, c, d) {
  72.         if (t==0) return b;
  73.         if (t==d) return b+c;
  74.         if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  75.         return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  76.     },
  77.     easeInCirc: function (x, t, b, c, d) {
  78.         return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  79.     },
  80.     easeOutCirc: function (x, t, b, c, d) {
  81.         return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  82.     },
  83.     easeInOutCirc: function (x, t, b, c, d) {
  84.         if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  85.         return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  86.     },
  87.     easeInElastic: function (x, t, b, c, d) {
  88.         var s=1.70158;var p=0;var a=c;
  89.         if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
  90.         if (a < Math.abs(c)) { a=c; var s=p/4; }
  91.         else var s = p/(2*Math.PI) * Math.asin (c/a);
  92.         return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  93.     },
  94.     easeOutElastic: function (x, t, b, c, d) {
  95.         var s=1.70158;var p=0;var a=c;
  96.         if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
  97.         if (a < Math.abs(c)) { a=c; var s=p/4; }
  98.         else var s = p/(2*Math.PI) * Math.asin (c/a);
  99.         return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  100.     },
  101.     easeInOutElastic: function (x, t, b, c, d) {
  102.         var s=1.70158;var p=0;var a=c;
  103.         if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
  104.         if (a < Math.abs(c)) { a=c; var s=p/4; }
  105.         else var s = p/(2*Math.PI) * Math.asin (c/a);
  106.         if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  107.         return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  108.     },
  109.     easeInBack: function (x, t, b, c, d, s) {
  110.         if (s == undefined) s = 1.70158;
  111.         return c*(t/=d)*t*((s+1)*t - s) + b;
  112.     },
  113.     easeOutBack: function (x, t, b, c, d, s) {
  114.         if (s == undefined) s = 1.70158;
  115.         return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  116.     },
  117.     easeInOutBack: function (x, t, b, c, d, s) {
  118.         if (s == undefined) s = 1.70158; 
  119.         if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  120.         return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  121.     },
  122.     easeInBounce: function (x, t, b, c, d) {
  123.         return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  124.     },
  125.     easeOutBounce: function (x, t, b, c, d) {
  126.         if ((t/=d) < (1/2.75)) {
  127.             return c*(7.5625*t*t) + b;
  128.         } else if (t < (2/2.75)) {
  129.             return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  130.         } else if (t < (2.5/2.75)) {
  131.             return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  132.         } else {
  133.             return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  134.         }
  135.     },
  136.     easeInOutBounce: function (x, t, b, c, d) {
  137.         if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  138.         return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  139.     }
  140. });