ignor the barI have been experimenting with SVG recently and to be more specific on creating a 12-part wheel.I came across a code snippet in a previous post that fit my needs but consists of 6 parts and i need 12 segments.My problem is that i can not understand the proccess of the division.
Below is the snippet that I'm trying to understand better and would appreciate some explanation or tips on how it worksor provide some insights on how to optimize it (adding 6 more segments).
.frag {
fill: orange;
}
.center {
fill: tomato;
}
<svg width="500" height="500" viewBox="-2 -2 202 203" shape-rendering="geometricPrecision">
<a xlink:href="#">
<path class="frag" d="M100,100 v-100 a100,100 1 0,1 86.6025,50" />
<text x="135" y="42.5" text-anchor="middle">1</text>
</a>
<a xlink:href="#">
<path class="frag" d="M100,100 l86.6025,-50 a100,100 1 0,1 0,100" />
<text x="170" y="105" text-anchor="middle">2</text>
</a>
<a xlink:href="#">
<path class="frag" d="M100,100 l86.6025,50 a100,100 1 0,1 -86.6025,50" />
<text x="135" y="170" text-anchor="middle">3</text>
</a>
<a xlink:href="#">
<path class="frag" d="M100,100 v100 a100,100 1 0,1 -86.6025,-50" />
<text x="65" y="170" text-anchor="middle">4</text>
</a>
<a xlink:href="#">
<path class="frag" d="M100,100 l-86.6025,50 a100,100 1 0,1 0,-100" />
<text x="27.5" y="105" text-anchor="middle">5</text>
</a>
<a xlink:href="#">
<path class="frag" d="M100,100 l-86.6025,-50 a100,100 1 0,1 86.0025,-50" />
<text x="65" y="42.5" text-anchor="middle">6</text>
</a>
<a xlink:href="#">
<path class="center" d="M100,100 v-50 a50,50 1 0,1 0,100 a50,50 1 0,1 0,-100" />
</a>
</svg>
Paste each of your
d-pathvalues in https://yqnn.github.io/svg-path-editor/# to see what they draw.Its is going to take some effort to change those 6 segments into 12
Easiest with a libary
If its just about drawing 12 segments you can use the native JavaScript 999 Bytes
<pie-chart>Web Component I wrote: https://pie-meister.github.io/Drawing your own circle
You can draw you own circle segments, using
pathLengthandstroke-dasharraySome minor Math to positional the label
<text>