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