Futuristic Stopwatch - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Futuristic Stopwatch</title> <style> body { font-family: 'Orbitron', sans-serif; background: radial-gradient(circle, #0f2027, #203a43, #2c5364); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; color: #fff; } .stopwatch { background: rgba(0, 0, 0, 0.8); border-radius: 15px; padding: 30px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); } .stopwatch .time { font-size: 3rem; margin-bottom: 20px; } .stopwatch .buttons { display: flex; justify-content: space-between; } .stopwatch button { background: #1f4068; border: none; border-radius: 50px; color: #fff; font-size: 1rem; padding: 10px 20px; cursor: pointer; transition: background 0.3s, transform 0.3s; } .stopwatch button:hover { background: #162447; } .stopwatch button:active { transform: scale(0.95); } .stopwatch button:focus { outline: none; } .stopwatch .start-btn { animation: pulse 2s infinite; } @keyframes pulse { 0% { box-shadow: 0 0 10px rgba(31, 64, 104, 0.7); } 50% { box-shadow: 0 0 20px rgba(31, 64, 104, 0.7); } 100% { box-shadow: 0 0 10px rgba(31, 64, 104, 0.7); } } </style> </head> <body> <div class="stopwatch"> <div class="time">00:00:00</div> <div class="buttons"> <button type="button" class="start-btn">Start ⏱️</button> <button type="button" class="reset-btn">Reset 🔄</button> </div> </div> <script> let timeDisplay = document.querySelector('.time'); let startBtn = document.querySelector('.start-btn'); let resetBtn = document.querySelector('.reset-btn'); let intervalId; let elapsedTime = 0; let running = false; startBtn.addEventListener('click', function() { if (!running) { intervalId = setInterval(() => { elapsedTime += 10; let date = new Date(elapsedTime); let minutes = String(date.getMinutes()).padStart(2, '0'); let seconds = String(date.getSeconds()).padStart(2, '0'); let milliseconds = String(date.getMilliseconds()).padStart(3, '0').slice(0, -1); timeDisplay.textContent = `${minutes}:${seconds}:${milliseconds}`; }, 10); running = true; startBtn.textContent = 'Pause ⏸️'; } else { clearInterval(intervalId); running = false; startBtn.textContent = 'Start ⏱️'; } }); resetBtn.addEventListener('click', function() { clearInterval(intervalId); elapsedTime = 0; timeDisplay.textContent = '00:00:00'; running = false; startBtn.textContent = 'Start ⏱️'; }); </script> </body> </html>