1. 效果图

2.css
* {
margin: 0;
padding: 0;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #333;
overflow: hidden;
}
.loader {
position: relative;
width: 220px;
height: 220px;
transform-style: preserve-3d;
transform: perspective(500px) rotateX(60deg);
}
span {
position: absolute;
display: block;
border: 5px solid #fff;
border-radius: 50%;
box-shadow: 0 5px 0 #ccc, inset 0 5px 0 #ccc;
-webkit-animation: move 5s ease-in-out infinite;
animation: move 5s ease-in-out infinite;
}
@-webkit-keyframes move {
0%,
100% {
transform: translateZ(-100px);
}
50% {
transform: translateZ(100px);
}
}
@keyframes move {
0%,
100% {
transform: translateZ(-100px);
}
50% {
transform: translateZ(100px);
}
}
span:nth-child(1) {
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
span:nth-child(2) {
top: 20px;
left: 20px;
right: 20px;
bottom: 20px;
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
span:nth-child(3) {
top: 40px;
left: 40px;
right: 40px;
bottom: 40px;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
span:nth-child(4) {
top: 30px;
left: 30px;
right: 30px;
bottom: 30px;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
span:nth-child(5) {
top: 50px;
left: 50px;
right: 50px;
bottom: 50px;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
span:nth-child(6) {
top: 60px;
left: 60px;
right: 60px;
bottom: 60px;
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
}
span:nth-child(7) {
top: 70px;
left: 70px;
right: 70px;
bottom: 70px;
-webkit-animation-delay: 0.7s;
animation-delay: 0.7s;
}
span:nth-child(8) {
top: 80px;
left: 80px;
right: 80px;
bottom: 80px;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
span:nth-child(9) {
top: 90px;
left: 90px;
right: 90px;
bottom: 90px;
-webkit-animation-delay: 0.9s;
animation-delay: 0.9s;
}
span:nth-child(10) {
top: 100px;
left: 100px;
right: 100px;
bottom: 100px;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
span:nth-child(11) {
top: 110px;
left: 110px;
right: 110px;
bottom: 110px;
-webkit-animation-delay: 1.1s;
animation-delay: 1.1s;
}
3.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./index.css">
</head>
<body>
<div class="loader">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>