Leap Motion API类库:ScreenTapGesture&SwipeGesture

1. ScreenTapGesture
    继承自:Gesture()
    screentapgesture类表明用手指或工具作出一个点击的姿式。
    能够理解为当一个手指向前戳一下以后再弹回原处,
    若是点击一个垂直屏幕。点击以前这个手指必须停顿一下。

    screentap手势是离散的,点击以后状态保留,一对一触发。
    一个未初始化的screentapgesture对象视为无效。从一个框架对象或一个手势事件侦听获得的screentapgesture类实例。
    下面的例子演示了如何从一个跟踪数据帧中获取手势对象:
框架

var controller = Leap.loop({enableGestures: true}, function(frame){
  if(frame.valid && frame.gestures.length > 0){
    frame.gestures.forEach(function(gesture){
        switch (gesture.type){
          case "circle":
              console.log("Circle Gesture");
              break;
          case "keyTap":
              console.log("Key Tap Gesture");
              break;
          case "screenTap":
              console.log("Screen Tap Gesture");
              break;
          case "swipe":
              console.log("Swipe Gesture");
              break;
        }
    });
  }});

    您还能够添加一个侦听器回调到一个控制器对象。在每一个设备帧中,您的回调被调用为每一个手势对象:
工具

var controller = Leap.loop({enableGestures: true}, function(frame){
              //... handle frame data
              });
              controller.on("gesture", function(gesture){
              //... handle gesture object
  });

    (1)构造器:ScreenTapGesture()
    构建了一个新的screentapgesture对象。
    一个未初始化的screentapgesture对象视为无效。能够从一个Frame对象获得的有效screentapgesture类实例。
2.SwipeGestureoop

继承自:Gesture()
    swipegesture类表明手,手指或工具的一次滑动运动。
    code

SwipeGestureImage

    每一个手指或工具的滑动表明一个swipegesture对象。
    手势是连续的,当手势继续时,在每一个帧中都会出现一个相同的ID值表示手势对象,
对象

相关文章
相关标签/搜索