使用CSS制作一个水滴充电特效

今天又学习了一个特效,有点类似安卓手机充电时的特效,就叫做水滴充电特效把

效果图:

 实现代码

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>水滴充电特效</title>
  <style>
    html{
      font-size: 10px;
    }
    *{
      margin: 0;
      padding: 0;
    }
    .container{
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      min-height: 100vh;
      background-color: #000;
      filter:contrast(50);
    }
    .drop{
      width: 20rem;
      height: 20rem;
      position: absolute;
      background-color: #3bff5a;
      border-radius: 50%;
      filter: blur(20px);
      opacity: 0;
      animation: 3s drop linear infinite;
      transform: scale(1.2) translateY(-500%);
    }
    .drop:nth-child(2){
      animation-delay: 0.8s;
    }
    .drop:nth-child(3){
      animation-delay: 1.1s;
    }
    .collection{
      width: 20rem;
      height: 20rem;
      background-color:#3bff5a;
      border-radius: 50%;
      filter: blur(20px);
      animation: 5s collection linear infinite;

    }
    .container span{
      position: absolute;
      font-size: 2.5rem;
      font-family: 'Helvetica Neue', Hel;
      font-weight: bold;
    }
    @keyframes drop {
      0%{
        opacity: 0;
        transform: scale(1) translateY(-600%);
      }
      50%{
        opacity: 1;
        transform: scale(.5) translateY(-100%);
      }
      100%{
        transform: scale(.3) translateY(0);
      }
    }
    @keyframes collection {
      0%{
        width: 20rem;
        transform: scale(1) rotate(0);
        border-top-left-radius: 50%;
        border-bottom-left-radius: 50%;
      }
      50%{
        width: 18rem;
        transform: scale(1.2) rotate(180deg);
        border-top-left-radius: 30%;
        border-bottom-left-radius: 60%;
      }
      100%{
        width: 20rem;
        transform: scale(1) rotate(360deg);
        border-top-left-radius: 50%;
        border-bottom-left-radius: 50%;
      }
    }
  </style>
</head>
<body>
<div class="container">
   <div class="drop"></div>
   <div class="drop"></div>
   <div class="drop"></div>
   <div class="collection"></div>
   <span>充电中</span>

</div>
</body>
</html>

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值