|
| 1 | +@positions: center, top, left, right, bottom; |
| 2 | +@animationPostions: { |
| 3 | + top: translate3d(0, -100%, 0); |
| 4 | + left: translate3d(-100%, 0, 0); |
| 5 | + right: translate3d(100%, 0, 0); |
| 6 | + bottom: translate3d(0, 100%, 0); |
| 7 | +}; |
| 8 | + |
| 9 | +// 不同位置的动画使用 |
| 10 | +each(@positions,{ |
| 11 | + .popup-fade-@{value}-active-show{ |
| 12 | + animation: ~'popup-@{value}-fadein 0.3s forwards'; |
| 13 | + } |
| 14 | + |
| 15 | + .popup-fade-@{value}-active-hide{ |
| 16 | + animation: ~'popup-@{value}-fadeout 0.3s forwards'; |
| 17 | + } |
| 18 | + |
| 19 | +}); |
| 20 | + |
| 21 | +// 不同位置的动画定义 |
| 22 | +each(@animationPostions,{ |
| 23 | + @keyframes ~'popup-@{key}-fadein' { |
| 24 | + 0% { |
| 25 | + transform: @value; |
| 26 | + opacity: 0; |
| 27 | + } |
| 28 | + |
| 29 | + 100% { |
| 30 | + transform: translate3d(0, 0, 0); |
| 31 | + opacity: 1; |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + @keyframes ~'popup-@{key}-fadeout' { |
| 36 | + 0% { |
| 37 | + transform: translate3d(0, 0, 0); |
| 38 | + opacity: 1; |
| 39 | + } |
| 40 | + |
| 41 | + 100% { |
| 42 | + transform: @value; |
| 43 | + opacity: 0.1; |
| 44 | + } |
| 45 | + } |
| 46 | +}); |
| 47 | + |
| 48 | +@keyframes popup-center-fadein { |
| 49 | + 0% { |
| 50 | + transform: scale(0.8); |
| 51 | + opacity: 0; |
| 52 | + } |
| 53 | + |
| 54 | + 50% { |
| 55 | + transform: scale(1.1); |
| 56 | + } |
| 57 | + |
| 58 | + 100% { |
| 59 | + transform: scale(1); |
| 60 | + opacity: 1; |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +@keyframes popup-center-fadeout { |
| 65 | + 0% { |
| 66 | + transform: scale(1); |
| 67 | + opacity: 1; |
| 68 | + } |
| 69 | + |
| 70 | + 50% { |
| 71 | + transform: scale(1.1); |
| 72 | + } |
| 73 | + |
| 74 | + 100% { |
| 75 | + transform: scale(0.8); |
| 76 | + opacity: 0; |
| 77 | + } |
| 78 | +} |
| 79 | + |
1 | 80 | .container-popup { |
2 | 81 | visibility: hidden; |
3 | 82 | position: fixed; |
|
70 | 149 | flex-direction: column-reverse; |
71 | 150 | width: 100%; |
72 | 151 | } |
73 | | - |
74 | | -.popup-fade-center-active-show { |
75 | | - animation: popup-center-fadein 0.4s; |
76 | | -} |
77 | | - |
78 | | -.popup-fade-center-active-hide { |
79 | | - animation: popup-center-fadeout 0.4s; |
80 | | -} |
81 | | - |
82 | | -.popup-fade-top-active-show { |
83 | | - animation:popup-top-fadein 0.3s ease-in-out; |
84 | | -} |
85 | | - |
86 | | -.popup-fade-top-active-hide { |
87 | | - animation:popup-top-fadeout 0.3s ease-in-out; |
88 | | -} |
89 | | - |
90 | | -.popup-fade-right-active-show { |
91 | | - animation: popup-right-fadein 0.3s ease-in-out; |
92 | | -} |
93 | | - |
94 | | -.popup-fade-right-active-hide { |
95 | | - animation: popup-right-fadeout 0.3s ease-in-out; |
96 | | -} |
97 | | - |
98 | | -.popup-fade-left-active-show { |
99 | | - animation: popup-left-fadein 0.3s ease-in-out; |
100 | | -} |
101 | | - |
102 | | -.popup-fade-left-active-hide { |
103 | | - animation: popup-left-fadeout 0.3s ease-in-out; |
104 | | -} |
105 | | - |
106 | | -.popup-fade-bottom-active-show { |
107 | | - animation: popup-bottom-fadein 0.3s ease-in-out; |
108 | | -} |
109 | | - |
110 | | -.popup-fade-bottom-active-hide { |
111 | | - animation: popup-bottom-fadeout 0.3s ease-in-out; |
112 | | -} |
113 | | - |
114 | | -// .popup-fade-center-leave { |
115 | | -// opacity: 0; |
116 | | -// } |
117 | | - |
118 | | -@keyframes popup-center-fadein { |
119 | | - 0% { |
120 | | - transform: scale(0.8); |
121 | | - opacity: 0; |
122 | | - } |
123 | | - |
124 | | - 50% { |
125 | | - transform: scale(1.1); |
126 | | - } |
127 | | - |
128 | | - 100% { |
129 | | - transform: scale(1); |
130 | | - opacity: 1; |
131 | | - } |
132 | | -} |
133 | | - |
134 | | -@keyframes popup-center-fadeout { |
135 | | - 0% { |
136 | | - transform: scale(1); |
137 | | - opacity: 1; |
138 | | - } |
139 | | - |
140 | | - 50% { |
141 | | - transform: scale(1.1); |
142 | | - } |
143 | | - |
144 | | - 100% { |
145 | | - transform: scale(0.8); |
146 | | - opacity: 0; |
147 | | - } |
148 | | -} |
149 | | - |
150 | | -@keyframes popup-top-fadein { |
151 | | - 0% { |
152 | | - transform: translate3d(0, -100%, 0); |
153 | | - opacity: 0.1; |
154 | | - } |
155 | | - |
156 | | - 100% { |
157 | | - transform: translate3d(0, 0, 0); |
158 | | - opacity: 1; |
159 | | - } |
160 | | -} |
161 | | - |
162 | | -@keyframes popup-top-fadeout { |
163 | | - 0% { |
164 | | - transform: translate3d(0, 0, 0); |
165 | | - opacity: 1; |
166 | | - } |
167 | | - |
168 | | - 100% { |
169 | | - transform: translate3d(0, -100%, 0); |
170 | | - opacity: 0.1; |
171 | | - } |
172 | | -} |
173 | | - |
174 | | -@keyframes popup-left-fadein { |
175 | | - 0% { |
176 | | - transform: translate3d(-100%, 0, 0); |
177 | | - opacity: 0.1; |
178 | | - } |
179 | | - |
180 | | - |
181 | | - 100% { |
182 | | - transform: translate3d(0, 0, 0); |
183 | | - opacity: 1; |
184 | | - } |
185 | | -} |
186 | | - |
187 | | -@keyframes popup-left-fadeout { |
188 | | - 0% { |
189 | | - transform: translate3d(0, 0, 0); |
190 | | - opacity: 1; |
191 | | - } |
192 | | - |
193 | | - |
194 | | - 100% { |
195 | | - transform: translate3d(-100%, 0, 0); |
196 | | - opacity: 0.1; |
197 | | - } |
198 | | -} |
199 | | - |
200 | | - |
201 | | -@keyframes popup-right-fadein { |
202 | | - 0% { |
203 | | - transform: translate3d(100%, 0, 0); |
204 | | - opacity: 0.1; |
205 | | - } |
206 | | - |
207 | | - /* 50% { |
208 | | - transform: translate3d(25%, 0, 0); |
209 | | - opacity: 0.7; |
210 | | - } */ |
211 | | - |
212 | | - 100% { |
213 | | - transform: translate3d(0, 0, 0); |
214 | | - opacity: 1; |
215 | | - } |
216 | | -} |
217 | | - |
218 | | -@keyframes popup-right-fadeout { |
219 | | - 0% { |
220 | | - transform: translate3d(0, 0, 0); |
221 | | - opacity: 1; |
222 | | - } |
223 | | - |
224 | | - 100% { |
225 | | - transform: translate3d(100%, 0, 0); |
226 | | - opacity: 0.1; |
227 | | - } |
228 | | -} |
229 | | - |
230 | | -@keyframes popup-bottom-fadein { |
231 | | - 0% { |
232 | | - transform: translate3d(0, 100%, 0); |
233 | | - opacity: 0; |
234 | | - |
235 | | - } |
236 | | - |
237 | | - |
238 | | - 100% { |
239 | | - transform: translate3d(0, 0, 0); |
240 | | - opacity: 1; |
241 | | - } |
242 | | -} |
243 | | - |
244 | | - |
245 | | -@keyframes popup-bottom-fadeout { |
246 | | - 0% { |
247 | | - transform: translate3d(0, 0, 0); |
248 | | - opacity: 1; |
249 | | - } |
250 | | - |
251 | | - |
252 | | - 100% { |
253 | | - transform: translate3d(0, 100%, 0); |
254 | | - opacity: 0.1; |
255 | | - } |
256 | | -} |
0 commit comments