效果如下
<!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>盆中那摇晃的水</title>
<style>
.container {
position: relative;
width: 300px;
height: 100px;
}
.container .basin {
position: absolute;
height: 100%;
width: 100%;
left: 25%;
box-sizing: border-box;
border-radius: 0 0 20px 20px;
border: 3px solid slategrey;
border-top: none;
overflow: hidden;
}
.container .basin:before {
content: '';
position: absolute;
width: 100%;
height: 0px;
border-radius: 100%;
border: 5px solid silver;
top: -4px;
left: -3px;
}
.container .basin .water {
position: absolute;
left: -25%;
bottom: -365%;
height: 440%;
width: 150%;
border-radius: 80% 85% 75% 100%;
background: #00E8FF;
animation: spin linear 3s infinite;
opacity: 0.8;
}
.container .basin .water:nth-child(2) {
animation: spin linear 10s infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* 盆沿 */
.container::before,.container::after{
content: '';
display: block;
position: absolute;
width: 20px;
height: 20px;
border-radius: 70%;
border: none;
border-top: 3px solid slategrey;
}
.container::before{
top: -3px;
right: -92px;
}
.container::after{
top: -3px;
left: 58px;
}
</style>
</head>
<body>
<div class="container">
<!-- 盆 -->
<div class="basin">
<!-- 通过两个不规则圆形的水的旋转做出晃荡的水面 -->
<div class="water"></div>
<div class="water"></div>
</div>
</div>
</body>
</html>