PageSourceSearch

https://zbchern.github.io/source/jquery.easing.min.js

js zbchern.github.io collected 2026-10-03 10:14:15 UTC 4,397 bytes, 131 lines download raw bytes

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

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.