| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Ultrasonic Radar Detection System</title> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> |
| <style> |
| .radar { |
| position: relative; |
| width: 300px; |
| height: 300px; |
| border-radius: 50%; |
| background: linear-gradient(to bottom, #0a2e38 0%, #1b1b2f 100%); |
| box-shadow: 0 0 20px rgba(0, 255, 255, 0.3); |
| overflow: hidden; |
| } |
| |
| .radar::before { |
| content: ''; |
| position: absolute; |
| top: 50%; |
| left: 50%; |
| transform: translate(-50%, -50%); |
| width: 10px; |
| height: 10px; |
| background: #00ff00; |
| border-radius: 50%; |
| z-index: 10; |
| } |
| |
| .radar::after { |
| content: ''; |
| position: absolute; |
| top: 50%; |
| left: 50%; |
| transform: translate(-50%, -50%); |
| width: 5px; |
| height: 5px; |
| background: #00ff00; |
| border-radius: 50%; |
| box-shadow: 0 0 5px #00ff00; |
| z-index: 10; |
| } |
| |
| .radar-scan { |
| position: absolute; |
| top: 50%; |
| left: 50%; |
| transform: translate(-50%, -50%); |
| width: 100%; |
| height: 100%; |
| border-radius: 50%; |
| background: linear-gradient(45deg, transparent 49%, rgba(0, 255, 0, 0.2) 50%, transparent 51%); |
| animation: rotate 4s linear infinite; |
| } |
| |
| .radar-circle { |
| position: absolute; |
| top: 50%; |
| left: 50%; |
| transform: translate(-50%, -50%); |
| border: 1px solid rgba(0, 255, 0, 0.3); |
| border-radius: 50%; |
| } |
| |
| .radar-line { |
| position: absolute; |
| top: 50%; |
| left: 50%; |
| transform-origin: left center; |
| width: 50%; |
| height: 1px; |
| background: rgba(0, 255, 0, 0.5); |
| } |
| |
| .object { |
| position: absolute; |
| width: 8px; |
| height: 8px; |
| background: #00ff00; |
| border-radius: 50%; |
| transform: translate(-50%, -50%); |
| box-shadow: 0 0 10px #00ff00; |
| z-index: 5; |
| } |
| |
| @keyframes rotate { |
| 0% { transform: translate(-50%, -50%) rotate(0deg); } |
| 100% { transform: translate(-50%, -50%) rotate(360deg); } |
| } |
| |
| @keyframes pulse { |
| 0% { opacity: 0.3; } |
| 50% { opacity: 1; } |
| 100% { opacity: 0.3; } |
| } |
| |
| .distance-indicator { |
| animation: pulse 2s infinite; |
| } |
| </style> |
| </head> |
| <body class="bg-gray-900 text-gray-100 min-h-screen flex flex-col items-center justify-center p-4"> |
| <div class="max-w-4xl w-full"> |
| <h1 class="text-3xl font-bold text-center mb-6 text-cyan-400"> |
| <i class="fas fa-radar mr-2"></i> Ultrasonic Radar Detection System |
| </h1> |
| |
| <div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> |
| <div class="flex flex-col items-center"> |
| <div class="radar mb-6"> |
| <div class="radar-circle" style="width: 80%; height: 80%;"></div> |
| <div class="radar-circle" style="width: 60%; height: 60%;"></div> |
| <div class="radar-circle" style="width: 40%; height: 40%;"></div> |
| <div class="radar-circle" style="width: 20%; height: 20%;"></div> |
| |
| <div class="radar-line" style="transform: translate(-50%, -50%) rotate(0deg);"></div> |
| <div class="radar-line" style="transform: translate(-50%, -50%) rotate(90deg);"></div> |
| <div class="radar-line" style="transform: translate(-50%, -50%) rotate(45deg);"></div> |
| <div class="radar-line" style="transform: translate(-50%, -50%) rotate(135deg);"></div> |
| |
| <div class="radar-scan"></div> |
| |
| |
| </div> |
| |
| <div class="flex space-x-4 mb-6"> |
| <button id="startBtn" class="px-6 py-2 bg-green-600 hover:bg-green-700 rounded-lg font-medium transition"> |
| <i class="fas fa-play mr-2"></i> Start |
| </button> |
| <button id="stopBtn" class="px-6 py-2 bg-red-600 hover:bg-red-700 rounded-lg font-medium transition"> |
| <i class="fas fa-stop mr-2"></i> Stop |
| </button> |
| </div> |
| </div> |
| |
| <div class="bg-gray-800 rounded-xl p-6 shadow-lg"> |
| <h2 class="text-xl font-semibold mb-4 text-cyan-300"> |
| <i class="fas fa-info-circle mr-2"></i> Detection Information |
| </h2> |
| |
| <div class="grid grid-cols-2 gap-4 mb-6"> |
| <div class="bg-gray-700 p-4 rounded-lg"> |
| <h3 class="text-sm font-medium text-gray-400">Objects Detected</h3> |
| <p id="objectCount" class="text-2xl font-bold text-green-400">0</p> |
| </div> |
| |
| <div class="bg-gray-700 p-4 rounded-lg"> |
| <h3 class="text-sm font-medium text-gray-400">Max Distance</h3> |
| <p class="text-2xl font-bold text-cyan-400">400 cm</p> |
| </div> |
| </div> |
| |
| <div class="mb-6"> |
| <h3 class="text-lg font-medium mb-2 text-gray-300"> |
| <i class="fas fa-ruler mr-2"></i> Distance Indicators |
| </h3> |
| <div class="flex items-center justify-between mb-1"> |
| <span class="text-xs">0 cm</span> |
| <span class="text-xs">100 cm</span> |
| <span class="text-xs">200 cm</span> |
| <span class="text-xs">300 cm</span> |
| <span class="text-xs">400 cm</span> |
| </div> |
| <div class="w-full bg-gray-700 h-4 rounded-full overflow-hidden"> |
| <div id="distanceBar" class="h-full bg-gradient-to-r from-green-500 via-yellow-500 to-red-500" style="width: 0%"></div> |
| </div> |
| </div> |
| |
| <div> |
| <h3 class="text-lg font-medium mb-2 text-gray-300"> |
| <i class="fas fa-bell mr-2"></i> Detection Log |
| </h3> |
| <div id="detectionLog" class="bg-gray-700 p-3 rounded-lg h-40 overflow-y-auto text-sm"> |
| <div class="text-gray-400 italic">No objects detected yet...</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| <div class="mt-8 bg-gray-800 rounded-xl p-6"> |
| <h2 class="text-xl font-semibold mb-4 text-cyan-300"> |
| <i class="fas fa-cogs mr-2"></i> System Configuration |
| </h2> |
| |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-6"> |
| <div> |
| <label class="block text-sm font-medium mb-1">Scan Speed</label> |
| <select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2"> |
| <option>Slow</option> |
| <option selected>Normal</option> |
| <option>Fast</option> |
| </select> |
| </div> |
| |
| <div> |
| <label class="block text-sm font-medium mb-1">Sensitivity</label> |
| <input type="range" min="1" max="10" value="7" class="w-full"> |
| </div> |
| |
| <div> |
| <label class="block text-sm font-medium mb-1">Detection Range</label> |
| <div class="flex items-center space-x-2"> |
| <input type="number" value="400" class="w-20 bg-gray-700 border border-gray-600 rounded-md px-3 py-2"> |
| <span class="text-sm">cm</span> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
|
|
| <script> |
| document.addEventListener('DOMContentLoaded', function() { |
| const radar = document.querySelector('.radar'); |
| const startBtn = document.getElementById('startBtn'); |
| const stopBtn = document.getElementById('stopBtn'); |
| const objectCount = document.getElementById('objectCount'); |
| const distanceBar = document.getElementById('distanceBar'); |
| const detectionLog = document.getElementById('detectionLog'); |
| |
| let scanInterval; |
| let objectInterval; |
| let isScanning = false; |
| let objects = []; |
| |
| |
| for (let i = 0; i < 4; i++) { |
| const angle = i * 22.5; |
| const line = document.createElement('div'); |
| line.className = 'radar-line'; |
| line.style.transform = `translate(-50%, -50%) rotate(${angle}deg)`; |
| radar.appendChild(line); |
| } |
| |
| |
| startBtn.addEventListener('click', function() { |
| if (isScanning) return; |
| |
| isScanning = true; |
| detectionLog.innerHTML = ''; |
| updateLog('System started. Scanning for objects...', 'system'); |
| |
| |
| scanInterval = setInterval(() => { |
| |
| }, 100); |
| |
| |
| objectInterval = setInterval(() => { |
| |
| document.querySelectorAll('.object').forEach(obj => obj.remove()); |
| objects = []; |
| |
| |
| const numObjects = Math.floor(Math.random() * 5) + 1; |
| objectCount.textContent = numObjects; |
| |
| for (let i = 0; i < numObjects; i++) { |
| const distance = Math.random() * 0.9 + 0.1; |
| const angle = Math.random() * 360; |
| |
| const x = 50 + Math.cos(angle * Math.PI / 180) * distance * 50; |
| const y = 50 + Math.sin(angle * Math.PI / 180) * distance * 50; |
| |
| const object = document.createElement('div'); |
| object.className = 'object'; |
| object.style.left = `${x}%`; |
| object.style.top = `${y}%`; |
| |
| |
| const indicator = document.createElement('div'); |
| indicator.className = 'distance-indicator absolute w-2 h-2 bg-green-500 rounded-full'; |
| indicator.style.left = `${x}%`; |
| indicator.style.top = `${y}%`; |
| indicator.style.transform = 'translate(-50%, -50%)'; |
| |
| radar.appendChild(object); |
| objects.push({distance, angle}); |
| |
| |
| const realDistance = Math.round(distance * 400); |
| distanceBar.style.width = `${distance * 100}%`; |
| |
| |
| updateLog(`Object detected at ${realDistance} cm, ${Math.round(angle)}°`, 'detection'); |
| } |
| }, 2000); |
| }); |
| |
| |
| stopBtn.addEventListener('click', function() { |
| if (!isScanning) return; |
| |
| isScanning = false; |
| clearInterval(scanInterval); |
| clearInterval(objectInterval); |
| |
| |
| document.querySelectorAll('.object').forEach(obj => obj.remove()); |
| objectCount.textContent = '0'; |
| distanceBar.style.width = '0%'; |
| |
| updateLog('System stopped.', 'system'); |
| }); |
| |
| |
| function updateLog(message, type) { |
| const now = new Date(); |
| const timeString = now.toLocaleTimeString(); |
| |
| const logEntry = document.createElement('div'); |
| logEntry.className = `mb-1 ${type === 'system' ? 'text-cyan-400' : 'text-green-400'}`; |
| logEntry.innerHTML = `<span class="text-gray-500 text-xs">[${timeString}]</span> ${message}`; |
| |
| detectionLog.prepend(logEntry); |
| |
| |
| if (detectionLog.children.length > 10) { |
| detectionLog.removeChild(detectionLog.lastChild); |
| } |
| } |
| |
| |
| setTimeout(() => { |
| updateLog('Ultrasonic radar system initialized.', 'system'); |
| updateLog('Ready to start scanning.', 'system'); |
| }, 500); |
| }); |
| </script> |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Aragoorn/2-3" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
| </html> |