annotate js/bt/other_libs/jquery.easing.1.3.js @ 18:0d557e6e73f7

Added beautytips and some additional event handling code to the library.
author David Eads <eads@chicagotech.org>
date Fri, 06 Mar 2009 14:11:46 -0600
parents
children
rev   line source
eads@18 1 /*
eads@18 2 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
eads@18 3 *
eads@18 4 * Uses the built in easing capabilities added In jQuery 1.1
eads@18 5 * to offer multiple easing options
eads@18 6 *
eads@18 7 * TERMS OF USE - jQuery Easing
eads@18 8 *
eads@18 9 * Open source under the BSD License.
eads@18 10 *
eads@18 11 * Copyright © 2008 George McGinley Smith
eads@18 12 * All rights reserved.
eads@18 13 *
eads@18 14 * Redistribution and use in source and binary forms, with or without modification,
eads@18 15 * are permitted provided that the following conditions are met:
eads@18 16 *
eads@18 17 * Redistributions of source code must retain the above copyright notice, this list of
eads@18 18 * conditions and the following disclaimer.
eads@18 19 * Redistributions in binary form must reproduce the above copyright notice, this list
eads@18 20 * of conditions and the following disclaimer in the documentation and/or other materials
eads@18 21 * provided with the distribution.
eads@18 22 *
eads@18 23 * Neither the name of the author nor the names of contributors may be used to endorse
eads@18 24 * or promote products derived from this software without specific prior written permission.
eads@18 25 *
eads@18 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
eads@18 27 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
eads@18 28 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
eads@18 29 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
eads@18 30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
eads@18 31 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
eads@18 32 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
eads@18 33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
eads@18 34 * OF THE POSSIBILITY OF SUCH DAMAGE.
eads@18 35 *
eads@18 36 */
eads@18 37
eads@18 38 // t: current time, b: begInnIng value, c: change In value, d: duration
eads@18 39 jQuery.easing['jswing'] = jQuery.easing['swing'];
eads@18 40
eads@18 41 jQuery.extend( jQuery.easing,
eads@18 42 {
eads@18 43 def: 'easeOutQuad',
eads@18 44 swing: function (x, t, b, c, d) {
eads@18 45 //alert(jQuery.easing.default);
eads@18 46 return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
eads@18 47 },
eads@18 48 easeInQuad: function (x, t, b, c, d) {
eads@18 49 return c*(t/=d)*t + b;
eads@18 50 },
eads@18 51 easeOutQuad: function (x, t, b, c, d) {
eads@18 52 return -c *(t/=d)*(t-2) + b;
eads@18 53 },
eads@18 54 easeInOutQuad: function (x, t, b, c, d) {
eads@18 55 if ((t/=d/2) < 1) return c/2*t*t + b;
eads@18 56 return -c/2 * ((--t)*(t-2) - 1) + b;
eads@18 57 },
eads@18 58 easeInCubic: function (x, t, b, c, d) {
eads@18 59 return c*(t/=d)*t*t + b;
eads@18 60 },
eads@18 61 easeOutCubic: function (x, t, b, c, d) {
eads@18 62 return c*((t=t/d-1)*t*t + 1) + b;
eads@18 63 },
eads@18 64 easeInOutCubic: function (x, t, b, c, d) {
eads@18 65 if ((t/=d/2) < 1) return c/2*t*t*t + b;
eads@18 66 return c/2*((t-=2)*t*t + 2) + b;
eads@18 67 },
eads@18 68 easeInQuart: function (x, t, b, c, d) {
eads@18 69 return c*(t/=d)*t*t*t + b;
eads@18 70 },
eads@18 71 easeOutQuart: function (x, t, b, c, d) {
eads@18 72 return -c * ((t=t/d-1)*t*t*t - 1) + b;
eads@18 73 },
eads@18 74 easeInOutQuart: function (x, t, b, c, d) {
eads@18 75 if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
eads@18 76 return -c/2 * ((t-=2)*t*t*t - 2) + b;
eads@18 77 },
eads@18 78 easeInQuint: function (x, t, b, c, d) {
eads@18 79 return c*(t/=d)*t*t*t*t + b;
eads@18 80 },
eads@18 81 easeOutQuint: function (x, t, b, c, d) {
eads@18 82 return c*((t=t/d-1)*t*t*t*t + 1) + b;
eads@18 83 },
eads@18 84 easeInOutQuint: function (x, t, b, c, d) {
eads@18 85 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
eads@18 86 return c/2*((t-=2)*t*t*t*t + 2) + b;
eads@18 87 },
eads@18 88 easeInSine: function (x, t, b, c, d) {
eads@18 89 return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
eads@18 90 },
eads@18 91 easeOutSine: function (x, t, b, c, d) {
eads@18 92 return c * Math.sin(t/d * (Math.PI/2)) + b;
eads@18 93 },
eads@18 94 easeInOutSine: function (x, t, b, c, d) {
eads@18 95 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
eads@18 96 },
eads@18 97 easeInExpo: function (x, t, b, c, d) {
eads@18 98 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
eads@18 99 },
eads@18 100 easeOutExpo: function (x, t, b, c, d) {
eads@18 101 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
eads@18 102 },
eads@18 103 easeInOutExpo: function (x, t, b, c, d) {
eads@18 104 if (t==0) return b;
eads@18 105 if (t==d) return b+c;
eads@18 106 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
eads@18 107 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
eads@18 108 },
eads@18 109 easeInCirc: function (x, t, b, c, d) {
eads@18 110 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
eads@18 111 },
eads@18 112 easeOutCirc: function (x, t, b, c, d) {
eads@18 113 return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
eads@18 114 },
eads@18 115 easeInOutCirc: function (x, t, b, c, d) {
eads@18 116 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
eads@18 117 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
eads@18 118 },
eads@18 119 easeInElastic: function (x, t, b, c, d) {
eads@18 120 var s=1.70158;var p=0;var a=c;
eads@18 121 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
eads@18 122 if (a < Math.abs(c)) { a=c; var s=p/4; }
eads@18 123 else var s = p/(2*Math.PI) * Math.asin (c/a);
eads@18 124 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
eads@18 125 },
eads@18 126 easeOutElastic: function (x, t, b, c, d) {
eads@18 127 var s=1.70158;var p=0;var a=c;
eads@18 128 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
eads@18 129 if (a < Math.abs(c)) { a=c; var s=p/4; }
eads@18 130 else var s = p/(2*Math.PI) * Math.asin (c/a);
eads@18 131 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
eads@18 132 },
eads@18 133 easeInOutElastic: function (x, t, b, c, d) {
eads@18 134 var s=1.70158;var p=0;var a=c;
eads@18 135 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
eads@18 136 if (a < Math.abs(c)) { a=c; var s=p/4; }
eads@18 137 else var s = p/(2*Math.PI) * Math.asin (c/a);
eads@18 138 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
eads@18 139 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
eads@18 140 },
eads@18 141 easeInBack: function (x, t, b, c, d, s) {
eads@18 142 if (s == undefined) s = 1.70158;
eads@18 143 return c*(t/=d)*t*((s+1)*t - s) + b;
eads@18 144 },
eads@18 145 easeOutBack: function (x, t, b, c, d, s) {
eads@18 146 if (s == undefined) s = 1.70158;
eads@18 147 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
eads@18 148 },
eads@18 149 easeInOutBack: function (x, t, b, c, d, s) {
eads@18 150 if (s == undefined) s = 1.70158;
eads@18 151 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
eads@18 152 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
eads@18 153 },
eads@18 154 easeInBounce: function (x, t, b, c, d) {
eads@18 155 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
eads@18 156 },
eads@18 157 easeOutBounce: function (x, t, b, c, d) {
eads@18 158 if ((t/=d) < (1/2.75)) {
eads@18 159 return c*(7.5625*t*t) + b;
eads@18 160 } else if (t < (2/2.75)) {
eads@18 161 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
eads@18 162 } else if (t < (2.5/2.75)) {
eads@18 163 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
eads@18 164 } else {
eads@18 165 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
eads@18 166 }
eads@18 167 },
eads@18 168 easeInOutBounce: function (x, t, b, c, d) {
eads@18 169 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
eads@18 170 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
eads@18 171 }
eads@18 172 });
eads@18 173
eads@18 174 /*
eads@18 175 *
eads@18 176 * TERMS OF USE - EASING EQUATIONS
eads@18 177 *
eads@18 178 * Open source under the BSD License.
eads@18 179 *
eads@18 180 * Copyright © 2001 Robert Penner
eads@18 181 * All rights reserved.
eads@18 182 *
eads@18 183 * Redistribution and use in source and binary forms, with or without modification,
eads@18 184 * are permitted provided that the following conditions are met:
eads@18 185 *
eads@18 186 * Redistributions of source code must retain the above copyright notice, this list of
eads@18 187 * conditions and the following disclaimer.
eads@18 188 * Redistributions in binary form must reproduce the above copyright notice, this list
eads@18 189 * of conditions and the following disclaimer in the documentation and/or other materials
eads@18 190 * provided with the distribution.
eads@18 191 *
eads@18 192 * Neither the name of the author nor the names of contributors may be used to endorse
eads@18 193 * or promote products derived from this software without specific prior written permission.
eads@18 194 *
eads@18 195 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
eads@18 196 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
eads@18 197 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
eads@18 198 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
eads@18 199 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
eads@18 200 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
eads@18 201 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
eads@18 202 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
eads@18 203 * OF THE POSSIBILITY OF SUCH DAMAGE.
eads@18 204 *
eads@18 205 */