Skip to content

Instantly share code, notes, and snippets.

@dabos
Created January 11, 2014 18:02
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 dabos/8374387 to your computer and use it in GitHub Desktop.
Save dabos/8374387 to your computer and use it in GitHub Desktop.
moirefrommbostock
{"description":"moirefrommbostock","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"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}
var w = tributary.sw,
h = tributary.sh;
var svg = d3.select("svg")
svg.append("rect")
.attr("width", w)
.attr("height", h);
svg.append("g").selectAll("circle")
.data(d3.range(52))
.enter().append("circle")
.attr("transform", "translate(" + w / 2 + "," + h / 2 + ")")
.attr("r", function(d) { return d * 5; });
var circle = svg.append("g").selectAll("circle")
.data(d3.range(50))
.enter().append("circle")
.attr("transform", "translate(" + w / 2 + "," + h / 2 + ")")
.attr("r", function(d) { return d * 4; });
svg.on("mousemove", function() {
var mouse = d3.mouse(this),
r = (Math.sqrt(mouse[0]) + 10) / 10;
circle
.attr("transform", "translate(" + mouse + ")")
.attr("r", function(d) { return d * r; });
});
rect {
fill: none;
pointer-events: all;
}
circle {
fill: none;
stroke: #000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment