forked from sebmatton/jQuery-Flight-Indicators
-
Notifications
You must be signed in to change notification settings - Fork 11
/
instrument_vario_meter.html
executable file
·76 lines (56 loc) · 1.91 KB
/
instrument_vario_meter.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
<!--
Skyhawk Flight Instruments (https://github.com/uw-ray/Skyhawk-Flight-Instruments)
By Raymond Blaga ([email protected]), Edward Hanna ([email protected]), Pavlo Kuzhel ([email protected])
Forked from jQuery Flight Indicators (https://github.com/sebmatton/jQuery-Flight-Indicators)
By Sébastien Matton ([email protected])
Published under GPLv3 License.
-->
<!DOCTYPE html>
<meta charset="utf-8">
<html lang="en" dir="ltr">
<head>
<title>Variometer</title>
<script src="js/jquery-1.11.3.js"></script>
<script src="js/d3.min.js"></script>
<script src="js/jquery.flightindicators.js"></script>
<link rel="stylesheet" type="text/css" href="css/flightindicators.css" />
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css" />
</head>
<body>
<div class="examples text-center">
<div>
<span id="variometer"></span>
</div>
<div>
<button id="variometerButton" class="btn btn-default" type="submit">Button</button>
</div>
</div>
<script type="text/javascript">
var increment = 0;
var clockwise = true;
var variometer = $.flightIndicator('#variometer', 'variometer', {vario:0});
function doVariometer(){
var myInterval = setInterval(function() {
$("#variometerButton").text("Playing");
if (increment > 45) clockwise = false;
if (increment < - 45) clockwise = true;
if (clockwise) increment += 0.5;
else increment -= 0.5;
variometer.setVario(increment);
if(increment == 157){
clearInterval(myInterval);
$("#variometerButton").attr('disabled',false);
variometer.setVario(0);
$("#variometerButton").text("Start");
}
}, 50);
}
$("#variometerButton").text("Start");
$("#variometerButton").on("click", function() {
$("#variometerButton").attr('disabled', true);
doVariometer();
});
</script>
</body>
</html>