Skip to content

Instantly share code, notes, and snippets.

@runemadsen
Created November 11, 2016 16:41
Show Gist options
  • Save runemadsen/c897b7bc2b8f059a72bb7543ed4383f5 to your computer and use it in GitHub Desktop.
Save runemadsen/c897b7bc2b8f059a72bb7543ed4383f5 to your computer and use it in GitHub Desktop.
var r = new Rune({
container: "#canvas",
width: 800,
height: 600
});
var myPoly = r.polygon(400, 200)
.lineTo(0, 0)
.lineTo(200, 50)
.lineTo(250, 60)
.lineTo(200, 150)
.lineTo(-200, 150)
.lineTo(-250, 60)
.lineTo(-200, 50)
for(var x = 0; x < r.width; x += 20) {
for(var y = 0; y < r.height; y += 20) {
if(myPoly.contains(x, y)) {
r.circle(x, y, r.random(4, 10));
}
}
}
myPoly.removeParent();
r.draw();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment