Created
September 2, 2018 17:21
-
-
Save anad-zeal/802ce7f316f8bf71dc71d0f95bb9c213 to your computer and use it in GitHub Desktop.
SVG Path Circle
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
<h1>SVG Path Circle</h1> | |
<p>Why two arches? – please see the <a href="https://codepen.io/jakob-e/details/bgBegJ/">comments</a></p> | |
<pre> | |
<circle cx="" cy="" r="" /> | |
<path 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 | |
"/> | |
<em>...or a bit shorter (merging the two moves) </em> | |
<path d=" | |
M cx - r, cy | |
a r,r 0 1,0 (r * 2),0 | |
a r,r 0 1,0 -(r * 2),0 | |
"/> | |
<strong>Example</strong> | |
<circle cx="100" cy="100" r="75" /> | |
<path d=" | |
M 100, 100 | |
m -75, 0 | |
a 75,75 0 1,0 150,0 | |
a 75,75 0 1,0 -150,0 | |
"/> | |
</pre> | |
<div> | |
circle | |
<svg viewBox="0 0 200 200"> | |
<circle cx="100" cy="100" r="75" /> | |
</svg> | |
</div> | |
<div> | |
path | |
<svg viewBox="0 0 200 200"> | |
<path | |
d=" | |
M 100, 100 | |
m -75, 0 | |
a 75,75 0 1,0 150,0 | |
a 75,75 0 1,0 -150,0 | |
" | |
/> | |
</svg> | |
</div> |
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
body { padding:20px 50px} h1,p { font:500 36px sans-serif; } p {font-size:16px;}div { display: inline-block; width: 100px; font-family: sans-serif; } svg { max-width:100px; path { fill: olive; } circle { fill: tomato } } pre { padding:16px; background-color: whitesmoke; border-radius:5px;border:1px solid #ccc;} pre { font-size:11px;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment