css制作水滴
使用CSS制作水滴效果
水滴效果可以通过CSS的border-radius属性和渐变背景实现。以下是一个简单的实现方法:

<div class="water-drop"></div>
.water-drop {
width: 100px;
height: 100px;
background: radial-gradient(circle at 30% 30%,
rgba(255, 255, 255, 0.8) 0%,
rgba(0, 120, 255, 0.6) 50%,
rgba(0, 80, 220, 0.8) 100%);
border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
box-shadow: 0 0 20px rgba(0, 120, 255, 0.5);
position: relative;
}
添加水滴高光效果
.water-drop::before {
content: "";
position: absolute;
width: 20px;
height: 20px;
background: rgba(255, 255, 255, 0.8);
border-radius: 50%;
top: 15px;
left: 25px;
filter: blur(2px);
}
创建水滴下落动画
@keyframes drop {
0% {
transform: translateY(0) scale(1);
opacity: 1;
}
80% {
transform: translateY(200px) scale(0.8);
opacity: 0.8;
}
100% {
transform: translateY(250px) scale(0);
opacity: 0;
}
}
.water-drop {
animation: drop 2s infinite ease-in;
}
制作水滴溅起效果
<div class="splash">
<div class="droplet"></div>
<div class="droplet"></div>
<div class="droplet"></div>
</div>
.splash {
position: relative;
width: 100px;
height: 100px;
}
.droplet {
position: absolute;
width: 15px;
height: 15px;
background: rgba(0, 120, 255, 0.6);
border-radius: 50%;
}
.droplet:nth-child(1) {
top: 50px;
left: 40px;
animation: splash 1s infinite;
}
.droplet:nth-child(2) {
top: 45px;
left: 50px;
animation: splash 1.2s infinite;
}
.droplet:nth-child(3) {
top: 55px;
left: 30px;
animation: splash 0.8s infinite;
}
@keyframes splash {
0% {
transform: translate(0, 0) scale(1);
opacity: 1;
}
100% {
transform: translate(20px, -30px) scale(0);
opacity: 0;
}
}
响应式水滴效果
.water-drop {
width: 10vw;
height: 10vw;
max-width: 150px;
max-height: 150px;
min-width: 50px;
min-height: 50px;
}
这些CSS技巧可以组合使用,创建出逼真的水滴效果。通过调整颜色、大小和动画参数,可以获得不同风格的水滴视觉效果。






