feat: add real-time weather animations (rain, snow, fog, storm, clouds)

This commit is contained in:
2569718930@qq.com
2026-03-04 01:59:18 +08:00
parent fd24d369aa
commit 50f6e1dfe3
4 changed files with 370 additions and 0 deletions
+8
View File
@@ -255,6 +255,12 @@ function renderPanel(data) {
// Trigger reflow for animation
requestAnimationFrame(() => panel.classList.add("visible"));
// Start weather animation
if (typeof WeatherAnim !== "undefined") {
// Small delay for canvas to be in DOM
setTimeout(() => WeatherAnim.start(data), 100);
}
// Header
document.getElementById("panelCityName").textContent =
`${data.risk?.emoji || "🏙️"} ${data.display_name}`;
@@ -710,6 +716,8 @@ function closePanel() {
document
.querySelectorAll(".city-item")
.forEach((el) => el.classList.remove("active"));
// Stop weather animation
if (typeof WeatherAnim !== "undefined") WeatherAnim.stop();
}
// ──────────────────────────────────────────────────────────