亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站

資訊專欄INFORMATION COLUMN

SVG做圓環(huán)進(jìn)度

Elle / 3585人閱讀

摘要:哈哈動(dòng)態(tài)效果是用來(lái)實(shí)現(xiàn)的,,至于進(jìn)度則是用控制屬性實(shí)現(xiàn)的。。代碼如下首先看下結(jié)構(gòu)加油開(kāi)始濾鏡效果對(duì)于不熟悉的,先看下基本教程接下來(lái)看下樣式最后就腳本了,代碼不多,也很簡(jiǎn)單,就是設(shè)置屬性圓環(huán)進(jìn)度條謝謝關(guān)注

我們要實(shí)現(xiàn)的效果:

是不是有點(diǎn)感覺(jué)。。。哈哈

動(dòng)態(tài)效果是用css3來(lái)實(shí)現(xiàn)的,,至于進(jìn)度則是用js控制stroke-dasharray屬性實(shí)現(xiàn)的。。

代碼如下:

首先看下HTML結(jié)構(gòu)

1143/1566 加油開(kāi)始 99%

濾鏡效果


    
        
        
            
            
        
    

對(duì)于svg不熟悉的,先看下SVG基本教程http://www.runoob.com/svg/svg...

接下來(lái)看下CSS樣式

.zh-rt-main{position: relative; width: 436px; height: 436px; margin: -36px auto 0;}
.zh-rt-main .zh-node{display: block; position: absolute; z-index: 2; width: 116px; font-size: 12px; text-align: center; opacity: 0;}
.zh-rt-main .zh-node:after{content: ""; display: block; width: 100%; height: 1px; margin-top: 5px;}
.zh-rt-main .zh-node .zh-name,
.zh-rt-main .zh-node .zh-percent-num{display: block;}
.zh-rt-main .zh-node-1{left: 160px; top: 40px; -webkit-animation: fadeIn .3s ease-out .1s forwards; animation: fadeIn .3s ease-out .1s forwards;}
.zh-rt-main .zh-node-2{right: 70px; top: 82px; -webkit-animation: fadeIn .3s ease-out .2s forwards; animation: fadeIn .3s ease-out .2s forwards;}
.zh-rt-main .zh-node-3{right: 20px; top: 138px; -webkit-animation: fadeIn .3s ease-out .3s forwards; animation: fadeIn .3s ease-out .3s forwards;}
.zh-rt-main .zh-node-4{right: 0; top: 195px; -webkit-animation: fadeIn .3s ease-out .4s forwards; animation: fadeIn .3s ease-out .4s forwards;}
.zh-rt-main .zh-node-5{right: 20px; bottom: 135px; -webkit-animation: fadeIn .3s ease-out .5s forwards; animation: fadeIn .3s ease-out .5s forwards;}
.zh-rt-main .zh-node-6{right: 70px; bottom: 75px; -webkit-animation: fadeIn .3s ease-out .6s forwards; animation: fadeIn .3s ease-out .6s forwards;}
.zh-rt-main .zh-node-7{left: 160px; bottom: 31px; -webkit-animation: fadeIn .3s ease-out .7s forwards; animation: fadeIn .3s ease-out .7s forwards;}
.zh-rt-main .zh-node-8{left: 70px; bottom: 75px; -webkit-animation: fadeIn .3s ease-out .9s forwards; animation: fadeIn .3s ease-out .9s forwards;}
.zh-rt-main .zh-node-9{left: 20px; bottom: 135px; -webkit-animation: fadeIn .3s ease-out .8s forwards; animation: fadeIn .3s ease-out .8s forwards;}
.zh-rt-main .zh-node-10{left: 0; top: 195px; -webkit-animation: fadeIn .3s ease-out 1s forwards; animation: fadeIn .3s ease-out 1s forwards;}
.zh-rt-main .zh-node-11{left: 20px; top: 138px; -webkit-animation: fadeIn .3s ease-out 1.1s forwards; animation: fadeIn .3s ease-out 1.1s forwards;}
.zh-rt-main .zh-node-12{left: 70px; top: 82px; -webkit-animation: fadeIn .3s ease-out 1.2s forwards; animation: fadeIn .3s ease-out 1.2s forwards;}

