200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 基于leapmotion的手势识别---4种手势

基于leapmotion的手势识别---4种手势

时间:2023-08-25 17:31:17

相关推荐

基于leapmotion的手势识别---4种手势

leapmotion是一种手势识别设备,支持大多数操作系统,有基于大多数语言的api便于开发

开发者工具网站如下:

/documentation/v2/javascript/index.html?proglang=javascript

以下以javascript为例:

根据api提供识别四种手势:circle(画圈), keytap(向下点击),screentap(屏幕点击),swipe(翻转)

下面例子是通过识别四种手势进行翻页

<script type="text/javascript">function gotopage(){window.location.href='2text1.html';}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 Gesture1");setTimeout(gotopage,2000);break;case "keyTap":// console.log("Key Tap Gesture1");setTimeout(gotopage,2000);break;case "screenTap":// console.log("Screen Tap Gesture1");setTimeout(gotopage,2000);break;case "swipe":setTimeout(gotopage,2000);break;}});} });</script>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。