Create SVG progress circle

前端 未结 7 1187
再見小時候
再見小時候 2020-12-30 15:34

Anyone know how to create a circle \"progressbar\" in svg? I need to specify the percentage of the circle, så that a color grows in the shape of a cake.

The growing

7条回答
  •  被撕碎了的回忆
    2020-12-30 16:07

    Shamelessly copy and pasting from the specification:

    
    

    The path uses the "elliptical arc" command to draw a partial circle. You can either draw several of them, each describing a different circular section, or you give one of them an ID and reference it with . Then you can rotate the . Draw as many of them as you need for granularity (e.g., 100 sectors allow you steps of 0% to 100%).

    To colorize them, just set the fill="" attribute of each single sector to the fitting value.

提交回复
热议问题