最后就JS腳本了,代碼不多,也很簡(jiǎn)單,就是設(shè)置stroke-dasharray屬性

// 圓環(huán)進(jìn)度條
function ringProcessBar() {
    var radius = 120;
    var circumference = 2 * radius * Math.PI;
    $(".zh-rt-main").each(function() {
        var curProcess = parseFloat($(this).find(".zh-svg-box .zh-percent").text()).toFixed(2) / 100;
        var dasharray1 = (circumference*(1-curProcess)).toFixed(2);
        var dasharray2 = (circumference*curProcess).toFixed(2);
        $(this).find(".zh-svg-box svg circle:eq(1)").attr("stroke-dasharray", dasharray2+","+dasharray1);
    });
}
ringProcessBar();

謝謝關(guān)注~

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://www.ezyhdfw.cn/yun/81668.html

相關(guān)文章

  • 實(shí)現(xiàn)環(huán)形進(jìn)度條的幾種方法

    摘要:環(huán)形進(jìn)度條的問(wèn)題,網(wǎng)上有很多的,也有各種不同的實(shí)現(xiàn)方式,很棒的實(shí)現(xiàn)也有很多,我這自己做一下一方面是想開(kāi)闊一下自己的思路,一方面好久沒(méi)看和的東西了,基礎(chǔ)的拿來(lái)熟悉下。 環(huán)形進(jìn)度條的問(wèn)題,網(wǎng)上有很多的demo,也有各種不同的實(shí)現(xiàn)方式,很棒的實(shí)現(xiàn)也有很多,我這自己做一下一方面是想開(kāi)闊一下自己的思路,一方面好久沒(méi)看SVG和Canvas的東西了,基礎(chǔ)的拿來(lái)熟悉下。 DIV + CSS3 這個(gè)是最...

    Scliang 評(píng)論0 收藏0
  • clip實(shí)現(xiàn)圓環(huán)進(jìn)度

    摘要:效果圖怎么實(shí)現(xiàn)這樣一個(gè)圓環(huán)進(jìn)度條的效果呢,可以使用等等方式,今天我們來(lái)說(shuō)下使用怎么來(lái)實(shí)現(xiàn)。使用才實(shí)現(xiàn)圓環(huán)進(jìn)度還是很簡(jiǎn)單的,還不需要考慮兼容性,關(guān)于可以看張?chǎng)涡翊笊竦娜罩? 效果圖 showImg(https://segmentfault.com/img/bV3DbY?w=315&h=300); 怎么實(shí)現(xiàn)這樣一個(gè)圓環(huán)進(jìn)度條的效果呢,可以使用canvas、svg、GIF等等方式,今天我們來(lái)說(shuō)...

    zhichangterry 評(píng)論0 收藏0
  • clip實(shí)現(xiàn)圓環(huán)進(jìn)度

    摘要:效果圖怎么實(shí)現(xiàn)這樣一個(gè)圓環(huán)進(jìn)度條的效果呢,可以使用等等方式,今天我們來(lái)說(shuō)下使用怎么來(lái)實(shí)現(xiàn)。使用才實(shí)現(xiàn)圓環(huán)進(jìn)度還是很簡(jiǎn)單的,還不需要考慮兼容性,關(guān)于可以看張?chǎng)涡翊笊竦娜罩? 效果圖 showImg(https://segmentfault.com/img/bV3DbY?w=315&h=300); 怎么實(shí)現(xiàn)這樣一個(gè)圓環(huán)進(jìn)度條的效果呢,可以使用canvas、svg、GIF等等方式,今天我們來(lái)說(shuō)...

    spacewander 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<