前端环形拖尾进度条

前端环形拖尾进度条

效果图
在这里插入图片描述

直接上代码

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>环形拖尾进度条</title>
</head>
<style>
  .loading {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    position: relative;
    padding: 10px;
  }
  .loading-content {
    width: 80px;
    height: 80px;
    background-color: #ffffff;
    position: relative;
    z-index: 90;
    border-radius: 50%;
  }
  .text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
  }
  .loading-border {
    width: 80px;
    height: 80px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 50;
    border: 10px solid #f1f1f1;
    border-radius: 50%;
  }
  .loading-mask {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 50%;
    top: 0;
    left: 0;
    z-index: 60;
    animation: rotateAnimate 1.4s linear infinite;
  }
  .loading-mask::before {
    content: "";
    display: block;
    position: absolute;
    bottom: 0;
    left: calc(50% - 5px);
    width: 10px;
    height: 10px;
    z-index: 100;
    border-radius: 50%;
    background-color: #6082e0;
  }
  .loading-mask::after {
    content: "";
    display: block;
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 50%;
    height: 50%;
    border-radius: 0 0 60px 0;
    background-image: linear-gradient(46deg, #6082e0, #f1f1f1);
  }
  @keyframes rotateAnimate {
    from {
      transform: rotate(0);
    }
    to {
      transform: rotate(360deg);
    }
  }
</style>

<body>
  <div class="loading">
    <div class="loading-mask">
      <!-- 旋转主体 -->
    </div>
    <div class="loading-border"></div>
    <div class="loading-content">
      <div class="text">0%</div>
    </div>
  </div>
  <script>
    var text = 0;
    var numElement = document.querySelector(".text")
    var time = setInterval(()=>{
      text++
      numElement.innerHTML = text+"%"
      if(text==100){
        clearInterval(time)
      }
    },200)
    
  </script>
</body>

</html>

参考:
div+css实现圆形loading动画,渐变拖尾动画

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值