Skip to content

Instantly share code, notes, and snippets.

@nkint
Created December 17, 2019 13:27
Show Gist options
  • Save nkint/6b9ecbfc85af06a787163dfb027c71a4 to your computer and use it in GitHub Desktop.
Save nkint/6b9ecbfc85af06a787163dfb027c71a4 to your computer and use it in GitHub Desktop.
Circle as SVG path with A
function circlePath(cx=0, cy=0, r=10) {
// https://stackoverflow.com/a/10477334/433685
const startPointX = - r
const startPointY = 0
return `M ${cx} ${cy}
m ${startPointX}, ${startPointY}
a ${r},${r} 0 1,0 ${(r * 2)},0
a ${r},${r} 0 1,0 ${-(r * 2)},0
`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment