Last active
December 18, 2015 02:28
-
-
Save mikesea/5710951 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
function getNext() { | |
scan = badgeScans[index]; | |
console.log("got scan " + scan); | |
if (scan) { | |
var scanAction = svgContainer.selectAll("g") | |
.data([scan], function(d){return d.scan_time}); | |
scanAction.exit().remove(); | |
var group = scanAction | |
.enter() | |
.append("g"); | |
// set up and transition the circle | |
group | |
.append('circle') | |
.attr('class', 'scan') | |
.attr('r', 30) | |
.style("fill", function(d){return doorCoords[d.door].fill;}) | |
.attr("cx", function(d){return doorCoords[d.door].x;}) | |
.attr("cy", function(d){return doorCoords[d.door].y;}) | |
.transition() | |
.duration(1000) | |
.attr("cx", function(d){return compCoords[d.company].x;}) | |
.attr("cy", function(d){return compCoords[d.company].y;}); | |
// set up and transition the text | |
group | |
.append("text") | |
.attr('class', 'scan') | |
.text(function(d){return d.first_name}) | |
.attr("alignment-baseline", "middle") | |
.attr("text-anchor", "middle") | |
.attr("x", function(d){return doorCoords[d.door].x;}) | |
.attr("y", function(d){return doorCoords[d.door].y;}) | |
.transition() | |
.duration(1000) | |
.attr("x", function(d){return compCoords[d.company].x;}) | |
.attr("y", function(d){return compCoords[d.company].y;}); | |
window.setTimeout(getNext, 2000); | |
index++; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment