-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
88 lines (78 loc) · 2.15 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
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Javascript Metronome</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<style>
.example {
font-family: Arial;
font-size: 12px;
}
.status {
width: 100px;
height: 200px;
padding: 10px;
overflow-y: auto;
}
.statusline {
font-size: 10px;
background-color: #E0E0E0;
margin: 3px 0;
padding: 2px;
}
.metr_input {
width: 40px;
margin-right: 10px;
text-align: center;
}
#count {
width: 50px;
display: inline-block;
text-align: right;
}
</style>
</head>
<body>
<table class="example">
<tr>
<td><div id="metronome_container"></div></td>
<td><div class="status"></div></td>
</tr>
<tr>
<td colspan=2 id="inputs"></td>
</tr>
</table>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="metronome.js"></script>
<script>
/*global $ Raphael soundManager metronome*/
function tick(t) {
$("<div />").html(t % 2 === 1 ? "Tick" : "Tock").addClass("statusline").appendTo(".status");
$("#count").html(t);
}
function done() {
$("<div />").html("Done!").addClass("statusline").css("background-color", "#FFFF99").appendTo(".status");
$("#startstop").html("start");
}
var paper = Raphael("metronome_container", 200, 200);
var m = metronome({
len: 200,
angle: 20,
tick: tick,
complete: done,
paper: paper,
audio: "https://github.com/wilson428/metronome/blob/master/tick.wav?raw=true"
});
m.make_input("#inputs");
m.shapes().outline.attr("fill", "#00A30F");
m.shapes().arm.attr("stroke", "#EEE");
</script>
</body>
</html>