Fazbeeer commited on
Commit
7e6551f
·
verified ·
1 Parent(s): 582b0e3

can you make the real time performance dashboard more functional instead of it constantly changing make the time interval every 5 seconds

Browse files
Files changed (1) hide show
  1. 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
- function animateMetrics() {
479
- metrics.forEach(metric => {
480
- const element = document.getElementById(metric);
481
- const target = Math.floor(Math.random() * 30) + 70;
482
- let current = parseInt(element.textContent);
483
- const increment = target > current ? 1 : -1;
484
-
485
- const interval = setInterval(() => {
486
- current += increment;
487
- element.textContent = current + '%';
488
-
489
- if (current === target) {
490
- clearInterval(interval);
491
- setTimeout(animateMetrics, 2000);
492
- }
493
- }, 30);
494
- });
495
 
496
- // Animate performance bar
497
- const newWidth = Math.floor(Math.random() * 30) + 60;
498
- performanceBar.style.width = `${newWidth}%`;
 
 
499
  performanceBar.style.background = `linear-gradient(to right,
500
- ${newWidth < 30 ? '#ef4444' : newWidth < 70 ? '#f59e0b' : '#10b981'},
501
- ${newWidth < 30 ? '#f59e0b' : newWidth < 70 ? '#10b981' : '#3b82f6'})`;
502
  }
503
 
504
- // Start the animation
505
- animateMetrics();
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",