svg在html中自定义圆环,前端 svg 如何 开发 圆环加载

/p>

<

.progress {

width: 9.55rem;

height: 9.55rem;

position: absolute;

top: 50%;

left: 50%;

margin: -4.77rem 0 0 -4.77rem

}

.percent {

position: absolute;

top: 50%;

left: 50%;

width: 5rem;

height: 4rem;

margin: -2rem 0 0 -2.5rem

}

.percent p {

color: #EB6200;

text-align: center;

font-size: 1.3rem

}

.percent h1,

.percent h2 {

text-align: center;

line-height: 1.2rem

}

.progress svg {

width: 9.55rem;

height: 9.55rem;

}

.progress svg path {

stroke: #EB6200;

stroke-width: 4;

opacity: 1;

fill: none;

-webkit-transition: stroke-dashoffset 0.3s;

transition: stroke-dashoffset 0.3s;

-webkit-animation: dash 2s linear forwards;

}

@-webkit-keyframes dash {

to {

stroke-dashoffset: 0;

}

}

100%

style=”stroke-dasharray: 204.243713378906px; stroke-dashoffset: 204.243713378906px;”>

(function (doc, win) {

var docEl = doc.documentElement,

resizeEvt = ‘orientationchange’ in window ? ‘orientationchange’ : ‘resize’,

recalc = function () {

var clientWidth = docEl.clientWidth;

if (!clientWidth) return;

docEl.style.fontSize = (20 * (clientWidth / 320)) > 40 ? 40 + “px” : (20 * (clientWidth / 320)) + ‘px’;

};

if (!doc.addEventListener) return;

win.addEventListener(resizeEvt, recalc, false);

doc.addEventListener(‘DOMContentLoaded’, recalc, false);

function percent() {

var i = document.querySelector(“.percent > p”),

time = 0,

interval = setInterval(function () {

time += 1;

i.innerHTML = time + “%”;

if (time >= 100) {

clearInterval(interval)

}

}, 20);

}

percent()

})(document, window);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值