Skip to content

Commit 9a346d5

Browse files
committed
feat (Abstract easings) : normalize name, add exemple of use
1 parent d75fe98 commit 9a346d5

File tree

1 file changed

+59
-12
lines changed

1 file changed

+59
-12
lines changed

src/scss/abstract/_f-easings.scss

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,56 @@
11
/**
22
* Easings
33
*
4-
* converted from source: https://github.com/ai/eamath-sings.net/blob/master/src/eamath-sings/eamath-singsFunctions.ts
4+
* converted from source: https://github.com/ai/eamath-sings.net/blob/master/src/eamath-sings/eamath-singsFunctions.ts
5+
* each ease receive a value $x in a range of 0 to 1
56
*
6-
* each ease receive a value $x in a range of 0 to 1
7+
* exemples :
8+
*
9+
* @for (dollar)i from 0 through 10 {
10+
* .test {
11+
* transition-delay: #{ease-out-cubic((dollar)i / 10)}s;
12+
* }
13+
* }
14+
*
15+
* ease-in-quad
16+
* ease-out-quad
17+
* ease-in-out-quad
18+
*
19+
* ease-in-cubic
20+
* ease-out-cubic
21+
* ease-in-out-cubic
22+
*
23+
* ease-in-quart
24+
* ease-out-quart
25+
* ease-in-out-quart
26+
*
27+
* ease-in-quint
28+
* ease-out-quint
29+
* ease-in-out-quint
30+
*
31+
* ease-in-sine
32+
* ease-out-sine
33+
* ease-in-out-sine
34+
*
35+
* ease-in-expo
36+
* ease-out-expo
37+
* ease-in-out-expo
38+
*
39+
* ease-in-circ
40+
* ease-out-circ
41+
* ease-in-out-circ
42+
*
43+
* ease-in-back
44+
* ease-out-back
45+
* ease-in-out-back
46+
*
47+
* ease-in-elastic
48+
* ease-out-elastic
49+
* ease-in-out-elastic
50+
*
51+
* ease-in-bounce
52+
* ease-out-bounce
53+
* ease-in-out-bounce
754
*
855
*/
956
$easings-const-c1: 1.70158;
@@ -144,15 +191,15 @@ $easings-const-c5: (2 * math-pi()) / 4.5;
144191
// Circ
145192
// ==========
146193

147-
@function ease-in-Circ($x) {
194+
@function ease-in-circ($x) {
148195
@return 1 - math-sqrt(1 - math-pow($x, 2));
149196
}
150197

151-
@function ease-out-Circ($x) {
198+
@function ease-out-circ($x) {
152199
@return math-sqrt(1 - math-pow($x - 1, 2));
153200
}
154201

155-
@function ease-in-out-Circ($x) {
202+
@function ease-in-out-circ($x) {
156203
@if ($x < .5) {
157204
@return (1 - math-sqrt(1 - math-pow(2 * $x, 2))) / 2;
158205
} @else {
@@ -164,15 +211,15 @@ $easings-const-c5: (2 * math-pi()) / 4.5;
164211
// Back
165212
// ==========
166213

167-
@function ease-in-Back($x) {
214+
@function ease-in-back($x) {
168215
@return $easings-const-c3 * $x * $x * $x - $easings-const-c1 * $x * $x;
169216
}
170217

171-
@function ease-out-Back($x) {
218+
@function ease-out-back($x) {
172219
@return 1 + $easings-const-c3 * math-pow($x - 1, 3) + $easings-const-c1 * math-pow($x - 1, 2);
173220
}
174221

175-
@function ease-in-out-Back($x) {
222+
@function ease-in-out-back($x) {
176223
@if ($x < .5) {
177224
@return (math-pow(2 * $x, 2) * (($easings-const-c2 + 1) * 2 * $x - $easings-const-c2)) / 2;
178225
} @else {
@@ -184,7 +231,7 @@ $easings-const-c5: (2 * math-pi()) / 4.5;
184231
// Elastic
185232
// ==========
186233

187-
@function ease-in-Elastic($x) {
234+
@function ease-in-elastic($x) {
188235
@if ($x == 0) {
189236
@return 0;
190237
} @else if ($x == 1) {
@@ -194,7 +241,7 @@ $easings-const-c5: (2 * math-pi()) / 4.5;
194241
}
195242
}
196243

197-
@function ease-out-Elastic($x) {
244+
@function ease-out-elastic($x) {
198245
@if ($x == 0) {
199246
@return 0;
200247
} @else if ($x == 1) {
@@ -204,7 +251,7 @@ $easings-const-c5: (2 * math-pi()) / 4.5;
204251
}
205252
}
206253

207-
@function ease-in-out-Elastic($x) {
254+
@function ease-in-out-elastic($x) {
208255
@if ($x == 0) {
209256
@return 0;
210257
} @else if ($x == 1) {
@@ -242,7 +289,7 @@ $easings-const-c5: (2 * math-pi()) / 4.5;
242289
}
243290
}
244291

245-
@function ease-in-out-Bounce($x) {
292+
@function ease-in-out-bounce($x) {
246293
@if ($x < .5) {
247294
@return (1 - ease-out-bounce(1 - 2 * $x)) / 2;
248295
} @else {

0 commit comments

Comments
 (0)