效果图
<!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>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100vw;
height: 100vw;
display: flex;
justify-content: center;
background-color: #00a8ff;
}
#font{
display: flex;
justify-content: center;
}
#water{
margin-top: 200px;
width: 300px;
height: 300px;
border-radius: 52% 48% 40% 60% / 28% 49% 51% 72% ;
box-shadow: inset 10px 20px 30px rgba(0, 0, 0, 0.5),
10px 10px 20px rgba(0, 0, 0, 0.3),
15px 15px 30px rgba(0, 0, 0, 0.05),
inset -10px -10px 15px rgba(255, 255, 255, 0.8);
animation: action 3s linear infinite alternate;
}
#water_after{
animation: action1 3s linear infinite alternate;
content: "";
width: 20px;
height: 20px;
position: absolute;
top: 240px;
left: 48%;
background-color:rgba(255, 255, 255, 0.5);
border-radius: 22% 78% 85% 15% / 28% 49% 51% 72% ;
}
#water_before{
animation: action2 10s linear infinite alternate;
content: "";
width: 10px;
height: 10px;
position: absolute;
top: 240px;
left: 45%;
background-color:rgba(255, 255, 255, 0.8);
border-radius: 67% 33% 85% 15% / 50% 28% 72% 50% ;
}
@keyframes action{
25%{
border-radius: 67% 33% 85% 15% / 50% 63% 37% 50% ;
}
50%{
border-radius: 45% 55% 15% 85% / 28% 37% 63% 72% ;
}
75%{
border-radius: 38% 62% 75% 25% / 42% 21% 79% 58% ;
}
100%{
border-radius: 51% 49% 49% 51% / 51% 54% 46% 49% ;
}
}
@keyframes action1{
25%{
border-radius: 31% 69% 82% 18% / 36% 61% 39% 64% ;
}
50%{
border-radius: 31% 69% 19% 81% / 36% 36% 64% 64% ;
}
75%{
border-radius: 63% 37% 33% 67% / 36% 36% 64% 64% ;
}
100%{
border-radius: 31% 69% 42% 58% / 36% 36% 64% 64% ;
}
}
@keyframes action2{
25%{
border-radius: 3% 97% 42% 58% / 36% 9% 91% 64% ;
left: 45%;
top: 240px;
}
50%{
left: 45%;
top: 340px;
border-radius: 3% 97% 78% 22% / 62% 24% 76% 38% ;
}
75%{
left: 55%;
top: 240px;
border-radius: 3% 97% 28% 72% / 72% 14% 86% 28% ;
}
100%{
left: 45%;
top: 340px;
border-radius: 57% 43% 64% 36% / 72% 14% 86% 28% ;
}
}
</style>
</head>
<body>
<div id="font">
</div>
<div id="water">
<div style="margin-top: -144px;margin-left: 55px;font-size: 20px;font-weight: bold;">
<p>纯CSS模仿水滴效果</p>
</div>
<div id="water_after">
</div>
<div id="water_before">
</div>
</div>
</body>
</html>