PageSourceSearch

https://www.shanghai.gov.cn/assets22026/plugin/jquery.easing.js

js shanghai.gov.cn collected 2026-10-02 02:24:36 UTC 3,810 bytes, 160 lines download raw bytes

vendor: 3,810 bytes, lines 1-160
1
2
3(function (factory) {
4	if (typeof define === "function" && define.amd) {
5		define(['jquery'], function ($) {
6			return factory($);
7		});
8	} else if (typeof module === "object" && typeof module.exports === "object") {
9		exports = factory(require('jquery'));
10	} else {
11		factory(jQuery);
12	}
13})(function($){
14
15// Preserve the original jQuery "swing" easing as "jswing"
16$.easing['jswing'] = $.easing['swing'];
17
18var pow = Math.pow,
19	sqrt = Math.sqrt,
20	sin = Math.sin,
21	cos = Math.cos,
22	PI = Math.PI,
23	c1 = 1.70158,
24	c2 = c1 * 1.525,
25	c3 = c1 + 1,
26	c4 = ( 2 * PI ) / 3,
27	c5 = ( 2 * PI ) / 4.5;
28
29// x is the fraction of animation progress, in the range 0..1
30function bounceOut(x) {
31	var n1 = 7.5625,
32		d1 = 2.75;
33	if ( x < 1/d1 ) {
34		return n1*x*x;
35	} else if ( x < 2/d1 ) {
36		return n1*(x-=(1.5/d1))*x + .75;
37	} else if ( x < 2.5/d1 ) {
38		return n1*(x-=(2.25/d1))*x + .9375;
39	} else {
40		return n1*(x-=(2.625/d1))*x + .984375;
41	}
42}
43
44$.extend( $.easing,
45{
46	def: 'easeOutQuad',
47	swing: function (x) {
48		return $.easing[$.easing.def](x);
49	},
50	easeInQuad: function (x) {
51		return x * x;
52	},
53	easeOutQuad: function (x) {
54		return 1 - ( 1 - x ) * ( 1 - x );
55	},
56	easeInOutQuad: function (x) {
57		return x < 0.5 ?
58			2 * x * x :
59			1 - pow( -2 * x + 2, 2 ) / 2;
60	},
61	easeInCubic: function (x) {
62		return x * x * x;
63	},
64	easeOutCubic: function (x) {
65		return 1 - pow( 1 - x, 3 );
66	},
67	easeInOutCubic: function (x) {
68		return x < 0.5 ?
69			4 * x * x * x :
70			1 - pow( -2 * x + 2, 3 ) / 2;
71	},
72	easeInQuart: function (x) {
73		return x * x * x * x;
74	},
75	easeOutQuart: function (x) {
76		return 1 - pow( 1 - x, 4 );
77	},
78	easeInOutQuart: function (x) {
79		return x < 0.5 ?
80			8 * x * x * x * x :
81			1 - pow( -2 * x + 2, 4 ) / 2;
82	},
83	easeInQuint: function (x) {
84		return x * x * x * x * x;
85	},
86	easeOutQuint: function (x) {
87		return 1 - pow( 1 - x, 5 );
88	},
89	easeInOutQuint: function (x) {
90		return x < 0.5 ?
91			16 * x * x * x * x * x :
92			1 - pow( -2 * x + 2, 5 ) / 2;
93	},
94	easeInSine: function (x) {
95		return 1 - cos( x * PI/2 );
96	},
97	easeOutSine: function (x) {
98		return sin( x * PI/2 );
99	},
100	easeInOutSine: function (x) {
101		return -( cos( PI * x ) - 1 ) / 2;
102	},
103	easeInExpo: function (x) {
104		return x === 0 ? 0 : pow( 2, 10 * x - 10 );
105	},
106	easeOutExpo: function (x) {
107		return x === 1 ? 1 : 1 - pow( 2, -10 * x );
108	},
109	easeInOutExpo: function (x) {
110		return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
111			pow( 2, 20 * x - 10 ) / 2 :
112			( 2 - pow( 2, -20 * x + 10 ) ) / 2;
113	},
114	easeInCirc: function (x) {
115		return 1 - sqrt( 1 - pow( x, 2 ) );
116	},
117	easeOutCirc: function (x) {
118		return sqrt( 1 - pow( x - 1, 2 ) );
119	},
120	easeInOutCirc: function (x) {
121		return x < 0.5 ?
122			( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
123			( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
124	},
125	easeInElastic: function (x) {
126		return x === 0 ? 0 : x === 1 ? 1 :
127			-pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
128	},
129	easeOutElastic: function (x) {
130		return x === 0 ? 0 : x === 1 ? 1 :
131			pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
132	},
133	easeInOutElastic: function (x) {
134		return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
135			-( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
136			pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
137	},
138	easeInBack: function (x) {
139		return c3 * x * x * x - c1 * x * x;
140	},
141	easeOutBack: function (x) {
142		return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
143	},
144	easeInOutBack: function (x) {
145		return x < 0.5 ?
146			( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
147			( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
148	},
149	easeInBounce: function (x) {
150		return 1 - bounceOut( 1 - x );
151	},
152	easeOutBounce: bounceOut,
153	easeInOutBounce: function (x) {
154		return x < 0.5 ?
155			( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
156			( 1 + bounceOut( 2 * x - 1 ) ) / 2;
157	}
158});
159
160});

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.