Built with blockbuilder.org
Last active
October 8, 2018 05:53
-
-
Save jwilber/6800f385c004b1999ecd0b72fb2ea88b to your computer and use it in GitHub Desktop.
roughjs circle from path
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
license: mit |
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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/rough.js/2.2.5/rough.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
</style> | |
</head> | |
<body> | |
<html> | |
<head> | |
<title>RoughJS Paths sample - SVG</title> | |
<script src="https://rawgit.com/pshihn/rough/master/dist/rough.min.js"></script> | |
<style> | |
svg { | |
display: block; | |
width: 800px; | |
height: 600px; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>RoughJS Path Example (SVG)</h2> | |
<svg id="svg"></svg> | |
<script> | |
const svg = document.getElementById('svg'); | |
const rc = rough.svg(svg); | |
const headPath = "M251.249,127.907c17.7,0,32.781-6.232,45.254-18.7c12.467-12.467,18.699-27.554,18.699-45.253 c0-17.705-6.232-32.783-18.699-45.255C284.029,6.233,268.948,0,251.249,0c-17.705,0-32.79,6.23-45.254,18.699 c-12.465,12.469-18.699,27.55-18.699,45.255c0,17.703,6.23,32.789,18.699,45.253C218.462,121.671,233.549,127.907,251.249,127.907 z"; | |
svg.appendChild(rc.path(headPath, { | |
stroke: 'red', | |
strokeWidth: '3', | |
fill: 'rgba(0,0,255,0.2)', | |
fillStyle: 'solid' | |
})); | |
</script> | |
</body> | |
</html> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment