external library initial commit
[dwaf.git] / externals / jquery-ui-1.8 / ui / jquery.effects.core.js
blobac332f2c4e2a8fd9be1c9285f97e987e158da4b3
1 /*\r
2  * jQuery UI Effects 1.8\r
3  *\r
4  * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)\r
5  * Dual licensed under the MIT (MIT-LICENSE.txt)\r
6  * and GPL (GPL-LICENSE.txt) licenses.\r
7  *\r
8  * http://docs.jquery.com/UI/Effects/\r
9  */\r
10 ;jQuery.effects || (function($) {\r
12 $.effects = {};\r
16 /******************************************************************************/\r
17 /****************************** COLOR ANIMATIONS ******************************/\r
18 /******************************************************************************/\r
20 // override the animation for color styles\r
21 $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',\r
22         'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],\r
23 function(i, attr) {\r
24         $.fx.step[attr] = function(fx) {\r
25                 if (!fx.colorInit) {\r
26                         fx.start = getColor(fx.elem, attr);\r
27                         fx.end = getRGB(fx.end);\r
28                         fx.colorInit = true;\r
29                 }\r
31                 fx.elem.style[attr] = 'rgb(' +\r
32                         Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +\r
33                         Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +\r
34                         Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';\r
35         };\r
36 });\r
38 // Color Conversion functions from highlightFade\r
39 // By Blair Mitchelmore\r
40 // http://jquery.offput.ca/highlightFade/\r
42 // Parse strings looking for color tuples [255,255,255]\r
43 function getRGB(color) {\r
44                 var result;\r
46                 // Check if we're already dealing with an array of colors\r
47                 if ( color && color.constructor == Array && color.length == 3 )\r
48                                 return color;\r
50                 // Look for rgb(num,num,num)\r
51                 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))\r
52                                 return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];\r
54                 // Look for rgb(num%,num%,num%)\r
55                 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))\r
56                                 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];\r
58                 // Look for #a0b1c2\r
59                 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))\r
60                                 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];\r
62                 // Look for #fff\r
63                 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))\r
64                                 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];\r
66                 // Look for rgba(0, 0, 0, 0) == transparent in Safari 3\r
67                 if (result = /rgba\(0, 0, 0, 0\)/.exec(color))\r
68                                 return colors['transparent'];\r
70                 // Otherwise, we're most likely dealing with a named color\r
71                 return colors[$.trim(color).toLowerCase()];\r
72 }\r
74 function getColor(elem, attr) {\r
75                 var color;\r
77                 do {\r
78                                 color = $.curCSS(elem, attr);\r
80                                 // Keep going until we find an element that has color, or we hit the body\r
81                                 if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )\r
82                                                 break;\r
84                                 attr = "backgroundColor";\r
85                 } while ( elem = elem.parentNode );\r
87                 return getRGB(color);\r
88 };\r
90 // Some named colors to work with\r
91 // From Interface by Stefan Petre\r
92 // http://interface.eyecon.ro/\r
94 var colors = {\r
95         aqua:[0,255,255],\r
96         azure:[240,255,255],\r
97         beige:[245,245,220],\r
98         black:[0,0,0],\r
99         blue:[0,0,255],\r
100         brown:[165,42,42],\r
101         cyan:[0,255,255],\r
102         darkblue:[0,0,139],\r
103         darkcyan:[0,139,139],\r
104         darkgrey:[169,169,169],\r
105         darkgreen:[0,100,0],\r
106         darkkhaki:[189,183,107],\r
107         darkmagenta:[139,0,139],\r
108         darkolivegreen:[85,107,47],\r
109         darkorange:[255,140,0],\r
110         darkorchid:[153,50,204],\r
111         darkred:[139,0,0],\r
112         darksalmon:[233,150,122],\r
113         darkviolet:[148,0,211],\r
114         fuchsia:[255,0,255],\r
115         gold:[255,215,0],\r
116         green:[0,128,0],\r
117         indigo:[75,0,130],\r
118         khaki:[240,230,140],\r
119         lightblue:[173,216,230],\r
120         lightcyan:[224,255,255],\r
121         lightgreen:[144,238,144],\r
122         lightgrey:[211,211,211],\r
123         lightpink:[255,182,193],\r
124         lightyellow:[255,255,224],\r
125         lime:[0,255,0],\r
126         magenta:[255,0,255],\r
127         maroon:[128,0,0],\r
128         navy:[0,0,128],\r
129         olive:[128,128,0],\r
130         orange:[255,165,0],\r
131         pink:[255,192,203],\r
132         purple:[128,0,128],\r
133         violet:[128,0,128],\r
134         red:[255,0,0],\r
135         silver:[192,192,192],\r
136         white:[255,255,255],\r
137         yellow:[255,255,0],\r
138         transparent: [255,255,255]\r
139 };\r
143 /******************************************************************************/\r
144 /****************************** CLASS ANIMATIONS ******************************/\r
145 /******************************************************************************/\r
147 var classAnimationActions = ['add', 'remove', 'toggle'],\r
148         shorthandStyles = {\r
149                 border: 1,\r
150                 borderBottom: 1,\r
151                 borderColor: 1,\r
152                 borderLeft: 1,\r
153                 borderRight: 1,\r
154                 borderTop: 1,\r
155                 borderWidth: 1,\r
156                 margin: 1,\r
157                 padding: 1\r
158         };\r
160 function getElementStyles() {\r
161         var style = document.defaultView\r
162                         ? document.defaultView.getComputedStyle(this, null)\r
163                         : this.currentStyle,\r
164                 newStyle = {},\r
165                 key,\r
166                 camelCase;\r
168         // webkit enumerates style porperties\r
169         if (style && style.length && style[0] && style[style[0]]) {\r
170                 var len = style.length;\r
171                 while (len--) {\r
172                         key = style[len];\r
173                         if (typeof style[key] == 'string') {\r
174                                 camelCase = key.replace(/\-(\w)/g, function(all, letter){\r
175                                         return letter.toUpperCase();\r
176                                 });\r
177                                 newStyle[camelCase] = style[key];\r
178                         }\r
179                 }\r
180         } else {\r
181                 for (key in style) {\r
182                         if (typeof style[key] === 'string') {\r
183                                 newStyle[key] = style[key];\r
184                         }\r
185                 }\r
186         }\r
187         \r
188         return newStyle;\r
191 function filterStyles(styles) {\r
192         var name, value;\r
193         for (name in styles) {\r
194                 value = styles[name];\r
195                 if (\r
196                         // ignore null and undefined values\r
197                         value == null ||\r
198                         // ignore functions (when does this occur?)\r
199                         $.isFunction(value) ||\r
200                         // shorthand styles that need to be expanded\r
201                         name in shorthandStyles ||\r
202                         // ignore scrollbars (break in IE)\r
203                         (/scrollbar/).test(name) ||\r
205                         // only colors or values that can be converted to numbers\r
206                         (!(/color/i).test(name) && isNaN(parseFloat(value)))\r
207                 ) {\r
208                         delete styles[name];\r
209                 }\r
210         }\r
211         \r
212         return styles;\r
215 function styleDifference(oldStyle, newStyle) {\r
216         var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459\r
217                 name;\r
219         for (name in newStyle) {\r
220                 if (oldStyle[name] != newStyle[name]) {\r
221                         diff[name] = newStyle[name];\r
222                 }\r
223         }\r
225         return diff;\r
228 $.effects.animateClass = function(value, duration, easing, callback) {\r
229         if ($.isFunction(easing)) {\r
230                 callback = easing;\r
231                 easing = null;\r
232         }\r
234         return this.each(function() {\r
236                 var that = $(this),\r
237                         originalStyleAttr = that.attr('style') || ' ',\r
238                         originalStyle = filterStyles(getElementStyles.call(this)),\r
239                         newStyle,\r
240                         className = that.attr('className');\r
242                 $.each(classAnimationActions, function(i, action) {\r
243                         if (value[action]) {\r
244                                 that[action + 'Class'](value[action]);\r
245                         }\r
246                 });\r
247                 newStyle = filterStyles(getElementStyles.call(this));\r
248                 that.attr('className', className);\r
250                 that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {\r
251                         $.each(classAnimationActions, function(i, action) {\r
252                                 if (value[action]) { that[action + 'Class'](value[action]); }\r
253                         });\r
254                         // work around bug in IE by clearing the cssText before setting it\r
255                         if (typeof that.attr('style') == 'object') {\r
256                                 that.attr('style').cssText = '';\r
257                                 that.attr('style').cssText = originalStyleAttr;\r
258                         } else {\r
259                                 that.attr('style', originalStyleAttr);\r
260                         }\r
261                         if (callback) { callback.apply(this, arguments); }\r
262                 });\r
263         });\r
264 };\r
266 $.fn.extend({\r
267         _addClass: $.fn.addClass,\r
268         addClass: function(classNames, speed, easing, callback) {\r
269                 return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);\r
270         },\r
272         _removeClass: $.fn.removeClass,\r
273         removeClass: function(classNames,speed,easing,callback) {\r
274                 return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);\r
275         },\r
277         _toggleClass: $.fn.toggleClass,\r
278         toggleClass: function(classNames, force, speed, easing, callback) {\r
279                 if ( typeof force == "boolean" || force === undefined ) {\r
280                         if ( !speed ) {\r
281                                 // without speed parameter;\r
282                                 return this._toggleClass(classNames, force);\r
283                         } else {\r
284                                 return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);\r
285                         }\r
286                 } else {\r
287                         // without switch parameter;\r
288                         return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);\r
289                 }\r
290         },\r
292         switchClass: function(remove,add,speed,easing,callback) {\r
293                 return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);\r
294         }\r
295 });\r
299 /******************************************************************************/\r
300 /*********************************** EFFECTS **********************************/\r
301 /******************************************************************************/\r
303 $.extend($.effects, {\r
304         version: "1.8",\r
306         // Saves a set of properties in a data storage\r
307         save: function(element, set) {\r
308                 for(var i=0; i < set.length; i++) {\r
309                         if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);\r
310                 }\r
311         },\r
313         // Restores a set of previously saved properties from a data storage\r
314         restore: function(element, set) {\r
315                 for(var i=0; i < set.length; i++) {\r
316                         if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));\r
317                 }\r
318         },\r
320         setMode: function(el, mode) {\r
321                 if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle\r
322                 return mode;\r
323         },\r
325         getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value\r
326                 // this should be a little more flexible in the future to handle a string & hash\r
327                 var y, x;\r
328                 switch (origin[0]) {\r
329                         case 'top': y = 0; break;\r
330                         case 'middle': y = 0.5; break;\r
331                         case 'bottom': y = 1; break;\r
332                         default: y = origin[0] / original.height;\r
333                 };\r
334                 switch (origin[1]) {\r
335                         case 'left': x = 0; break;\r
336                         case 'center': x = 0.5; break;\r
337                         case 'right': x = 1; break;\r
338                         default: x = origin[1] / original.width;\r
339                 };\r
340                 return {x: x, y: y};\r
341         },\r
343         // Wraps the element around a wrapper that copies position properties\r
344         createWrapper: function(element) {\r
346                 // if the element is already wrapped, return it\r
347                 if (element.parent().is('.ui-effects-wrapper')) {\r
348                         return element.parent();\r
349                 }\r
351                 // wrap the element\r
352                 var props = {\r
353                                 width: element.outerWidth(true),\r
354                                 height: element.outerHeight(true),\r
355                                 'float': element.css('float')\r
356                         },\r
357                         wrapper = $('<div></div>')\r
358                                 .addClass('ui-effects-wrapper')\r
359                                 .css({\r
360                                         fontSize: '100%',\r
361                                         background: 'transparent',\r
362                                         border: 'none',\r
363                                         margin: 0,\r
364                                         padding: 0\r
365                                 });\r
367                 element.wrap(wrapper);\r
368                 wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element\r
370                 // transfer positioning properties to the wrapper\r
371                 if (element.css('position') == 'static') {\r
372                         wrapper.css({ position: 'relative' });\r
373                         element.css({ position: 'relative' });\r
374                 } else {\r
375                         $.extend(props, {\r
376                                 position: element.css('position'),\r
377                                 zIndex: element.css('z-index')\r
378                         });\r
379                         $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {\r
380                                 props[pos] = element.css(pos);\r
381                                 if (isNaN(parseInt(props[pos], 10))) {\r
382                                         props[pos] = 'auto';\r
383                                 }\r
384                         });\r
385                         element.css({position: 'relative', top: 0, left: 0 });\r
386                 }\r
388                 return wrapper.css(props).show();\r
389         },\r
391         removeWrapper: function(element) {\r
392                 if (element.parent().is('.ui-effects-wrapper'))\r
393                         return element.parent().replaceWith(element);\r
394                 return element;\r
395         },\r
397         setTransition: function(element, list, factor, value) {\r
398                 value = value || {};\r
399                 $.each(list, function(i, x){\r
400                         unit = element.cssUnit(x);\r
401                         if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];\r
402                 });\r
403                 return value;\r
404         }\r
405 });\r
408 function _normalizeArguments(effect, options, speed, callback) {\r
409         // shift params for method overloading\r
410         if (typeof effect == 'object') {\r
411                 callback = options;\r
412                 speed = null;\r
413                 options = effect;\r
414                 effect = options.effect;\r
415         }\r
416         if ($.isFunction(options)) {\r
417                 callback = options;\r
418                 speed = null;\r
419                 options = {};\r
420         }\r
421         if ($.isFunction(speed)) {\r
422                 callback = speed;\r
423                 speed = null;\r
424         }\r
425         if (typeof options == 'number' || $.fx.speeds[options]) {\r
426                 callback = speed;\r
427                 speed = options;\r
428                 options = {};\r
429         }\r
431         options = options || {};\r
433         speed = speed || options.duration;\r
434         speed = $.fx.off ? 0 : typeof speed == 'number'\r
435                 ? speed : $.fx.speeds[speed] || $.fx.speeds._default;\r
437         callback = callback || options.complete;\r
439         return [effect, options, speed, callback];\r
442 $.fn.extend({\r
443         effect: function(effect, options, speed, callback) {\r
444                 var args = _normalizeArguments.apply(this, arguments),\r
445                         // TODO: make effects takes actual parameters instead of a hash\r
446                         args2 = {\r
447                                 options: args[1],\r
448                                 duration: args[2],\r
449                                 callback: args[3]\r
450                         },\r
451                         effectMethod = $.effects[effect];\r
452                 \r
453                 return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;\r
454         },\r
456         _show: $.fn.show,\r
457         show: function(speed) {\r
458                 if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {\r
459                         return this._show.apply(this, arguments);\r
460                 } else {\r
461                         var args = _normalizeArguments.apply(this, arguments);\r
462                         args[1].mode = 'show';\r
463                         return this.effect.apply(this, args);\r
464                 }\r
465         },\r
467         _hide: $.fn.hide,\r
468         hide: function(speed) {\r
469                 if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {\r
470                         return this._hide.apply(this, arguments);\r
471                 } else {\r
472                         var args = _normalizeArguments.apply(this, arguments);\r
473                         args[1].mode = 'hide';\r
474                         return this.effect.apply(this, args);\r
475                 }\r
476         },\r
478         // jQuery core overloads toggle and create _toggle\r
479         __toggle: $.fn.toggle,\r
480         toggle: function(speed) {\r
481                 if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||\r
482                         typeof speed == 'boolean' || $.isFunction(speed)) {\r
483                         return this.__toggle.apply(this, arguments);\r
484                 } else {\r
485                         var args = _normalizeArguments.apply(this, arguments);\r
486                         args[1].mode = 'toggle';\r
487                         return this.effect.apply(this, args);\r
488                 }\r
489         },\r
491         // helper functions\r
492         cssUnit: function(key) {\r
493                 var style = this.css(key), val = [];\r
494                 $.each( ['em','px','%','pt'], function(i, unit){\r
495                         if(style.indexOf(unit) > 0)\r
496                                 val = [parseFloat(style), unit];\r
497                 });\r
498                 return val;\r
499         }\r
500 });\r
504 /******************************************************************************/\r
505 /*********************************** EASING ***********************************/\r
506 /******************************************************************************/\r
508 /*\r
509  * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/\r
510  *\r
511  * Uses the built in easing capabilities added In jQuery 1.1\r
512  * to offer multiple easing options\r
513  *\r
514  * TERMS OF USE - jQuery Easing\r
515  *\r
516  * Open source under the BSD License.\r
517  *\r
518  * Copyright 2008 George McGinley Smith\r
519  * All rights reserved.\r
520  *\r
521  * Redistribution and use in source and binary forms, with or without modification,\r
522  * are permitted provided that the following conditions are met:\r
523  *\r
524  * Redistributions of source code must retain the above copyright notice, this list of\r
525  * conditions and the following disclaimer.\r
526  * Redistributions in binary form must reproduce the above copyright notice, this list\r
527  * of conditions and the following disclaimer in the documentation and/or other materials\r
528  * provided with the distribution.\r
529  *\r
530  * Neither the name of the author nor the names of contributors may be used to endorse\r
531  * or promote products derived from this software without specific prior written permission.\r
532  *\r
533  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\r
534  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
535  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
536  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
537  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
538  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\r
539  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
540  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
541  * OF THE POSSIBILITY OF SUCH DAMAGE.\r
542  *\r
543 */\r
545 // t: current time, b: begInnIng value, c: change In value, d: duration\r
546 $.easing.jswing = $.easing.swing;\r
548 $.extend($.easing,\r
550         def: 'easeOutQuad',\r
551         swing: function (x, t, b, c, d) {\r
552                 //alert($.easing.default);\r
553                 return $.easing[$.easing.def](x, t, b, c, d);\r
554         },\r
555         easeInQuad: function (x, t, b, c, d) {\r
556                 return c*(t/=d)*t + b;\r
557         },\r
558         easeOutQuad: function (x, t, b, c, d) {\r
559                 return -c *(t/=d)*(t-2) + b;\r
560         },\r
561         easeInOutQuad: function (x, t, b, c, d) {\r
562                 if ((t/=d/2) < 1) return c/2*t*t + b;\r
563                 return -c/2 * ((--t)*(t-2) - 1) + b;\r
564         },\r
565         easeInCubic: function (x, t, b, c, d) {\r
566                 return c*(t/=d)*t*t + b;\r
567         },\r
568         easeOutCubic: function (x, t, b, c, d) {\r
569                 return c*((t=t/d-1)*t*t + 1) + b;\r
570         },\r
571         easeInOutCubic: function (x, t, b, c, d) {\r
572                 if ((t/=d/2) < 1) return c/2*t*t*t + b;\r
573                 return c/2*((t-=2)*t*t + 2) + b;\r
574         },\r
575         easeInQuart: function (x, t, b, c, d) {\r
576                 return c*(t/=d)*t*t*t + b;\r
577         },\r
578         easeOutQuart: function (x, t, b, c, d) {\r
579                 return -c * ((t=t/d-1)*t*t*t - 1) + b;\r
580         },\r
581         easeInOutQuart: function (x, t, b, c, d) {\r
582                 if ((t/=d/2) < 1) return c/2*t*t*t*t + b;\r
583                 return -c/2 * ((t-=2)*t*t*t - 2) + b;\r
584         },\r
585         easeInQuint: function (x, t, b, c, d) {\r
586                 return c*(t/=d)*t*t*t*t + b;\r
587         },\r
588         easeOutQuint: function (x, t, b, c, d) {\r
589                 return c*((t=t/d-1)*t*t*t*t + 1) + b;\r
590         },\r
591         easeInOutQuint: function (x, t, b, c, d) {\r
592                 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;\r
593                 return c/2*((t-=2)*t*t*t*t + 2) + b;\r
594         },\r
595         easeInSine: function (x, t, b, c, d) {\r
596                 return -c * Math.cos(t/d * (Math.PI/2)) + c + b;\r
597         },\r
598         easeOutSine: function (x, t, b, c, d) {\r
599                 return c * Math.sin(t/d * (Math.PI/2)) + b;\r
600         },\r
601         easeInOutSine: function (x, t, b, c, d) {\r
602                 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;\r
603         },\r
604         easeInExpo: function (x, t, b, c, d) {\r
605                 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;\r
606         },\r
607         easeOutExpo: function (x, t, b, c, d) {\r
608                 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;\r
609         },\r
610         easeInOutExpo: function (x, t, b, c, d) {\r
611                 if (t==0) return b;\r
612                 if (t==d) return b+c;\r
613                 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;\r
614                 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;\r
615         },\r
616         easeInCirc: function (x, t, b, c, d) {\r
617                 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;\r
618         },\r
619         easeOutCirc: function (x, t, b, c, d) {\r
620                 return c * Math.sqrt(1 - (t=t/d-1)*t) + b;\r
621         },\r
622         easeInOutCirc: function (x, t, b, c, d) {\r
623                 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;\r
624                 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;\r
625         },\r
626         easeInElastic: function (x, t, b, c, d) {\r
627                 var s=1.70158;var p=0;var a=c;\r
628                 if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;\r
629                 if (a < Math.abs(c)) { a=c; var s=p/4; }\r
630                 else var s = p/(2*Math.PI) * Math.asin (c/a);\r
631                 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;\r
632         },\r
633         easeOutElastic: function (x, t, b, c, d) {\r
634                 var s=1.70158;var p=0;var a=c;\r
635                 if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;\r
636                 if (a < Math.abs(c)) { a=c; var s=p/4; }\r
637                 else var s = p/(2*Math.PI) * Math.asin (c/a);\r
638                 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;\r
639         },\r
640         easeInOutElastic: function (x, t, b, c, d) {\r
641                 var s=1.70158;var p=0;var a=c;\r
642                 if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);\r
643                 if (a < Math.abs(c)) { a=c; var s=p/4; }\r
644                 else var s = p/(2*Math.PI) * Math.asin (c/a);\r
645                 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;\r
646                 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;\r
647         },\r
648         easeInBack: function (x, t, b, c, d, s) {\r
649                 if (s == undefined) s = 1.70158;\r
650                 return c*(t/=d)*t*((s+1)*t - s) + b;\r
651         },\r
652         easeOutBack: function (x, t, b, c, d, s) {\r
653                 if (s == undefined) s = 1.70158;\r
654                 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;\r
655         },\r
656         easeInOutBack: function (x, t, b, c, d, s) {\r
657                 if (s == undefined) s = 1.70158;\r
658                 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;\r
659                 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;\r
660         },\r
661         easeInBounce: function (x, t, b, c, d) {\r
662                 return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;\r
663         },\r
664         easeOutBounce: function (x, t, b, c, d) {\r
665                 if ((t/=d) < (1/2.75)) {\r
666                         return c*(7.5625*t*t) + b;\r
667                 } else if (t < (2/2.75)) {\r
668                         return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;\r
669                 } else if (t < (2.5/2.75)) {\r
670                         return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;\r
671                 } else {\r
672                         return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;\r
673                 }\r
674         },\r
675         easeInOutBounce: function (x, t, b, c, d) {\r
676                 if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;\r
677                 return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;\r
678         }\r
679 });\r
681 /*\r
682  *\r
683  * TERMS OF USE - EASING EQUATIONS\r
684  *\r
685  * Open source under the BSD License.\r
686  *\r
687  * Copyright 2001 Robert Penner\r
688  * All rights reserved.\r
689  *\r
690  * Redistribution and use in source and binary forms, with or without modification,\r
691  * are permitted provided that the following conditions are met:\r
692  *\r
693  * Redistributions of source code must retain the above copyright notice, this list of\r
694  * conditions and the following disclaimer.\r
695  * Redistributions in binary form must reproduce the above copyright notice, this list\r
696  * of conditions and the following disclaimer in the documentation and/or other materials\r
697  * provided with the distribution.\r
698  *\r
699  * Neither the name of the author nor the names of contributors may be used to endorse\r
700  * or promote products derived from this software without specific prior written permission.\r
701  *\r
702  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\r
703  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
704  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
705  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
706  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
707  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\r
708  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
709  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
710  * OF THE POSSIBILITY OF SUCH DAMAGE.\r
711  *\r
712  */\r
714 })(jQuery);\r