纯CSS水滴效果

效果图

<!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>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值