Skip to content

Instantly share code, notes, and snippets.

@pcomans
Created July 20, 2012 09:29
Show Gist options
  • Save pcomans/3149871 to your computer and use it in GitHub Desktop.
Save pcomans/3149871 to your computer and use it in GitHub Desktop.
function tick(e) {
node.each(gravity(.2 * e.alpha))
.each(collide(.3))
.attr("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; })
.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
}
d3.select("#sort")
.on("click", function(d,i) {
});
function gravity(alpha) {
return function(d) {
d.y += (d.cy - d.y) * alpha;
d.x += (d.cx - d.x) * alpha;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment