-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
55 lines (50 loc) · 1.49 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0" />
<link rel="stylesheet" media="all" href="res/css/style.css" />
<link rel="shortcut icon" href="favicon.ico" />
<title>DEMO PAGE</title>
</head>
<body>
<style>
body {
overflow: hidden;
}
img {
position: absolute;
top: 0;
left: 0;
height: auto;
width: auto;
max-height: 100%;
max-width: 100%
}
#pointer {
transform: rotate(-11deg);
}
</style>
<img src="odometer.jpg" />
<img src="pointer.png" id="pointer">
<script>
var connection = new WebSocket('ws://localhost:8765');
connection.onopen = function () {
//connection.send('Ping'); // Send the message 'Ping' to the server
};
// Log errors
connection.onerror = function (error) {
console.log('WebSocket Error ' + error);
};
// Log messages from the server
connection.onmessage = function (e) {
console.log('Server: ' + e.data);
var rot = +e.data;
rot *= 1.8;
rot -= 11;
console.log(rot);
document.getElementById("pointer").style.transform = 'rotate('+rot+'deg)';
};
</script>
</body>
</html>