Skip to content

Add handedness demo #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions v2/left-right/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<html>
<head>
<title>Handedness Demo</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r66/three.js"></script>
<script src="//js.leapmotion.com/leap-0.6.0-beta3_1.min.js"></script>
<script src="//js.leapmotion.com/leap-plugins-0.1.5_1.js"></script>
<script src="//js.leapmotion.com/leap.rigged-hand-0.1.3.min.js"></script>

<style>
body{
font-family: 'Myriad Pro', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size: 24pt;
color: white;
background-color: #80b865;
}
label {
position: absolute;
white-space: nowrap;
}
</style>
</head>

<body>
<div id="labels"></div>
</body>

<script type="text/javascript" class="codepen">
var riggedHandPlugin;

Leap.loop({
hand: function(hand){
var label = hand.data('label');


if (!label){

label = document.createElement('label');
document.body.appendChild(label);

/**
* Here we set the label to show the hand type
*/
label.innerHTML = hand.type + " hand";

hand.data('label', label)

}


var handMesh = hand.data('riggedHand.mesh');

var screenPosition = handMesh.screenPosition(
hand.palmPosition,
riggedHandPlugin.camera
);

label.style.left = screenPosition.x;
label.style.bottom = screenPosition.y;

}
})
.use('riggedHand')
.use('handEntry')
.on('handLost', function(hand){
var label = hand.data('label');
if (label){
document.body.removeChild(label);
hand.data({label: undefined});
}
});

riggedHandPlugin = Leap.loopController.plugins.riggedHand;

</script>
</html>
2 changes: 1 addition & 1 deletion v2/pinch-strength/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Pinch Strength Demo</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r66/three.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r67/three.js"></script>
<script src="//js.leapmotion.com/leap-0.6.0-beta2.min.js"></script>
<script src="//js.leapmotion.com/leap-plugins-0.1.4.1.min.js"></script>
<script src="//s3-us-west-2.amazonaws.com/s.cdpn.io/109794/leap.playback-0.2.0.js"></script>
Expand Down