Skip to content

Instantly share code, notes, and snippets.

@trengrj
Created March 23, 2015 08:33
Show Gist options
  • Save trengrj/94f9bbf8c52dbec7872f to your computer and use it in GitHub Desktop.
Save trengrj/94f9bbf8c52dbec7872f to your computer and use it in GitHub Desktop.
var w = 500,
var h = 300,
var svg = d3.select("svg")
.attr("width", w)
.attr("height", h)
.style("background-color", "#fefefe")
.style("display", "block");
var circle = svg.selectAll("circle")
.data([19,30,18,20,22,29]);
circle.enter()
.append("circle")
.style("fill", "#cc2266");
function move() {
circle.transition()
.duration(1780)
.attr("cx", function(d) { return Math.random() * (w - 100) + 50; })
.attr("cy", function(d) { return Math.random() * (h - 100) + 50; })
.attr("r", function(d) { return d + Math.random() * 30; });
}
window.setInterval(move, 1800);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment