Leapjs 区分左右手

Leapjs 区分左右手

Leap.loop({
     
            frame: function (frame){
     
                //区分左右手
                let leftId,rightId;
                if(frame.hands[0]){
     
                    if(frame.hands[0].toString()[6] === 'l'){
     
                        leftId = 0;
                        rightId = 1;
                        document.getElementById('hand1').innerHTML = '左手当前为0';
                    }
                    else{
     
                        leftId = 1;
                        rightId = 0;
                        document.getElementById('hand1').innerHTML = '右手当前为0';
                    }
                }
            }
        })

你可能感兴趣的:(leap,js)