File size: 3,219 Bytes
38dfb36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Speed Test UI</title>
  <script src="https://cdn.tailwindcss.com"></script>
  <style>

    body {

      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    }



    #progress {

      transform: rotate(-90deg);

      transform-origin: center;

      transition: stroke-dasharray 1s ease-in-out;

    }



    .glow {

      box-shadow: 0 0 30px #3b82f6, 0 0 60px #3b82f6;

    }

  </style>
</head>
<body class="bg-[#0f172a] h-screen flex items-center justify-center">

  <!-- Container -->
  <div class="relative w-[600px] h-[400px] bg-[#1e293b] rounded-xl shadow-xl glow">
    <!-- Gauge -->
    <div class="flex items-center justify-center h-full">
      <div class="relative">
        <svg class="w-64 h-64" viewBox="0 0 36 36">
          <path class="text-gray-700" fill="none" stroke="currentColor" stroke-width="4" d="M18 2a16 16 0 0 1 0 32 16 16 0 0 1 0-32"></path>
          <path id="progress" fill="none" stroke="#3b82f6" stroke-width="4" stroke-linecap="round" stroke-dasharray="0, 100" d="M18 2a16 16 0 0 1 0 32 16 16 0 0 1 0-32"></path>
        </svg>
        <div class="absolute inset-0 flex items-center justify-center text-white text-5xl font-bold" id="speed">0</div>
        <div class="absolute bottom-5 left-10 text-white">
          <span class="text-sm">Ping</span>
          <div class="text-lg" id="ping">-- ms</div>
        </div>
        <div class="absolute bottom-5 right-10 text-white">
          <span class="text-sm">Download</span>
          <div class="text-lg" id="download">-- Mbps</div>
        </div>
      </div>
    </div>

    <!-- Light Effect -->
    <div class="absolute inset-x-0 bottom-0 h-1/4 bg-gradient-to-t from-blue-600 opacity-75 animate-pulse"></div>
  </div>

  <script>

    // Fake speed test animation

    const speedElement = document.getElementById('speed');

    const pingElement = document.getElementById('ping');

    const downloadElement = document.getElementById('download');

    const progressElement = document.getElementById('progress');



    let speed = 0;

    let progress = 0;



    function animateSpeed() {

      const targetSpeed = Math.floor(Math.random() * 150) + 50;  // Random speed between 50-200 Mbps

      const ping = Math.floor(Math.random() * 50) + 10;          // Random ping 10-50 ms

      const download = (targetSpeed - Math.random() * 10).toFixed(2);



      let interval = setInterval(() => {

        if (speed >= targetSpeed) {

          clearInterval(interval);

        } else {

          speed += 2;

          progress = (speed / 200) * 100;

          speedElement.textContent = speed;

          progressElement.style.strokeDasharray = `${progress}, 100`;

        }

      }, 50);



      setTimeout(() => {

        pingElement.textContent = `${ping} ms`;

        downloadElement.textContent = `${download} Mbps`;

      }, 2000);

    }



    // Start animation after DOM load

    document.addEventListener('DOMContentLoaded', () => {

      animateSpeed();

    });

  </script>

</body>
</html>