Html文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Loading</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="loading"></div>
<div class="loading-title">加载中</div>
</body>
</html>
CSS文件:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #000;
}
.loading {
position: relative;
width: 200px;
height: 200px;
background: linear-gradient(45deg,
transparent,transparent 40%,#e5f403);
border-radius: 50%;
animation: animate 2s linear infinite;
}
@keyframes animate {
0% {
transform: rotate(0deg);
filter: hue-rotate(0deg);
}
100% {
transform: rotate(360deg);
filter: hue-rotate(360deg);
}
}
.loading::before {
content: '';
position: absolute;
top: 8px;
left: 8px;
bottom: 8px;
right: 8px;
background: #000000;
border-radius: 50%;
z-index: 100;
}
.loading::after {
content: '';
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
background: #000;
background: linear-gradient(45deg,
transparent,transparent 40%,#e5f403);
border-radius: 50%;
z-index: 1;
filter: blur(30px);
}
.loading-title {
position: absolute;
font-size: 18px;
animation: title-animation 2s linear infinite;
}
@keyframes title-animation {
0% {
color: #fff;
filter: blur(1px) hue-rotate(0deg);
text-shadow: 0 0 10px #e5f403,
0 0 20px #e5f403,
0 0 40px #e5f403;
}
100% {
color: #fff;
filter: blur(1px) hue-rotate(360deg);
text-shadow: 0 0 10px #e5f403,
0 0 20px #e5f403,
0 0 40px #e5f403;
}
}
效果如下:
![](https://i-blog.csdnimg.cn/blog_migrate/ed412b8b4ce6e1bd974620b63fb22d2d.gif#pic_center)