PageSourceSearch

https://kawaisugi.com/common/js/jquery.easing.js

js kawaisugi.com collected 2026-10-02 05:53:06 UTC 4,297 bytes, 168 lines download raw bytes

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

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.