Skip to content

Instantly share code, notes, and snippets.

Created September 28, 2013 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/6738634 to your computer and use it in GitHub Desktop.
Save anonymous/6738634 to your computer and use it in GitHub Desktop.
{
"libraries": [
"d3"
],
"mode": "css",
"layout": "sketchpad mode",
"resolution": "reset"
}
svg {
background: #222;
position: absolute;
}
rect {
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.mouse(this);
svg.append("svg:rect")
.attr("x", m[0])
.attr("y", m[1])
.attr("width", 1e-6)
.attr("height", 1e-6)
.style("stroke", z(++i))
.style("stroke-opacity", 3)
.transition()
.duration(5000)
.ease(Math.sqrt)
.attr("width", 150)
.attr("height", 150)
//.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