Created
August 23, 2017 08:14
-
-
Save JoostKiens/4480097df1410a9e7fea9c7085279708 to your computer and use it in GitHub Desktop.
Convert SVG circle arguments to path description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createPathDFromCircle(cx, cy, r) { | |
return `d=" | |
M ${cx} ${cy} | |
m -${r}, 0 | |
a ${r},${r} 0 1,0 ${(r * 2)},0 | |
a ${r},${r} 0 1,0 ${-(r * 2)},0 | |
"` | |
} | |
function createPathDFromCircleStartOnTop(cx, cy, r) { | |
return `d=" | |
M ${cx} ${cy} | |
m 0, -${r} | |
a ${r},${r} 0 1,0 0,${(r * 2)} | |
a ${r},${r} 0 1,0 0,${-(r * 2)} | |
"` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment