Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Created July 8, 2012 19:56
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 gabrielflorit/3072563 to your computer and use it in GitHub Desktop.
Save gabrielflorit/3072563 to your computer and use it in GitHub Desktop.
created by livecoding - http://livecoding.gabrielflor.it
svg {
background: #222;
}
circle {
fill: none;
stroke-width: 1.5px;
}
// mouseover the graph!
// from http://bl.ocks.org/1062544
var w = $('svg').width(),
h = $('svg').height(),
z = d3.scale.category20c(),
i = 0;
var svg = d3.select('svg')
.attr("width", w)
.attr("height", h)
.style("pointer-events", "all")
.on("mousemove", particle);
function particle() {
var m = d3.svg.mouse(this);
svg.append("svg:circle")
.attr("cx", m[0])
.attr("cy", m[1])
.attr("r", 1e-6)
.style("stroke", z(++i))
.style("stroke-opacity", 1)
.transition()
.duration(2000)
.ease(Math.sqrt)
.attr("r", 100)
.style("stroke-opacity", 1e-6)
.remove();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment