minigame_main.js 652 B

1234567891011121314151617
  1. let countdownNumber = 30;
  2. const countdownElement = document.getElementById('countdown');
  3. const countdownCircle = document.querySelector('.countdown-circle');
  4. const countdownInterval = setInterval(() => {
  5. countdownNumber--;
  6. countdownElement.textContent = countdownNumber;
  7. // Update the circle progress
  8. countdownCircle.style.background = `conic-gradient(#E6871D ${360 - ((30 - countdownNumber) / 30) * 360}deg, lightgray 0)`;
  9. if (countdownNumber <= 0) {
  10. clearInterval(countdownInterval);
  11. // Call the function to send data to the server when the countdown reaches zero
  12. sendAnswersToServer();
  13. }
  14. }, 1000);