View this code at http://livecoding.io/8377101
Created
January 11, 2014 21:26
-
-
Save sohocoke/8377101 to your computer and use it in GitHub Desktop.
created by livecoding - http://livecoding.io/3419313
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"libraries": [ | |
"d3" | |
], | |
"mode": "javascript", | |
"layout": "sketchpad mode", | |
"resolution": "reset" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svg { | |
background: #222; | |
position: absolute; | |
} | |
circle { | |
fill: none; | |
stroke-width: 1.5px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg></svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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:circle") | |
.attr("cx", m[0]) | |
.attr("cy", m[1]) | |
.attr("r", 1e-6) | |
.style("stroke", z(++i)) | |
.style("stroke-opacity", 1) */ | |
.append('svg:image') | |
.attr("x", m[0]) | |
.attr("y", m[1]) | |
.attr("xlink:href", "http://www.e-pint.com/epint.jpg") | |
.attr('width', 0) | |
.attr('height', 0) | |
.transition() | |
.duration(2000) | |
.ease(Math.sqrt) | |
.attr("width", 100) | |
.attr("height", 100) | |
.style("stroke-opacity", 1e-6) | |
.remove(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment