-
Notifications
You must be signed in to change notification settings - Fork 0
/
speedometer.html
53 lines (48 loc) · 1.56 KB
/
speedometer.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-color: rgba(0, 0, 0, 0.8);
color: white;
font-family: Arial, sans-serif;
font-size: 24px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 10px;
border-radius: 5px;
}
.speed-value {
display: inline-block;
animation: jump 1s ease-in-out infinite;
}
@keyframes jump {
0% { transform: translateY(0); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0); }
}
</style>
</head>
<body>
<div id="speed">
<span class="speed-value" id="speed-value"></span>
<span>km/h</span>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
<script>
// Actualizar la visualización de velocidad
function updateSpeedDisplay() {
// Obtener la velocidad del vehículo en m/s
let speed = parseFloat(GetResourceMetadata(GetCurrentResourceName(), "speed", 0));
// Mostrar la velocidad en la pantalla
document.getElementById("speed-value").innerText = (speed * 3.6).toFixed(1);
}
// Actualizar la visualización de velocidad cada frame
setInterval(updateSpeedDisplay, 0);
</script>
</body>
</html>