Changement compteur

This commit is contained in:
Serge NOEL
2026-02-23 13:21:15 +01:00
parent 49b731c26c
commit 1376be6797
3 changed files with 11 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ var Loco = {
Dir: LOCO_DIR.FORWARD,
Scale: 1, // Example real loco speed is 45Kmh/max, so what are step (128 for digital to represent 0-200Kmh) per Kmh
MaxSpeed: 100, // Max speed in DCC step (<129) to reach scale speed (e.g. 45Kmh)
TotalDist: 0, // Total distance traveled in kilometers (scaled)
setMode: function(mode) {
this.Mode = mode;
},

View File

@@ -32,6 +32,9 @@
<svg width="300" height="200" viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
<image href="img/Speed.png" x="0" y="0" width="300" height="200"/>
<line id="needle" x1="150" y1="120" x2="150" y2="70" stroke="#e74c3c" stroke-width="6" stroke-linecap="round" />
<text id="kmText" x="280" y="160" font-size="20" text-anchor="end" fill="#333">
0
</text>
</svg>
</div>
<div style="text-align:center; margin-top:20px;">

View File

@@ -1,6 +1,7 @@
<svg width="500" height="405" xmlns="http://www.w3.org/2000/svg">
<image href="speed.png" x="0" y="0" width="500" height="405"/>
<!-- SVG needle overlay -->
<line id="needle" x1="200" y1="200" x2="150" y2="50" stroke="#e74c3c" stroke-width="6"/>
<svg width="300" height="200" viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
<image href="img/Speed.png" x="0" y="0" width="300" height="200"/>
<line id="needle" x1="150" y1="120" x2="150" y2="70" stroke="#e74c3c" stroke-width="6" stroke-linecap="round" />
<text id="kmText" x="280" y="160" font-size="20" text-anchor="end" fill="#333">
0
</text>
</svg>

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 414 B