-
Notifications
You must be signed in to change notification settings - Fork 0
/
test4.html
executable file
·69 lines (50 loc) · 1.47 KB
/
test4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<html>
<head>
<title>Handedness Demo</title>
<script src="js/three.min.js"></script>
<script src="js/leap-0.6.2.min.js"></script>
<script src="js/leap-plugins-0.1.6.1.js"></script>
<script src="js/leap.rigged-hand-0.1.3.min.js"></script>
<style>
label {
position: fixed;
white-space: nowrap;
}
</style>
</head>
<body>
<div id="labels"></div>
</body>
<script type="text/javascript" class="codepen">
//****************rigged hand code: visual feedback of hand model
var riggedHandPlugin;
Leap.loop({
hand: function(hand){
var label = hand.data('label');
if (!label){
label = document.createElement('label');
//document.body.appendChild(label);
//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 + 'px';
label.style.bottom = screenPosition.y + 'px';
}
})
.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>