Untitled
unknown
plain_text
6 months ago
1.8 kB
3
Indexable
} function returnPresent() { clearInterval(timeTravelInterval); currentYear = 2023; yearDisplay.textContent = currentYear; document.querySelector('.portal').style.animationDuration = '4s'; } function createWeatherElement(type) { const element = document.createElement('div'); element.style.position = 'absolute'; element.style.width = '2px'; element.style.height = type === 'rain' ? '10px' : '5px'; element.style.background = type === 'rain' ? '#4f9fff' : '#fff'; element.style.left = Math.random() * 100 + '%'; element.style.top = '-10px'; element.style.animation = `${type === 'rain' ? 'raindrop' : 'snowflake'} ${Math.random() * 1 + 1}s linear infinite`; return element; } function createSunRay() { const ray = document.createElement('div'); ray.style.position = 'absolute'; ray.style.width = '100%'; ray.style.height = '100%'; ray.style.background = 'radial-gradient(circle, rgba(255,255,0,0.3) 0%, transparent 70%)'; ray.style.animation = 'sunray 4s linear infinite'; return ray; } function setWeather(weather) { currentWeather = weather; weatherDisplay.textContent = weather.charAt(0).toUpperCase() + weather.slice(1); // Clear all weather effects rain.style.display = 'none'; snow.style.display = 'none'; sunRays.style.display = 'none'; rain.innerHTML = ''; snow.innerHTML = ''; sunRays.innerHTML = ''; if(weather === 'rain') { rain.style.display = 'block'; for(let i = 0; i < 50; i++) { rain.appendChild(createWeatherElement('rain')); } } else if(weather === 'snow') { snow.style.display = 'block'; for(let i = 0; i < 50; i++) { snow.appendChild(createWeatherElement('snow')); } } else if(weather === 'sunny') { sunRays.style.display = 'block'; sunRays.appendChild(createSunRay()); } } </script> </body></html>
Editor is loading...
Leave a Comment