1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | var internal = require('../internal/index.js');
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | function backInOut(t) {
|
12 | const s = 1.70158 * 1.525;
|
13 | if ((t *= 2) < 1)
|
14 | return 0.5 * (t * t * ((s + 1) * t - s));
|
15 | return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);
|
16 | }
|
17 | function backIn(t) {
|
18 | const s = 1.70158;
|
19 | return t * t * ((s + 1) * t - s);
|
20 | }
|
21 | function backOut(t) {
|
22 | const s = 1.70158;
|
23 | return --t * t * ((s + 1) * t + s) + 1;
|
24 | }
|
25 | function bounceOut(t) {
|
26 | const a = 4.0 / 11.0;
|
27 | const b = 8.0 / 11.0;
|
28 | const c = 9.0 / 10.0;
|
29 | const ca = 4356.0 / 361.0;
|
30 | const cb = 35442.0 / 1805.0;
|
31 | const cc = 16061.0 / 1805.0;
|
32 | const t2 = t * t;
|
33 | return t < a
|
34 | ? 7.5625 * t2
|
35 | : t < b
|
36 | ? 9.075 * t2 - 9.9 * t + 3.4
|
37 | : t < c
|
38 | ? ca * t2 - cb * t + cc
|
39 | : 10.8 * t * t - 20.52 * t + 10.72;
|
40 | }
|
41 | function bounceInOut(t) {
|
42 | return t < 0.5
|
43 | ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0))
|
44 | : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5;
|
45 | }
|
46 | function bounceIn(t) {
|
47 | return 1.0 - bounceOut(1.0 - t);
|
48 | }
|
49 | function circInOut(t) {
|
50 | if ((t *= 2) < 1)
|
51 | return -0.5 * (Math.sqrt(1 - t * t) - 1);
|
52 | return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
|
53 | }
|
54 | function circIn(t) {
|
55 | return 1.0 - Math.sqrt(1.0 - t * t);
|
56 | }
|
57 | function circOut(t) {
|
58 | return Math.sqrt(1 - --t * t);
|
59 | }
|
60 | function cubicInOut(t) {
|
61 | return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0;
|
62 | }
|
63 | function cubicIn(t) {
|
64 | return t * t * t;
|
65 | }
|
66 | function cubicOut(t) {
|
67 | const f = t - 1.0;
|
68 | return f * f * f + 1.0;
|
69 | }
|
70 | function elasticInOut(t) {
|
71 | return t < 0.5
|
72 | ? 0.5 *
|
73 | Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) *
|
74 | Math.pow(2.0, 10.0 * (2.0 * t - 1.0))
|
75 | : 0.5 *
|
76 | Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) *
|
77 | Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) +
|
78 | 1.0;
|
79 | }
|
80 | function elasticIn(t) {
|
81 | return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0));
|
82 | }
|
83 | function elasticOut(t) {
|
84 | return (Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0);
|
85 | }
|
86 | function expoInOut(t) {
|
87 | return t === 0.0 || t === 1.0
|
88 | ? t
|
89 | : t < 0.5
|
90 | ? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)
|
91 | : -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;
|
92 | }
|
93 | function expoIn(t) {
|
94 | return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0));
|
95 | }
|
96 | function expoOut(t) {
|
97 | return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t);
|
98 | }
|
99 | function quadInOut(t) {
|
100 | t /= 0.5;
|
101 | if (t < 1)
|
102 | return 0.5 * t * t;
|
103 | t--;
|
104 | return -0.5 * (t * (t - 2) - 1);
|
105 | }
|
106 | function quadIn(t) {
|
107 | return t * t;
|
108 | }
|
109 | function quadOut(t) {
|
110 | return -t * (t - 2.0);
|
111 | }
|
112 | function quartInOut(t) {
|
113 | return t < 0.5
|
114 | ? +8.0 * Math.pow(t, 4.0)
|
115 | : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0;
|
116 | }
|
117 | function quartIn(t) {
|
118 | return Math.pow(t, 4.0);
|
119 | }
|
120 | function quartOut(t) {
|
121 | return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0;
|
122 | }
|
123 | function quintInOut(t) {
|
124 | if ((t *= 2) < 1)
|
125 | return 0.5 * t * t * t * t * t;
|
126 | return 0.5 * ((t -= 2) * t * t * t * t + 2);
|
127 | }
|
128 | function quintIn(t) {
|
129 | return t * t * t * t * t;
|
130 | }
|
131 | function quintOut(t) {
|
132 | return --t * t * t * t * t + 1;
|
133 | }
|
134 | function sineInOut(t) {
|
135 | return -0.5 * (Math.cos(Math.PI * t) - 1);
|
136 | }
|
137 | function sineIn(t) {
|
138 | const v = Math.cos(t * Math.PI * 0.5);
|
139 | if (Math.abs(v) < 1e-14)
|
140 | return 1;
|
141 | else
|
142 | return 1 - v;
|
143 | }
|
144 | function sineOut(t) {
|
145 | return Math.sin((t * Math.PI) / 2);
|
146 | }
|
147 |
|
148 | Object.defineProperty(exports, 'linear', {
|
149 | enumerable: true,
|
150 | get: function () {
|
151 | return internal.identity;
|
152 | }
|
153 | });
|
154 | exports.backIn = backIn;
|
155 | exports.backInOut = backInOut;
|
156 | exports.backOut = backOut;
|
157 | exports.bounceIn = bounceIn;
|
158 | exports.bounceInOut = bounceInOut;
|
159 | exports.bounceOut = bounceOut;
|
160 | exports.circIn = circIn;
|
161 | exports.circInOut = circInOut;
|
162 | exports.circOut = circOut;
|
163 | exports.cubicIn = cubicIn;
|
164 | exports.cubicInOut = cubicInOut;
|
165 | exports.cubicOut = cubicOut;
|
166 | exports.elasticIn = elasticIn;
|
167 | exports.elasticInOut = elasticInOut;
|
168 | exports.elasticOut = elasticOut;
|
169 | exports.expoIn = expoIn;
|
170 | exports.expoInOut = expoInOut;
|
171 | exports.expoOut = expoOut;
|
172 | exports.quadIn = quadIn;
|
173 | exports.quadInOut = quadInOut;
|
174 | exports.quadOut = quadOut;
|
175 | exports.quartIn = quartIn;
|
176 | exports.quartInOut = quartInOut;
|
177 | exports.quartOut = quartOut;
|
178 | exports.quintIn = quintIn;
|
179 | exports.quintInOut = quintInOut;
|
180 | exports.quintOut = quintOut;
|
181 | exports.sineIn = sineIn;
|
182 | exports.sineInOut = sineInOut;
|
183 | exports.sineOut = sineOut;
|