| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
LeapJS is a Javascript library that provides the functionality and object structure of the Leap API to assist developers who are working with the Leap Motion in a browser environment.
Include Leap.js for debugging and access to "private" variables:
<script src="Leap.js"></script>Include Leap.min.js for deployed applications to reduce load times:
<script src="Leap.min.js"></script>// Create a controller to connect to the Leap Motion
myController = new Leap.Controller("ws://localhost:6437/");
// Create a listener
myListener = new Leap.Listener();
// Listener.onFrame is called each time a frame is received
myListener.onFrame = function(controller){
var frame = controller.frame();
var hands = frame.hands();
var pointables = frame.pointables();
var gestures = frame.gestures();
// Awesome code goes here
}
// Add the listener to the controller
myController.addListener(myListener);
// Enable the screenTap gesture
myController.enableGesture("screenTap", true);
// Listener.onConnect is called when the connection is open
myListener.onConnect = function(controller){
// Calibrate the screen
calibrate = new Leap.Calibrate(controller);
calibrate.onComplete = function(screen){
// Save the screen
// Or access it later with myController.calibratedScreens()[0]
}
}| Back | FazBrowse Home | New Git URL |