Skip to content

Instantly share code, notes, and snippets.

@chaliy
Created November 7, 2014 10:42
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 chaliy/0aa2bcf8de8b4ae68651 to your computer and use it in GitHub Desktop.
Save chaliy/0aa2bcf8de8b4ae68651 to your computer and use it in GitHub Desktop.
var svg = d3.select(element[0])
.append('svg')
.attr('width', '99%')
.attr('height', '99%')
.attr('style', 'border: 1px solid silver; position: absolute; top: 0px; left: 0px; z-index: 1001');
var data = []
var refresh = function () {
var joints = svg
.selectAll('.dot')
.data(data, function (d) { return d.trackingId + "-" + d.handType; })
.call(draw);
function draw(joint) {
joint.attr('class', 'dot')
.style('fill', function (d) {
return 'red';
})
.attr('cx', function (d) { return d.x; })
.attr('cy', function (d) { return d.y; })
.attr('r', function (d) { return 5; });
}
joints.enter()
.append('circle')
.call(draw);
joints.exit()
.remove();
}
server.on('interactionchanged', function (e) {
data = e.handPointers;
refresh();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment