effects.core.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. /*
  2. * jQuery UI Effects 1.7.2
  3. *
  4. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6. * and GPL (GPL-LICENSE.txt) licenses.
  7. *
  8. * http://docs.jquery.com/UI/Effects/
  9. */
  10. ;jQuery.effects || (function($) {
  11. $.effects = {
  12. version: "1.7.2",
  13. // Saves a set of properties in a data storage
  14. save: function(element, set) {
  15. for(var i=0; i < set.length; i++) {
  16. if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
  17. }
  18. },
  19. // Restores a set of previously saved properties from a data storage
  20. restore: function(element, set) {
  21. for(var i=0; i < set.length; i++) {
  22. if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
  23. }
  24. },
  25. setMode: function(el, mode) {
  26. if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
  27. return mode;
  28. },
  29. getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
  30. // this should be a little more flexible in the future to handle a string & hash
  31. var y, x;
  32. switch (origin[0]) {
  33. case 'top': y = 0; break;
  34. case 'middle': y = 0.5; break;
  35. case 'bottom': y = 1; break;
  36. default: y = origin[0] / original.height;
  37. };
  38. switch (origin[1]) {
  39. case 'left': x = 0; break;
  40. case 'center': x = 0.5; break;
  41. case 'right': x = 1; break;
  42. default: x = origin[1] / original.width;
  43. };
  44. return {x: x, y: y};
  45. },
  46. // Wraps the element around a wrapper that copies position properties
  47. createWrapper: function(element) {
  48. //if the element is already wrapped, return it
  49. if (element.parent().is('.ui-effects-wrapper'))
  50. return element.parent();
  51. //Cache width,height and float properties of the element, and create a wrapper around it
  52. var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') };
  53. element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
  54. var wrapper = element.parent();
  55. //Transfer the positioning of the element to the wrapper
  56. if (element.css('position') == 'static') {
  57. wrapper.css({ position: 'relative' });
  58. element.css({ position: 'relative'} );
  59. } else {
  60. var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto';
  61. var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto';
  62. wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show();
  63. element.css({position: 'relative', top: 0, left: 0 });
  64. }
  65. wrapper.css(props);
  66. return wrapper;
  67. },
  68. removeWrapper: function(element) {
  69. if (element.parent().is('.ui-effects-wrapper'))
  70. return element.parent().replaceWith(element);
  71. return element;
  72. },
  73. setTransition: function(element, list, factor, value) {
  74. value = value || {};
  75. $.each(list, function(i, x){
  76. unit = element.cssUnit(x);
  77. if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
  78. });
  79. return value;
  80. },
  81. //Base function to animate from one class to another in a seamless transition
  82. animateClass: function(value, duration, easing, callback) {
  83. var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
  84. var ea = (typeof easing == "string" ? easing : null);
  85. return this.each(function() {
  86. var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
  87. if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
  88. if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
  89. //Let's get a style offset
  90. var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
  91. if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
  92. var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
  93. if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
  94. // The main function to form the object for animation
  95. for(var n in newStyle) {
  96. if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
  97. && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
  98. && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
  99. && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
  100. && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
  101. ) offset[n] = newStyle[n];
  102. }
  103. that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
  104. // Change style attribute back to original. For stupid IE, we need to clear the damn object.
  105. if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
  106. if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
  107. if(cb) cb.apply(this, arguments);
  108. });
  109. });
  110. }
  111. };
  112. function _normalizeArguments(a, m) {
  113. var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m;
  114. var speed = a[1] && a[1].constructor != Object ? a[1] : (o.duration ? o.duration : a[2]); //either comes from options.duration or the secon/third argument
  115. speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
  116. var callback = o.callback || ( $.isFunction(a[1]) && a[1] ) || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] );
  117. return [a[0], o, speed, callback];
  118. }
  119. //Extend the methods of jQuery
  120. $.fn.extend({
  121. //Save old methods
  122. _show: $.fn.show,
  123. _hide: $.fn.hide,
  124. __toggle: $.fn.toggle,
  125. _addClass: $.fn.addClass,
  126. _removeClass: $.fn.removeClass,
  127. _toggleClass: $.fn.toggleClass,
  128. // New effect methods
  129. effect: function(fx, options, speed, callback) {
  130. return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null;
  131. },
  132. show: function() {
  133. if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
  134. return this._show.apply(this, arguments);
  135. else {
  136. return this.effect.apply(this, _normalizeArguments(arguments, 'show'));
  137. }
  138. },
  139. hide: function() {
  140. if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
  141. return this._hide.apply(this, arguments);
  142. else {
  143. return this.effect.apply(this, _normalizeArguments(arguments, 'hide'));
  144. }
  145. },
  146. toggle: function(){
  147. if(!arguments[0] ||
  148. (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) ||
  149. ($.isFunction(arguments[0]) || typeof arguments[0] == 'boolean')) {
  150. return this.__toggle.apply(this, arguments);
  151. } else {
  152. return this.effect.apply(this, _normalizeArguments(arguments, 'toggle'));
  153. }
  154. },
  155. addClass: function(classNames, speed, easing, callback) {
  156. return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
  157. },
  158. removeClass: function(classNames,speed,easing,callback) {
  159. return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
  160. },
  161. toggleClass: function(classNames,speed,easing,callback) {
  162. return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
  163. },
  164. morph: function(remove,add,speed,easing,callback) {
  165. return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
  166. },
  167. switchClass: function() {
  168. return this.morph.apply(this, arguments);
  169. },
  170. // helper functions
  171. cssUnit: function(key) {
  172. var style = this.css(key), val = [];
  173. $.each( ['em','px','%','pt'], function(i, unit){
  174. if(style.indexOf(unit) > 0)
  175. val = [parseFloat(style), unit];
  176. });
  177. return val;
  178. }
  179. });
  180. /*
  181. * jQuery Color Animations
  182. * Copyright 2007 John Resig
  183. * Released under the MIT and GPL licenses.
  184. */
  185. // We override the animation for all of these color styles
  186. $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
  187. $.fx.step[attr] = function(fx) {
  188. if ( fx.state == 0 ) {
  189. fx.start = getColor( fx.elem, attr );
  190. fx.end = getRGB( fx.end );
  191. }
  192. fx.elem.style[attr] = "rgb(" + [
  193. Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0),
  194. Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
  195. Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0)
  196. ].join(",") + ")";
  197. };
  198. });
  199. // Color Conversion functions from highlightFade
  200. // By Blair Mitchelmore
  201. // http://jquery.offput.ca/highlightFade/
  202. // Parse strings looking for color tuples [255,255,255]
  203. function getRGB(color) {
  204. var result;
  205. // Check if we're already dealing with an array of colors
  206. if ( color && color.constructor == Array && color.length == 3 )
  207. return color;
  208. // Look for rgb(num,num,num)
  209. if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
  210. return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
  211. // Look for rgb(num%,num%,num%)
  212. if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
  213. return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
  214. // Look for #a0b1c2
  215. if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
  216. return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
  217. // Look for #fff
  218. if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
  219. return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
  220. // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
  221. if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
  222. return colors['transparent'];
  223. // Otherwise, we're most likely dealing with a named color
  224. return colors[$.trim(color).toLowerCase()];
  225. }
  226. function getColor(elem, attr) {
  227. var color;
  228. do {
  229. color = $.curCSS(elem, attr);
  230. // Keep going until we find an element that has color, or we hit the body
  231. if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
  232. break;
  233. attr = "backgroundColor";
  234. } while ( elem = elem.parentNode );
  235. return getRGB(color);
  236. };
  237. // Some named colors to work with
  238. // From Interface by Stefan Petre
  239. // http://interface.eyecon.ro/
  240. var colors = {
  241. aqua:[0,255,255],
  242. azure:[240,255,255],
  243. beige:[245,245,220],
  244. black:[0,0,0],
  245. blue:[0,0,255],
  246. brown:[165,42,42],
  247. cyan:[0,255,255],
  248. darkblue:[0,0,139],
  249. darkcyan:[0,139,139],
  250. darkgrey:[169,169,169],
  251. darkgreen:[0,100,0],
  252. darkkhaki:[189,183,107],
  253. darkmagenta:[139,0,139],
  254. darkolivegreen:[85,107,47],
  255. darkorange:[255,140,0],
  256. darkorchid:[153,50,204],
  257. darkred:[139,0,0],
  258. darksalmon:[233,150,122],
  259. darkviolet:[148,0,211],
  260. fuchsia:[255,0,255],
  261. gold:[255,215,0],
  262. green:[0,128,0],
  263. indigo:[75,0,130],
  264. khaki:[240,230,140],
  265. lightblue:[173,216,230],
  266. lightcyan:[224,255,255],
  267. lightgreen:[144,238,144],
  268. lightgrey:[211,211,211],
  269. lightpink:[255,182,193],
  270. lightyellow:[255,255,224],
  271. lime:[0,255,0],
  272. magenta:[255,0,255],
  273. maroon:[128,0,0],
  274. navy:[0,0,128],
  275. olive:[128,128,0],
  276. orange:[255,165,0],
  277. pink:[255,192,203],
  278. purple:[128,0,128],
  279. violet:[128,0,128],
  280. red:[255,0,0],
  281. silver:[192,192,192],
  282. white:[255,255,255],
  283. yellow:[255,255,0],
  284. transparent: [255,255,255]
  285. };
  286. /*
  287. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  288. *
  289. * Uses the built in easing capabilities added In jQuery 1.1
  290. * to offer multiple easing options
  291. *
  292. * TERMS OF USE - jQuery Easing
  293. *
  294. * Open source under the BSD License.
  295. *
  296. * Copyright 2008 George McGinley Smith
  297. * All rights reserved.
  298. *
  299. * Redistribution and use in source and binary forms, with or without modification,
  300. * are permitted provided that the following conditions are met:
  301. *
  302. * Redistributions of source code must retain the above copyright notice, this list of
  303. * conditions and the following disclaimer.
  304. * Redistributions in binary form must reproduce the above copyright notice, this list
  305. * of conditions and the following disclaimer in the documentation and/or other materials
  306. * provided with the distribution.
  307. *
  308. * Neither the name of the author nor the names of contributors may be used to endorse
  309. * or promote products derived from this software without specific prior written permission.
  310. *
  311. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  312. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  313. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  314. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  315. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  316. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  317. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  318. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  319. * OF THE POSSIBILITY OF SUCH DAMAGE.
  320. *
  321. */
  322. // t: current time, b: begInnIng value, c: change In value, d: duration
  323. $.easing.jswing = $.easing.swing;
  324. $.extend($.easing,
  325. {
  326. def: 'easeOutQuad',
  327. swing: function (x, t, b, c, d) {
  328. //alert($.easing.default);
  329. return $.easing[$.easing.def](x, t, b, c, d);
  330. },
  331. easeInQuad: function (x, t, b, c, d) {
  332. return c*(t/=d)*t + b;
  333. },
  334. easeOutQuad: function (x, t, b, c, d) {
  335. return -c *(t/=d)*(t-2) + b;
  336. },
  337. easeInOutQuad: function (x, t, b, c, d) {
  338. if ((t/=d/2) < 1) return c/2*t*t + b;
  339. return -c/2 * ((--t)*(t-2) - 1) + b;
  340. },
  341. easeInCubic: function (x, t, b, c, d) {
  342. return c*(t/=d)*t*t + b;
  343. },
  344. easeOutCubic: function (x, t, b, c, d) {
  345. return c*((t=t/d-1)*t*t + 1) + b;
  346. },
  347. easeInOutCubic: function (x, t, b, c, d) {
  348. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  349. return c/2*((t-=2)*t*t + 2) + b;
  350. },
  351. easeInQuart: function (x, t, b, c, d) {
  352. return c*(t/=d)*t*t*t + b;
  353. },
  354. easeOutQuart: function (x, t, b, c, d) {
  355. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  356. },
  357. easeInOutQuart: function (x, t, b, c, d) {
  358. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  359. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  360. },
  361. easeInQuint: function (x, t, b, c, d) {
  362. return c*(t/=d)*t*t*t*t + b;
  363. },
  364. easeOutQuint: function (x, t, b, c, d) {
  365. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  366. },
  367. easeInOutQuint: function (x, t, b, c, d) {
  368. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  369. return c/2*((t-=2)*t*t*t*t + 2) + b;
  370. },
  371. easeInSine: function (x, t, b, c, d) {
  372. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  373. },
  374. easeOutSine: function (x, t, b, c, d) {
  375. return c * Math.sin(t/d * (Math.PI/2)) + b;
  376. },
  377. easeInOutSine: function (x, t, b, c, d) {
  378. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  379. },
  380. easeInExpo: function (x, t, b, c, d) {
  381. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  382. },
  383. easeOutExpo: function (x, t, b, c, d) {
  384. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  385. },
  386. easeInOutExpo: function (x, t, b, c, d) {
  387. if (t==0) return b;
  388. if (t==d) return b+c;
  389. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  390. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  391. },
  392. easeInCirc: function (x, t, b, c, d) {
  393. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  394. },
  395. easeOutCirc: function (x, t, b, c, d) {
  396. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  397. },
  398. easeInOutCirc: function (x, t, b, c, d) {
  399. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  400. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  401. },
  402. easeInElastic: function (x, t, b, c, d) {
  403. var s=1.70158;var p=0;var a=c;
  404. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  405. if (a < Math.abs(c)) { a=c; var s=p/4; }
  406. else var s = p/(2*Math.PI) * Math.asin (c/a);
  407. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  408. },
  409. easeOutElastic: function (x, t, b, c, d) {
  410. var s=1.70158;var p=0;var a=c;
  411. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  412. if (a < Math.abs(c)) { a=c; var s=p/4; }
  413. else var s = p/(2*Math.PI) * Math.asin (c/a);
  414. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  415. },
  416. easeInOutElastic: function (x, t, b, c, d) {
  417. var s=1.70158;var p=0;var a=c;
  418. if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  419. if (a < Math.abs(c)) { a=c; var s=p/4; }
  420. else var s = p/(2*Math.PI) * Math.asin (c/a);
  421. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  422. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  423. },
  424. easeInBack: function (x, t, b, c, d, s) {
  425. if (s == undefined) s = 1.70158;
  426. return c*(t/=d)*t*((s+1)*t - s) + b;
  427. },
  428. easeOutBack: function (x, t, b, c, d, s) {
  429. if (s == undefined) s = 1.70158;
  430. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  431. },
  432. easeInOutBack: function (x, t, b, c, d, s) {
  433. if (s == undefined) s = 1.70158;
  434. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  435. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  436. },
  437. easeInBounce: function (x, t, b, c, d) {
  438. return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  439. },
  440. easeOutBounce: function (x, t, b, c, d) {
  441. if ((t/=d) < (1/2.75)) {
  442. return c*(7.5625*t*t) + b;
  443. } else if (t < (2/2.75)) {
  444. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  445. } else if (t < (2.5/2.75)) {
  446. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  447. } else {
  448. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  449. }
  450. },
  451. easeInOutBounce: function (x, t, b, c, d) {
  452. if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  453. return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  454. }
  455. });
  456. /*
  457. *
  458. * TERMS OF USE - EASING EQUATIONS
  459. *
  460. * Open source under the BSD License.
  461. *
  462. * Copyright 2001 Robert Penner
  463. * All rights reserved.
  464. *
  465. * Redistribution and use in source and binary forms, with or without modification,
  466. * are permitted provided that the following conditions are met:
  467. *
  468. * Redistributions of source code must retain the above copyright notice, this list of
  469. * conditions and the following disclaimer.
  470. * Redistributions in binary form must reproduce the above copyright notice, this list
  471. * of conditions and the following disclaimer in the documentation and/or other materials
  472. * provided with the distribution.
  473. *
  474. * Neither the name of the author nor the names of contributors may be used to endorse
  475. * or promote products derived from this software without specific prior written permission.
  476. *
  477. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  478. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  479. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  480. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  481. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  482. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  483. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  484. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  485. * OF THE POSSIBILITY OF SUCH DAMAGE.
  486. *
  487. */
  488. })(jQuery);