[ Launch: An inlet to Tributary ] 4589121 by trtg
-
-
Save trtg/4589121 to your computer and use it in GitHub Desktop.
leap_motion_test
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
{"description":"leap_motion_test","endpoint":"","display":"svg","public":true,"require":[{"name":"leap","url":"https://raw.github.com/trtg/LeapJS-1/master/Leap.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.5130733944954128,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false} |
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
var svg = d3.select("svg").attr("width",500).attr("height",500); | |
myListener = new Leap.Listener(); | |
myListener.onFrame = function(controller){ | |
var numfings =controller.frame().fingers().count(); | |
if(numfings>0){ | |
//console.log(controller.frame()); | |
} | |
var myfingers = svg.selectAll("circle").data(controller.frame().fingers()); | |
myfingers | |
.enter() | |
.append("circle") | |
.attr("cx",function(d,i){return d._tipPosition.x+200}) | |
.attr("cy",function(d,i){return d._tipPosition.y+200}) | |
.attr("opacity",0.3) | |
.attr("r",function(d,i){ | |
console.log(d); | |
return d._length | |
}); | |
myfingers.exit().remove(); | |
} | |
myListener.onConnect = function(controller){ | |
console.log('leap device connected'); | |
} | |
myListener.onDisconnect = function(controller){ | |
console.log('leap device disconnected'); | |
} | |
myController = new Leap.Controller("ws://localhost:6437/"); | |
myController.addListener(myListener); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment