PageSourceSearch

https://drabeny.com/js/jquery.easing.js

js drabeny.com collected 2026-10-03 18:24:12 UTC 3,242 bytes, 102 lines download raw bytes

1/*
2 * jQuery Easing v1.1.1 - http://gsgd.co.uk/sandbox/jquery.easing.php
3 *
4 * Uses the built in easing capabilities added in jQuery 1.1
5 * to offer multiple easing options
6 *
7 * Copyright (c) 2007 George Smith
8 * Licensed under the MIT License:
9 *   http://www.opensource.org/licenses/mit-license.php
10 */
11
12jQuery.extend(jQuery.easing, {
13	easein: function(x, t, b, c, d) {
14		return c*(t/=d)*t + b; // in
15	},
16	easeinout: function(x, t, b, c, d) {
17		if (t < d/2) return 2*c*t*t/(d*d) + b;
18		var ts = t - d/2;
19		return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b;		
20	},
21	easeout: function(x, t, b, c, d) {
22		return -c*t*t/(d*d) + 2*c*t/d + b;
23	},
24	expoin: function(x, t, b, c, d) {
25		var flip = 1;
26		if (c < 0) {
27			flip *= -1;
28			c *= -1;
29		}
30		return flip * (Math.exp(Math.log(c)/d * t)) + b;		
31	},
32	expoout: function(x, t, b, c, d) {
33		var flip = 1;
34		if (c < 0) {
35			flip *= -1;
36			c *= -1;
37		}
38		return flip * (-Math.exp(-Math.log(c)/d * (t-d)) + c + 1) + b;
39	},
40	expoinout: function(x, t, b, c, d) {
41		var flip = 1;
42		if (c < 0) {
43			flip *= -1;
44			c *= -1;
45		}
46		if (t < d/2) return flip * (Math.exp(Math.log(c/2)/(d/2) * t)) + b;
47		return flip * (-Math.exp(-2*Math.log(c/2)/d * (t-d)) + c + 1) + b;
48	},
49	bouncein: function(x, t, b, c, d) {
50		return c - jQuery.easing['bounceout'](x, d-t, 0, c, d) + b;
51	},
52	bounceout: function(x, t, b, c, d) {
53		if ((t/=d) < (1/2.75)) {
54			return c*(7.5625*t*t) + b;
55		} else if (t < (2/2.75)) {
56			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
57		} else if (t < (2.5/2.75)) {
58			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
59		} else {
60			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
61		}
62	},
63	bounceinout: function(x, t, b, c, d) {
64		if (t < d/2) return jQuery.easing['bouncein'] (x, t*2, 0, c, d) * .5 + b;
65		return jQuery.easing['bounceout'] (x, t*2-d,0, c, d) * .5 + c*.5 + b;
66	},
67	elasin: function(x, t, b, c, d) {
68		var s=1.70158;var p=0;var a=c;
69		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
70		if (a < Math.abs(c)) { a=c; var s=p/4; }
71		else var s = p/(2*Math.PI) * Math.asin (c/a);
72		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
73	},
74	elasout: function(x, t, b, c, d) {
75		var s=1.70158;var p=0;var a=c;
76		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
77		if (a < Math.abs(c)) { a=c; var s=p/4; }
78		else var s = p/(2*Math.PI) * Math.asin (c/a);
79		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
80	},
81	elasinout: function(x, t, b, c, d) {
82		var s=1.70158;var p=0;var a=c;
83		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
84		if (a < Math.abs(c)) { a=c; var s=p/4; }
85		else var s = p/(2*Math.PI) * Math.asin (c/a);
86		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
87		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
88	},
89	backin: function(x, t, b, c, d) {
90		var s=1.70158;
91		return c*(t/=d)*t*((s+1)*t - s) + b;
92	},
93	backout: function(x, t, b, c, d) {
94		var s=1.70158;
95		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
96	},
97	backinout: function(x, t, b, c, d) {
98		var s=1.70158;
99		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
100		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
101	}
102});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.