Skip to content

Instantly share code, notes, and snippets.

@hemulin
Created October 19, 2012 00:04
Show Gist options
  • Save hemulin/3915498 to your computer and use it in GitHub Desktop.
Save hemulin/3915498 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 = 700;
var r = 1.8, rStep = 0.06,
cr = 10, crStep = 1, n = 280,
step = 137.5, 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", "black");
}
visArea.append("circle")
.attr("r", 150)
.attr("cx", w/2)
.attr("cy", h/2)
.style("opacity", 0.3);
visArea.append("circle")
.attr("r", 310)
.attr("cx", w/2)
.attr("cy", h/2)
.style("opacity", 0.6)
.style("fill", "burlywood")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment