Drawing animated arc with pure CSS

后端 未结 6 1773
挽巷
挽巷 2020-12-30 06:22

I know it is possible to draw and animate arcs in svg and canvas. However, is it possible in css?

I have created an arc using the following method:

.         


        
6条回答
  •  旧时难觅i
    2020-12-30 06:40

    As Per Chris B's suggestion on the original question, the answer is to contain the arc in another div and then animate the width of the container:

    http://jsfiddle.net/AZb3X/

    CSS:

    body{
        background:orange;    
    }
    
    .arc{
        width:150px;
        height:400px;
        border-radius:50%;
        border-right:1px solid black;
        border-left:1px solid black;
        border-top:1px solid black;
        border-bottom:1px solid white;
        float:left;
    }
    
    .hider{
        width:0px;
        overflow:hidden;    
        -webkit-animation:unhide 12s;
    }
    
    @-webkit-keyframes unhide{
        100%{width:400px}
    }    
    

    HTML:

提交回复
热议问题