html:
<div class="wrap">
<div class="round"></div>
<div class="round"></div>
<div class="round"></div>
<div class="round"></div>
<div class="round"></div>
<div class="round"></div>
</div>
less
@ballConSize: 100px;
@littleBallConSize: 16px;
.wrap {
box-sizing: border-box;
width: @ballConSize;
height: @ballConSize;
margin-top: 150px;
margin-left: 150px;
position: relative;
border-radius: 50%;
.round {
border-radius: 50%;
position: absolute;
top: (@ballConSize/2);
left: (@ballConSize/2);
}
}
@keyframes loadingAni {
0%{
transform: rotate(0deg) translateY(-(@ballConSize/2));
transition-timing-function: ease-in;
}
100%{
transform: rotate(360deg) translateY(-(@ballConSize/2));
transition-timing-function: ease-in;
}
}
.loop(@i) when (@i <= 6) {
.round:nth-child(@{i}) {
width: @littleBallConSize * (0.4 + @i * 0.1);
height: @littleBallConSize * (0.4 + @i * 0.1);
margin-left: -(@littleBallConSize * (0.4 + @i * 0.1)/2);
margin-top: -(@littleBallConSize * (0.4 + @i * 0.1)/2);
background: rgb(199, 136, 185);
transform: translateY(-(@ballConSize/2));
animation: loadingAni 2s infinite;
animation-delay: -(0.1s * @i);
}
.loop(@i + 1)
}
.loop(1);
less转换后的CSS:
.wrap {
box-sizing: border-box;
width: 100px;
height: 100px;
margin-top: 150px;
margin-left: 150px;
position: relative;
border-radius: 50%;
}
.wrap .round {
border-radius: 50%;
position: absolute;
top: 50px;
left: 50px;
}
@keyframes loadingAni {
0% {
transform: rotate(0deg) translateY(-50px);
transition-timing-function: ease-in;
}
100% {
transform: rotate(360deg) translateY(-50px);
transition-timing-function: ease-in;
}
}
.round:nth-child(1) {
width: 8px;
height: 8px;
margin-left: -4px;
margin-top: -4px;
background: #c788b9;
transform: translateY(-50px);
animation: loadingAni 2s infinite;
animation-delay: -0.1s;
}
.round:nth-child(2) {
width: 9.6px;
height: 9.6px;
margin-left: -4.8px;
margin-top: -4.8px;
background: #c788b9;
transform: translateY(-50px);
animation: loadingAni 2s infinite;
animation-delay: -0.2s;
}
.round:nth-child(3) {
width: 11.2px;
height: 11.2px;
margin-left: -5.6px;
margin-top: -5.6px;
background: #c788b9;
transform: translateY(-50px);
animation: loadingAni 2s infinite;
animation-delay: -0.3s;
}
.round:nth-child(4) {
width: 12.8px;
height: 12.8px;
margin-left: -6.4px;
margin-top: -6.4px;
background: #c788b9;
transform: translateY(-50px);
animation: loadingAni 2s infinite;
animation-delay: -0.4s;
}
.round:nth-child(5) {
width: 14.4px;
height: 14.4px;
margin-left: -7.2px;
margin-top: -7.2px;
background: #c788b9;
transform: translateY(-50px);
animation: loadingAni 2s infinite;
animation-delay: -0.5s;
}
.round:nth-child(6) {
width: 16px;
height: 16px;
margin-left: -8px;
margin-top: -8px;
background: #c788b9;
transform: translateY(-50px);
animation: loadingAni 2s infinite;
animation-delay: -0.6s;
}
/*# sourceMappingURL=loading5dot.css.map */