Skip to content

Instantly share code, notes, and snippets.

@hemulin
Created October 18, 2012 23:44
Show Gist options
  • Save hemulin/3915451 to your computer and use it in GitHub Desktop.
Save hemulin/3915451 to your computer and use it in GitHub Desktop.
just another inlet to tributary
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.8838031909057,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01}
var w = 900, h = 600;
var r = 2, rStep = 0.07,
cr = 10, crStep = 1, n = 1000,
step = (40*Math.PI)/n, angle = 0;
var newColor = function(d) {
return 'rgb(' + Math.floor(255 * Math.random()) +
', ' + Math.floor(255 * Math.random()) +
', ' + Math.floor(255 * Math.random()) + ')';
}
var visArea = d3.select("svg")
.attr("width", w)
.attr("height", h);
for (var i = 0; i < n; i++) {
createCircle();
angle += step;
cr += crStep;
r += rStep;
}
function createCircle() {
visArea.append("circle")
.attr("r", r)
.attr("cx", (w/2)+cr*Math.cos(angle))
.attr("cy", (h/2)+cr*Math.sin(angle))
.style("fill", newColor);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment