JSFiddle - React, Tailwind, and code Playground
HTML
<div id="canvas"></div>
JavaScript
var path, paper, circle, radius;
radius = 150;
paper = Raphael("canvas", radius*4, radius*4);
path = drawCircle(6) //can be any number
function drawCircle(nodes){
newPath = [];
for(x=0; x<nodes; x++) {
deg = (x/nodes)*360;
if(x==0) {
newPath.push("M " + Math.sin(deg*Math.PI/180)*radius + " " + Math.cos(deg*Math.PI/180)*radius);
}
else {
newPath.push(
"C " + Math.sin(deg*Math.PI/180)*radius
+ " " + Math.cos(deg*Math.PI/180)*radius
+ " " + Math.sin(deg*Math.PI/180)*radius
+ " " + Math.cos(deg*Math.PI/180)*radius
+ " " + Math.sin(deg*Math.PI/180)*radius
+ " " + Math.cos(deg*Math.PI/180)*radius
)
}
}
newPath.push("Z")
console.log(newPath)
paper.path(newPath).attr({"fill": "#000"}).translate(200, 200)
}