How to use the leapjs.loopController function in leapjs

To help you get started, we’ve selected a few leapjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leapmotion / javascript / v2 / kitchen / index.js View on Github external
if (this.directionsIndex < this.directions.length) this.directionsIndex++;
  },

  speakingDone: function(){
    // note -this needs to be updated for concurrent async speech
    //this.speech = null;
  },

  loudnessError: function(){}

};


speaker = new Speaker(recipe);

Leap.loopController.on('gesture', function(gesture){
  //if (gesture.type != 'swipe' && gesture.type != 'update') console.log('u', gesture.id);
  if (gesture.type != 'swipe' || gesture.state != 'start') return;

  var hand = Leap.loopController.frame().hand(gesture.handIds[0]);

  if (hand.grabStrength > 0.7){
    console.log('rejecting due to high grabStrength: ' + hand.grabStrength);
    return
  }

  if (
    Math.abs(gesture.direction[0]) > Math.abs(gesture.direction[1]) &&
    Math.abs(gesture.direction[0]) > Math.abs(gesture.direction[2])
  ){
    speaker.handleGesture(gesture);
  }
github leapmotion / javascript / v2 / kitchen / index.js View on Github external
Leap.loopController.on('gesture', function(gesture){
  //if (gesture.type != 'swipe' && gesture.type != 'update') console.log('u', gesture.id);
  if (gesture.type != 'swipe' || gesture.state != 'start') return;

  var hand = Leap.loopController.frame().hand(gesture.handIds[0]);

  if (hand.grabStrength > 0.7){
    console.log('rejecting due to high grabStrength: ' + hand.grabStrength);
    return
  }

  if (
    Math.abs(gesture.direction[0]) > Math.abs(gesture.direction[1]) &&
    Math.abs(gesture.direction[0]) > Math.abs(gesture.direction[2])
  ){
    speaker.handleGesture(gesture);
  }

});

leapjs

JavaScript client for the Leap Motion Controller

Apache-2.0
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis