Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

273 wiersze
4.6 KiB

  1. jQuery.easing['jswing'] = jQuery.easing['swing'];
  2. jQuery.extend( jQuery.easing,
  3. {
  4. def: 'easeOutQuad',
  5. swing: function (x, t, b, c, d) {
  6. //alert(jQuery.easing.default);
  7. return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
  8. },
  9. easeInQuad: function (x, t, b, c, d) {
  10. return c*(t/=d)*t + b;
  11. },
  12. easeOutQuad: function (x, t, b, c, d) {
  13. return -c *(t/=d)*(t-2) + b;
  14. },
  15. easeInOutQuad: function (x, t, b, c, d) {
  16. if ((t/=d/2) < 1) return c/2*t*t + b;
  17. return -c/2 * ((--t)*(t-2) - 1) + b;
  18. },
  19. easeInCubic: function (x, t, b, c, d) {
  20. return c*(t/=d)*t*t + b;
  21. },
  22. easeOutCubic: function (x, t, b, c, d) {
  23. return c*((t=t/d-1)*t*t + 1) + b;
  24. },
  25. easeInOutCubic: function (x, t, b, c, d) {
  26. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  27. return c/2*((t-=2)*t*t + 2) + b;
  28. },
  29. easeInQuart: function (x, t, b, c, d) {
  30. return c*(t/=d)*t*t*t + b;
  31. },
  32. easeOutQuart: function (x, t, b, c, d) {
  33. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  34. },
  35. easeInOutQuart: function (x, t, b, c, d) {
  36. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  37. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  38. },
  39. easeInQuint: function (x, t, b, c, d) {
  40. return c*(t/=d)*t*t*t*t + b;
  41. },
  42. easeOutQuint: function (x, t, b, c, d) {
  43. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  44. },
  45. easeInOutQuint: function (x, t, b, c, d) {
  46. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  47. return c/2*((t-=2)*t*t*t*t + 2) + b;
  48. },
  49. easeInSine: function (x, t, b, c, d) {
  50. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  51. },
  52. easeOutSine: function (x, t, b, c, d) {
  53. return c * Math.sin(t/d * (Math.PI/2)) + b;
  54. },
  55. easeInOutSine: function (x, t, b, c, d) {
  56. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  57. },
  58. easeInExpo: function (x, t, b, c, d) {
  59. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  60. },
  61. easeOutExpo: function (x, t, b, c, d) {
  62. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  63. },
  64. easeInOutExpo: function (x, t, b, c, d) {
  65. if (t==0) return b;
  66. if (t==d) return b+c;
  67. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  68. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  69. },
  70. easeInCirc: function (x, t, b, c, d) {
  71. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  72. },
  73. easeOutCirc: function (x, t, b, c, d) {
  74. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  75. },
  76. easeInOutCirc: function (x, t, b, c, d) {
  77. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  78. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  79. },
  80. easeInElastic: function (x, t, b, c, d) {
  81. var s=1.70158;var p=0;var a=c;
  82. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  83. if (a < Math.abs(c)) { a=c; var s=p/4; }
  84. else var s = p/(2*Math.PI) * Math.asin (c/a);
  85. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  86. },
  87. easeOutElastic: 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) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  93. },
  94. easeInOutElastic: 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/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  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. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  100. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  101. },
  102. easeInBack: function (x, t, b, c, d, s) {
  103. if (s == undefined) s = 1.70158;
  104. return c*(t/=d)*t*((s+1)*t - s) + b;
  105. },
  106. easeOutBack: function (x, t, b, c, d, s) {
  107. if (s == undefined) s = 1.70158;
  108. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  109. },
  110. easeInOutBack: function (x, t, b, c, d, s) {
  111. if (s == undefined) s = 1.70158;
  112. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  113. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  114. },
  115. easeInBounce: function (x, t, b, c, d) {
  116. return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  117. },
  118. easeOutBounce: function (x, t, b, c, d) {
  119. if ((t/=d) < (1/2.75)) {
  120. return c*(7.5625*t*t) + b;
  121. } else if (t < (2/2.75)) {
  122. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  123. } else if (t < (2.5/2.75)) {
  124. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  125. } else {
  126. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  127. }
  128. },
  129. easeInOutBounce: function (x, t, b, c, d) {
  130. if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  131. return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  132. }
  133. });