这是一个纯CSS实现的Loading特效,它由5个圆形组成,每个圆形在不同的时间点开始旋转,并在不同的速度上旋转,创造出一个动态而又和谐的效果。该特效通过使用CSS3动画和渐变属性实现,代码简洁,易于理解和修改。该特效可用于各种网站和应用程序中,为用户提供更好的等待体验。
<div class="loading">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<style>
.loading,
.loading > div {
position: relative;
box-sizing: border-box;
}
.loading {
display: block;
font-size: 0;
color: #000;
}
.loading.la-dark {
color: #333;
}
.loading > div {
display: inline-block;
float: none;
background-color: currentColor;
border: 0 solid currentColor;
}
.loading {
width: 16px;
height: 16px;
}
.loading > div {
position: absolute;
top: 0;
left: -100%;
display: block;
width: 16px;
width: 100%;
height: 16px;
height: 100%;
border-radius: 100%;
opacity: 0.5;
animation: ball-circus-position 2.5s infinite cubic-bezier(0.25, 0, 0.75, 1),
ball-circus-size 2.5s infinite cubic-bezier(0.25, 0, 0.75, 1);
}
.loading > div:nth-child(1) {
animation-delay: 0s, -0.5s;
}
.loading > div:nth-child(2) {
animation-delay: -0.5s, -1s;
}
.loading > div:nth-child(3) {
animation-delay: -1s, -1.5s;
}
.loading > div:nth-child(4) {
animation-delay: -1.5s, -2s;
}
.loading > div:nth-child(5) {
animation-delay: -2s, -2.5s;
}
@keyframes ball-circus-position {
50% {
left: 100%;
}
}
@keyframes ball-circus-size {
50% {
transform: scale(0.3, 0.3);
}
}
</style>