-
Notifications
You must be signed in to change notification settings - Fork 323
Expand file tree
/
Copy pathloading.less
More file actions
228 lines (192 loc) · 4.39 KB
/
loading.less
File metadata and controls
228 lines (192 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
@import '../common/style/base.less';
@loading: ~'@{prefix}-loading';
@loading-color: var(--td-loading-color, @brand-color);
@loading-text-color: var(--td-loading-text-color, @text-color-primary);
@loading-text-font: var(--td-loading-text-font, @font-body-small);
@loading-z-index: var(--td-loading-z-index, 3500);
@loading-full-bg-color: var(--td-loading-full-bg-color, rgba(255, 255, 255, 0.6));
.@{loading} {
display: inline-flex;
align-items: center;
justify-content: center;
&--fullscreen {
position: fixed;
display: flex;
align-items: center;
vertical-align: middle;
justify-content: center;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: @loading-z-index;
background-color: @loading-full-bg-color;
}
&__spinner {
position: relative;
box-sizing: border-box;
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
animation: rotate 0.8s linear infinite;
color: @loading-color;
&.reverse {
animation-name: rotateReverse;
}
&--spinner {
animation-timing-function: steps(12);
color: @text-color-primary;
.@{loading}__dot {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
&::before {
display: block;
width: 5rpx;
height: 25%;
margin: 0 auto;
background-color: @loading-color;
border-radius: 40%;
content: ' ';
}
}
}
&--circular {
.@{loading}__circular {
border-radius: 100%;
width: 100%;
height: 100%;
background: conic-gradient(
from 180deg at 50% 50%,
rgba(255, 255, 255, 0) 0deg,
rgba(255, 255, 255, 0) 60deg,
@loading-color 330deg,
rgba(255, 255, 255, 0) 360deg
);
// skyline 下,1. mask 不支持渐变只支持图片;2. conic-gradient() 多层渐变效果不符合预期。问题一:改用伪元素+背景色实现,背景色灵活性会降低,待支持渐变后建议恢复用 mask 实现。问题二:待定
// skyline: ✅ mask-image: image(url("xx"));
// skyline: ❌ mask-image: linear-gradient(x);
// mask: radial-gradient(transparent calc(50% - 1rpx), #fff 50%);
// /* stylelint-disable-next-line */
// -webkit-mask: radial-gradient(transparent calc(50% - 1rpx), #fff 50%);
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 100%;
background-color: @bg-color-container;
width: 70%;
height: 70%;
}
}
}
&--dots {
display: flex;
justify-content: space-between;
align-items: center;
animation: none;
.@{loading}__dot {
width: 20%;
height: 20%;
border-radius: 50%;
background-color: @loading-color;
animation-duration: 1.8s;
animation-name: dotting;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-fill-mode: both;
}
}
}
&__text {
color: @loading-text-color;
font: @loading-text-font;
&--vertical:not(:first-child):not(:empty) {
margin-top: 12rpx;
}
&--horizontal:not(:first-child):not(:empty) {
margin-left: 16rpx;
}
}
&--vertical {
flex-direction: column;
}
&--horizontal {
flex-direction: row;
vertical-align: top;
}
}
@keyframes t-bar {
0% {
width: 0;
}
50% {
width: 70%;
}
100% {
width: 80%;
}
}
@keyframes t-bar-loaded {
0% {
height: 6rpx;
opacity: 1;
width: 90%;
}
50% {
height: 6rpx;
opacity: 1;
width: 100%;
}
100% {
height: 0;
opacity: 0;
width: 100%;
}
}
.generate(@n, @i: 1) when (@i =< @n) {
.@{loading}__dot-@{i} {
transform: rotate(@i * 30deg);
opacity: (1 / 12) * (@i - 1);
}
.generate(@n, (@i + 1));
}
.generate(12);
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes rotateReverse {
from {
transform: rotate(360deg);
}
to {
transform: rotate(0deg);
}
}
@keyframes dotting {
0% {
opacity: 0.15;
}
1% {
opacity: 0.8;
}
33% {
opacity: 0.8;
}
34% {
opacity: 0.15;
}
100% {
opacity: 0.15;
}
}