Skip to content

Instantly share code, notes, and snippets.

@poezn
Created March 27, 2014 19:44
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 poezn/9816485 to your computer and use it in GitHub Desktop.
Save poezn/9816485 to your computer and use it in GitHub Desktop.
Spiky circle
{"description":"Spiky circle","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"ds":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"inline-console":true}
var segments = 111;
var inner = 0.928;
var arr = d3.range(0, 2*Math.PI, 2*Math.PI / segments);
var r = 119;
g.append("path")
.datum(arr)
.attr({
"d": function(d, i) {
var string = "M"
+ _.map(d, function(d, i) {
var radius = (i % 2) ? r * inner : r;
return Math.sin(d)*radius + " " + Math.cos(d)*radius;
} ).join(",")
+ "Z"
return string;
},
"transform": "translate(" + r + " " + r + ")"
})
.style({
"stroke": "#000",
"fill": "transparent"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment