UNPKG

node-red-contrib-leap-motion

Version:

Node-Red nodes for leap motion

66 lines (38 loc) 2.72 kB
[![LeapJS Logo](https://cloud.githubusercontent.com/assets/407497/2652512/eedfb992-bfae-11e3-8323-f202845e3fd8.png)](https://developer.leapmotion.com/leapjs/) Welcome to the [Leap Motion](https://www.leapmotion.com) JavaScript framework. [![Build Status](https://travis-ci.org/leapmotion/leapjs.png)](https://travis-ci.org/leapmotion/leapjs) ```javascript Leap.loop(function(frame){ console.log(frame.hands.length); }); ``` Learn more in the [Getting Started Guide](https://developer.leapmotion.com/leapjs/getting-started), and the [API Reference](https://developer.leapmotion.com/documentation/javascript/api/Leap_Classes.html). ### Installation **Browser**: Download the latest `leap.js` [from our CDN](https://developer.leapmotion.com/leapjs/welcome). **Bower**: `bower install leapjs` **Node**: `npm install leapjs` ### Examples Visit [developer.leapmotion.com/downloads/skeletal-beta/gallery](https://developer.leapmotion.com/downloads/skeletal-beta/gallery) for the latest examples. Some more basic examples have also been included in the [examples/](https://github.com/leapmotion/leapjs/tree/master/examples) directory. ### Plugins [Plugins](http://developer.leapmotion.com/leapjs/plugins) are used to modularly extend Leap Webapps with external libraries. Here we use the `screenPosition` plugin to get the position of the hand as an on-screen cursor. ```javascript Leap.loop({ hand: function(hand){ console.log( hand.screenPosition() ); } }).use('screenPosition'); ``` ### Misc LeapJS includes the vector math library [GL-Matrix](http://glmatrix.net/) for your use and convenience. For example, we can easily compute a dot product. See [the example](https://github.com/leapmotion/leapjs/blob/master/examples/math.html) and [the gl matrix docs](http://glmatrix.net/docs/2.2.0/) for more info. ```javascript var dot = Leap.vec3.dot(hand.direction, hand.indexFinger.direction); ``` Also visit the wiki for [how to make plugins](https://github.com/leapmotion/leapjs/wiki/Plugins), [protocol guide](https://github.com/leapmotion/leapjs/wiki/Protocol), and [other stuff](https://github.com/leapmotion/leapjs/wiki). ### Contributing Add your name, email, and github account to the CONTRIBUTORS.txt list, thereby agreeing to the terms and conditions of the Contributor License Agreement. Open a Pull Request. If your information is not in the CONTRIBUTORS file, your pull request will not be reviewed. [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/f4522a98d0918ac69a49119ac3249bdb "githalytics.com")](http://githalytics.com/leapmotion/leapjs) [![Analytics](https://ga-beacon.appspot.com/UA-31536531-10/LeapJS/README.md?pixel)](https://github.com/leapmotion/LeapJS)