-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpure.html
67 lines (53 loc) · 1.97 KB
/
pure.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Leap Motion JavaScript Sample</title>
<script src="lib/leapmin.js"></script>
<script src="lib/audio.js"></script>
<script src="lib/jsfx.js"></script>
<script src="lib/jsfxlib.js"></script>
<script>
// Store frame for motion functions
var previousFrame = null;
var paused = false;
var pauseOnGesture = false;
// Setup Leap loop with frame callback function
var controllerOptions = {enableGestures: true};
// to use HMD mode:
// controllerOptions.optimizeHMD = true;
Leap.loop(controllerOptions, function(frame) {
if (frame.hands.length > 0) {
for (var i = 0; i < frame.hands.length; i++) {
var hand = frame.hands[i];
playsound(hand.palmPosition,frame.gestures[0]);
}
}
if (frame.pointables.length > 0) {
var fingerTypeMap = ["Thumb", "Index finger", "Middle finger", "Ring finger", "Pinky finger"];
var boneTypeMap = ["Metacarpal", "Proximal phalanx", "Intermediate phalanx", "Distal phalanx"];
}
if (frame.gestures.length > 0) {
}
})
function playsound(palmposition, gesture){
// I didn't include the full array
//console.log(gesture);
//console.log(palmposition);
audioLibParams = {
test : ["saw",0.0000,Math.min(1,1-palmposition[1]/500),0.0370,0.2880,0.0000,0.1700,20.0000,Math.max(0,(palmposition[0]+350)*3),2400.0000,-0.6740,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0750,0.0000],
test2: ["saw",0.0000,Math.min(1,1-palmposition[1]/500),0.0210,1.0360,1.5900,1.7180,2171.0000,Math.max(0,(palmposition[0]+350)*3),2377.0000,-0.5560,0.6060,0.3250,41.9533,0.9610,0.3540,-0.1620,0.8650,0.0910,0.3720,0.4280,0.0740,-0.9360,0.9170,0.0940,0.1960,0.9820,-0.3560]
};
samples = jsfxlib.createWaves(audioLibParams);
//if(gesture.type=="keyTap"){
samples.test2.play();
//}
}
</script>
</head>
<body>
<h1>Leap Motion JavaScript Sample</h1>
<div id="main">
</div>
</body>
</html>