Spaces:
Running
Running
can you make the real time performance dashboard more functional instead of it constantly changing make the time interval every 5 seconds
Browse files- index.html +21 -26
index.html
CHANGED
|
@@ -474,36 +474,31 @@
|
|
| 474 |
document.addEventListener('DOMContentLoaded', function() {
|
| 475 |
const metrics = ['confidence-level', 'stress-level', 'focus-level'];
|
| 476 |
const performanceBar = document.getElementById('performance-bar');
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
element.textContent = current + '%';
|
| 488 |
-
|
| 489 |
-
if (current === target) {
|
| 490 |
-
clearInterval(interval);
|
| 491 |
-
setTimeout(animateMetrics, 2000);
|
| 492 |
-
}
|
| 493 |
-
}, 30);
|
| 494 |
-
});
|
| 495 |
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
|
|
|
|
|
|
| 499 |
performanceBar.style.background = `linear-gradient(to right,
|
| 500 |
-
${
|
| 501 |
-
${
|
| 502 |
}
|
| 503 |
|
| 504 |
-
//
|
| 505 |
-
|
| 506 |
-
|
|
|
|
| 507 |
// Initialize Vanta.js background
|
| 508 |
VANTA.GLOBE({
|
| 509 |
el: "#vanta-bg",
|
|
|
|
| 474 |
document.addEventListener('DOMContentLoaded', function() {
|
| 475 |
const metrics = ['confidence-level', 'stress-level', 'focus-level'];
|
| 476 |
const performanceBar = document.getElementById('performance-bar');
|
| 477 |
+
function updateMetrics() {
|
| 478 |
+
const realisticValues = [
|
| 479 |
+
{ confidence: 87, stress: 42, focus: 93, width: 72 },
|
| 480 |
+
{ confidence: 78, stress: 38, focus: 88, width: 68 },
|
| 481 |
+
{ confidence: 92, stress: 29, focus: 95, width: 82 },
|
| 482 |
+
{ confidence: 84, stress: 45, focus: 90, width: 76 },
|
| 483 |
+
{ confidence: 89, stress: 33, focus: 91, width: 79 }
|
| 484 |
+
];
|
| 485 |
+
|
| 486 |
+
const currentValues = realisticValues[Math.floor(Math.random() * realisticValues.length)];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
|
| 488 |
+
document.getElementById('confidence-level').textContent = currentValues.confidence + '%';
|
| 489 |
+
document.getElementById('stress-level').textContent = currentValues.stress + '%';
|
| 490 |
+
document.getElementById('focus-level').textContent = currentValues.focus + '%';
|
| 491 |
+
|
| 492 |
+
performanceBar.style.width = `${currentValues.width}%`;
|
| 493 |
performanceBar.style.background = `linear-gradient(to right,
|
| 494 |
+
${currentValues.width < 30 ? '#ef4444' : currentValues.width < 70 ? '#f59e0b' : '#10b981'},
|
| 495 |
+
${currentValues.width < 30 ? '#f59e0b' : currentValues.width < 70 ? '#10b981' : '#3b82f6'})`;
|
| 496 |
}
|
| 497 |
|
| 498 |
+
// Update every 5 seconds
|
| 499 |
+
updateMetrics();
|
| 500 |
+
setInterval(updateMetrics, 5000);
|
| 501 |
+
});
|
| 502 |
// Initialize Vanta.js background
|
| 503 |
VANTA.GLOBE({
|
| 504 |
el: "#vanta-bg",
|