// Geri sayım için bitiş zamanını ayarlayalım (şu andan 2 saat sonrası) const endTime = new Date().getTime() + (24 * 60 * 60 * 1000); // Sayıları animasyonlu göstermek için yardımcı fonksiyon function animateValue(element, start, end, duration) { const range = end - start; const increment = range / (duration / 16); let current = start; const timer = setInterval(() => { current += increment; if ((increment > 0 && current >= end) || (increment < 0 && current <= end)) { clearInterval(timer); current = end; } element.textContent = Math.floor(current).toString().padStart(2, '0'); }, 16); } // Geri sayım fonksiyonu function updateCountdown() { const now = new Date().getTime(); const timeLeft = endTime - now; // Zamanı hesapla const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((timeLeft % (1000 * 60)) / 1000); // DOM elementlerini güncelle const hoursElement = document.getElementById('hours'); const minutesElement = document.getElementById('minutes'); const secondsElement = document.getElementById('seconds'); const currentHours = parseInt(hoursElement.textContent); const currentMinutes = parseInt(minutesElement.textContent); const currentSeconds = parseInt(secondsElement.textContent); if (currentHours !== hours) { animateValue(hoursElement, currentHours, hours, 500); } if (currentMinutes !== minutes) { animateValue(minutesElement, currentMinutes, minutes, 500); } if (currentSeconds !== seconds) { animateValue(secondsElement, currentSeconds, seconds, 500); } // Geri sayım bittiğinde if (timeLeft < 0) { clearInterval(countdownInterval); document.getElementById('hours').textContent = '00'; document.getElementById('minutes').textContent = '00'; document.getElementById('seconds').textContent = '00'; } } // Sayfa yüklendiğinde animasyonları başlat document.addEventListener('DOMContentLoaded', () => { // Progress bar animasyonu const progressBar = document.querySelector('.progress-bar'); progressBar.style.width = '0%'; setTimeout(() => { progressBar.style.width = '75%'; }, 500); }); // İlk çağrı updateCountdown(); // Her saniye güncelle const countdownInterval = setInterval(updateCountdown, 1000); // Dişli animasyonunu yavaşlat document.querySelector('.maintenance-icon').style.animationDuration = '8s';