tdesign-mobile-vue
Version:
tdesign-mobile-vue
194 lines (161 loc) • 3.23 kB
text/less
@import "../../../base.less";
@import "./_var.less";
.@{loading} {
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 12px;
&__spinner {
position: relative;
box-sizing: border-box;
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
animation: rotate .8s linear infinite;
color: @loading-color;
&.reverse {
animation-name: rotateReverse;
}
&--spinner {
animation-timing-function: steps(12);
color: @loading-spinner-color;
.@{loading}__dot {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
&::before {
display: block;
width: 2.5px;
height: 25%;
margin: 0 auto;
background-color: currentColor;
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,
currentColor 330deg,
rgba(255, 255, 255, 0%) 360deg
);
mask: radial-gradient(transparent calc(50% - .5px), #fff 50%);
/* stylelint-disable-next-line */
-webkit-mask: radial-gradient(transparent calc(50% - .5px), #fff 50%);
}
}
&--dots {
display: flex;
justify-content: space-between;
align-items: center;
animation: none;
.@{loading}__dot {
width: 20%;
height: 20%;
border-radius: 50%;
background-color: currentColor;
animation-duration: 1.8s;
animation-name: dotting;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-fill-mode: both;
}
}
}
&__text {
font-size: @loading-text-font-size;
line-height: @loading-text-line-height;
&--vertical:not(:first-child):not(:empty) {
margin-top: 6px;
}
&--horizontal:not(:first-child):not(:empty) {
margin-left: 8px;
}
}
&--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: 3px;
opacity: 1;
width: 90%;
}
50% {
height: 3px;
opacity: 1;
width: 100%;
}
100% {
height: 0;
opacity: 0;
width: 100%;
}
}
.generate(@n, @i: 1) when (@i =< @n) {
.@{loading}__dot:nth-of-type(@{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: .15;
}
1% {
opacity: .8;
}
33% {
opacity: .8;
}
34% {
opacity: .15;
}
100% {
opacity: .15;
}
}