Skip to content

Instantly share code, notes, and snippets.

@jwilber
Last active October 8, 2018 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwilber/5479fd452facc74827d979dc1ea15ed4 to your computer and use it in GitHub Desktop.
Save jwilber/5479fd452facc74827d979dc1ea15ed4 to your computer and use it in GitHub Desktop.
roughjs square
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdn.rawgit.com/pshihn/rough/9be60b1e/dist/rough.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<div id="viz"></div>
<script>
var width = 600, height = 410, margin = 10, labels_px = 200;
var canvas = d3.select('#viz').append('canvas')
.attr("id","canvas")
.attr('width', width)
.attr('height', height);
var rc = rough.canvas(document.getElementById('canvas'));
// draw shapes
rc.rectangle(100, 100, 200, 200);
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment