-
-
Save jamesongamble/54e2568b6d9d6f55ab8d to your computer and use it in GitHub Desktop.
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
// start slingin' some d3 here. | |
var update = function(data) { | |
var board = d3.select("body").select("svg").selectAll("image.pira") | |
.data(data) | |
board.enter().append("image") | |
.attr("height", function() { | |
return "50"; | |
}) | |
.attr("width", function() { | |
return "50"; | |
}) | |
.attr("class", "pira") | |
.attr("xlink:href", function() { | |
return "pira.png"; | |
}) | |
//transition | |
.transition() | |
.duration(1000) | |
.attr("x", function(d) { | |
return d[0]; | |
}) | |
.attr("y", function(d) { | |
return d[1]; | |
}); | |
board.attr("height", function() { | |
return "50"; | |
}) | |
.attr("width", function() { | |
return "50"; | |
}) | |
.attr("class", "pira") | |
.attr("xlink:href", function() { | |
return "pira.png"; | |
}) | |
.transition() | |
.duration(1000) | |
.attr("x", function(d) { | |
return d[0]; | |
}) | |
.attr("y", function(d) { | |
return d[1]; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment