Skip to content

Commit 5983139

Browse files
committed
feat: change animated props
1 parent 91d8c3a commit 5983139

File tree

1 file changed

+62
-37
lines changed

1 file changed

+62
-37
lines changed

src/components/Toaster/ToastList/ToastAnimation.scss

Lines changed: 62 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
@use '../../variables';
2+
@use './variables' as toastList;
23

34
$transition-distance: 10px;
45
$animation-duration: 0.6s;
6+
$animation-diration-alternate: 0.75s;
57

68
@mixin hidden-toast-height {
79
margin-block-end: 0;
@@ -42,6 +44,11 @@ $animation-duration: 0.6s;
4244
position: absolute;
4345
}
4446

47+
&_enter#{&}_feature_alternate-animation-timing-fn {
48+
opacity: 0.5;
49+
transform: translateX(calc(100% + #{toastList.$list-inset-end-position * 2}));
50+
}
51+
4552
&_enter_active {
4653
animation: #{variables.$ns}toast-enter-#{$platform}
4754
$animation-duration
@@ -54,50 +61,57 @@ $animation-duration: 0.6s;
5461
}
5562
}
5663

64+
// Alternative animation timing function
65+
&_enter_active#{&}_feature_alternate-animation-timing-fn {
66+
animation: #{variables.$ns}toast-enter-alternate-#{$platform}
67+
$animation-diration-alternate
68+
linear(
69+
0,
70+
0.002 0.3%,
71+
0.007 0.6%,
72+
0.033 1.3%,
73+
0.073 2%,
74+
0.125 2.7%,
75+
0.254 4.1%,
76+
0.683 8.3%,
77+
0.803 9.7%,
78+
0.897 11%,
79+
0.977 12.4%,
80+
1.036 13.8%,
81+
1.058 14.5%,
82+
1.078 15.3%,
83+
1.091 16%,
84+
1.101 16.8%,
85+
1.106 17.5%,
86+
1.108 18.3%,
87+
1.107 19.2%,
88+
1.103 20.1%,
89+
1.089 21.8%,
90+
1.038 26.5%,
91+
1.014 29.1%,
92+
1.005 30.5%,
93+
0.997 32%,
94+
0.992 33.5%,
95+
0.989 35.1%,
96+
0.989 38.6%,
97+
0.998 47.4%,
98+
1.001 53.2%,
99+
1
100+
)
101+
forwards;
102+
103+
@media (prefers-reduced-motion: reduce) {
104+
animation-name: #{variables.$ns}toast-enter-reduced-motion;
105+
}
106+
}
107+
57108
&_exit_active {
58109
animation: #{variables.$ns}toast-exit-#{$platform} $animation-duration ease-in forwards;
59110

60111
@media (prefers-reduced-motion: reduce) {
61112
animation-name: #{variables.$ns}toast-exit-reduced-motion;
62113
}
63114
}
64-
65-
// Alternative animation timing function
66-
&_feature_alternate-animation-timing-fn {
67-
animation-timing-function: linear(
68-
0,
69-
0.002 0.3%,
70-
0.007 0.6%,
71-
0.033 1.3%,
72-
0.073 2%,
73-
0.125 2.7%,
74-
0.254 4.1%,
75-
0.683 8.3%,
76-
0.803 9.7%,
77-
0.897 11%,
78-
0.977 12.4%,
79-
1.036 13.8%,
80-
1.058 14.5%,
81-
1.078 15.3%,
82-
1.091 16%,
83-
1.101 16.8%,
84-
1.106 17.5%,
85-
1.108 18.3%,
86-
1.107 19.2%,
87-
1.103 20.1%,
88-
1.089 21.8%,
89-
1.038 26.5%,
90-
1.014 29.1%,
91-
1.005 30.5%,
92-
0.997 32%,
93-
0.992 33.5%,
94-
0.989 35.1%,
95-
0.989 38.6%,
96-
0.998 47.4%,
97-
1.001 53.2%,
98-
1
99-
);
100-
}
101115
}
102116

103117
@keyframes #{variables.$ns}toast-enter-#{$platform} {
@@ -136,6 +150,17 @@ $animation-duration: 0.6s;
136150
}
137151
}
138152

153+
@keyframes #{variables.$ns}toast-enter-alternate-#{$platform} {
154+
0% {
155+
opacity: 0.5;
156+
transform: translateX(calc(100% + #{toastList.$list-inset-end-position * 2}));
157+
}
158+
100% {
159+
opacity: 1;
160+
transform: translateX(0);
161+
}
162+
}
163+
139164
@keyframes #{variables.$ns}toast-enter-reduced-motion {
140165
0% {
141166
@include hidden-toast-opacity;

0 commit comments

Comments
 (0)