纯css,svg的占比动画

svg占比动画

最近用svg做了个占比的动画,如有更好的建议,烦请指教在这里插入图片描述,样式如下svg占比动画
具体代码如下

html代码

      <div class="progress_box">
          <div class="progressbg_img"></div>
          <svg width="100%" height="100%" version="1.1">
              <defs>
                  <radialGradient id="grey_blue" cx="50%" cy="50%" r="50%"
                  fx="50%" fy="50%">
                      <stop offset="10%" style="stop-color:rgb(3,91,197);
                      stop-opacity:0.5"/>
                      <stop offset="100%" style="stop-color:rgb(148,228,239);
                      stop-opacity:1"/>
                  </radialGradient>
              </defs>
              <circle cx="100" cy="100" r="100" fill="#0e2338"/>
              <circle cx="100" cy="100" r="90" fill="#0f2a3f"/>
              <circle cx="100" cy="100" r="80" fill="#0e3145"/>
              <circle cx="100" cy="100" r="60" style="fill:url(#grey_blue)"/>
              <circle cx="100" cy="100" r="68" stroke="#1fc9e3" stroke-width="5" style="fill:transparent"/>
              <text class="circle_progress_text" x="100" y="100" font="36px Arial, sans-serif" text-anchor="middle" fill="#fff" dy="0.4em">60%</text>
          </svg>
          <svg class="progress_position" width="100%" height="100%">
              <!-- <path id="svg_4" d="m32,100c0,-37.569061 30.430939,-68 68,-68c37.569061,0 68,30.430939 68,68c0,37.569061 -30.430939,68 -68,68c-37.569061,0 -68,-30.430939 -68,-68z" stroke-opacity="null" stroke-linecap="null" stroke-linejoin="null" stroke-width="6" stroke="#000" fill-opacity="0"/> -->
              <path id="svg_4" d="m32,100c0,-37.569061 30.430939,-68 68,-68c37.569061,0 68" stroke-opacity="null" stroke-linecap="null" stroke-linejoin="null" stroke-width="8" stroke="#0e3145" fill-opacity="0"/>
          </svg>
      </div>

css样式


.progress_box{
    width: 200px;
    height: 200px;
    margin: 0 auto;
    position: relative;
}
.circle_progress_text{
    font-size: 38px;
}
.progressbg_img{
    width: 170px;
    height: 170px;
    background-image: url("./assets/images/progress_img.png");//此处是齿轮的图片,也可改用自己的图片
    background-repeat: no-repeat;
    position: absolute;
    z-index: 1000;
    background-size: 100% 100%;
    top: 16px;
    left: 14px;
}
.progress_position{
    position: absolute;
    top: 0;
    left: 0;
    animation: draw 5s linear infinite;
}
@keyframes draw{
    0%{
        transform: rotate(0deg);
    }
    0%{
        transform: rotate(-360deg);
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值