-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
132 lines (104 loc) · 2.74 KB
/
index.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="stuff, to, help, search, engines, not" name="keywords">
<meta content="What this page is about." name="description">
<meta content="Display Webcam Stream" name="title">
<title>Display Webcam Stream</title>
<script src="js/framehandler.js"></script>
<script src="js/imgproc.js"></script>
<script src="js/panopticon.js"></script>
<script src="js/jquery.js"></script>
<script>
$(document).ready(function(){
var top = 200;
var side = 600;
var rotate = 0;
var speedUp = 0;
var speedSide = 0;
var rotateSpeed = 0;
var options = {
verbose: true,
interval: 35,
showVideo: true,
elementId: 'container'
};
var p = new Panopticon(options);
p.onFrame(moveBallAround);
function moveBallAround(obj){
//obj has three properties
//
//left--how much movement left is in the frame
//top--how much movement towards the top is in the frame
//twist--how much twistiness is in the frame
speedUp = speedUp + obj.top;
speedSide = speedSide + obj.left;
rotateSpeed = rotateSpeed + obj.twist;
top = top + speedUp;
side = side + speedSide;
rotate = rotate + rotateSpeed;
if (top < 0){top = 0;}
if (top > 560){top = 560;}
if (side < 0){side=0;}
if (side > 1180){side = 1180}
document.getElementById("temp").style.top = top+"px";
document.getElementById("temp").style.left = side+"px";
document.getElementById("temp").style.transform = "rotate("+Math.round(rotate)+"deg)";
}
var playingBlankSpace = false;
$(document).keypress(function(e) {
var tSwiftBlankSpace = document.getElementById('tSwiftBlankSpace');
if(e.which == 13) {
if(!playingBlankSpace) {
tSwiftBlankSpace.play();
playingBlankSpace = true;
} else {
tSwiftBlankSpace.pause();
playingBlankSpace = false;
};
};
});
var playingStyle = false;
$(document).keypress(function(e) {
var tSwiftStyle = document.getElementById('tSwiftStyle');
if(e.which == 97) {
if(!playingStyle) {
tSwiftStyle.play();
playingStyle = true;
} else {
tSwiftStyle.pause();
playingStyle = false;
};
};
});
$(document).keypress(function(e) {
var scratch = document.getElementById('scratch');
if(e.which == 98) {
tSwiftStyle.pause();
scratch.play();
setTimeout(function() {
tSwiftStyle.play();
}, 700)
};
});
});
</script>
<style>
</style>
</head>
<body>
<div>
<audio id="tSwiftBlankSpace" src='/audio/blankSpace.mp3' controls></audio>
</div>
<div>
<audio id="tSwiftStyle" src='/audio/style.mp3' controls></audio>
</div>
<div>
<audio id="scratch" src='/audio/recordScratch.mp3' controls></audio>
</div>
<canvas id="container">
</canvas>
<img id="temp" style="position: absolute; left: 600px; top: 200px;" src="img/Chrome_logo.png"></img>
</body>
</html>