<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>纯CSS3弹性圆形波纹动画特效</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #222;
overflow: hidden;
font-family: 'Arial', sans-serif;
}
.container {
position: relative;
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.ripple {
position: relative;
width: 150px;
height: 150px;
display: flex;
justify-content: center;
align-items: center;
}
.ripple span {
position: absolute;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.1);
border: 2px solid rgba(255, 255, 255, 0.5);
animation: animate 3s linear infinite;
animation-delay: calc(-0.5s * var(--i));
}
.ripple span:nth-child(1) {
--i: 1;
}
.ripple span:nth-child(2) {
--i: 2;
}
.ripple span:nth-child(3) {
--i: 3;
}
.ripple span:nth-child(4) {
--i: 4;
}
.ripple span:nth-child(5) {
--i: 5;
}
@keyframes animate {
0% {
width: 0;
height: 0;
opacity: 1;
}
100% {
width: 150px;
height: 150px;
opacity: 0;
}
}
.center-circle {
position: absolute;
width: 50px;
height: 50px;
background: linear-gradient(45deg, #ff00cc, #3333ff);
border-radius: 50%;
z-index: 10;
box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
}
70% {
transform: scale(1.1);
box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
}
100% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
}
}
.credit {
position: absolute;
bottom: 20px;
color: rgba(255, 255, 255, 0.7);
font-size: 14px;
text-align: center;
width: 100%;
}
.credit a {
color: #ff00cc;
text-decoration: none;
transition: color 0.3s;
}
.credit a:hover {
color: #3333ff;
}
/* 添加更多波纹效果 */
.ripple-2 {
position: absolute;
width: 300px;
height: 300px;
opacity: 0.5;
}
.ripple-2 span {
animation-delay: calc(-0.8s * var(--i));
}
.ripple-3 {
position: absolute;
width: 200px;
height: 200px;
opacity: 0.3;
}
.ripple-3 span {
animation-delay: calc(-1.2s * var(--i));
}
</style>
</head>
<body>
<div class="container">
<div class="ripple">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="ripple ripple-2">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="ripple ripple-3">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="center-circle"></div>
<div class="credit">
</div>
</div>
</body>
</html>