From 50f6e1dfe34772e27dd49b3206940352fc383002 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Wed, 4 Mar 2026 01:59:18 +0800 Subject: [PATCH] feat: add real-time weather animations (rain, snow, fog, storm, clouds) --- web/static/app.js | 8 ++ web/static/index.html | 6 + web/static/style.css | 71 +++++++++ web/static/weather-anim.js | 285 +++++++++++++++++++++++++++++++++++++ 4 files changed, 370 insertions(+) create mode 100644 web/static/weather-anim.js diff --git a/web/static/app.js b/web/static/app.js index 2914e1c9..1210a788 100644 --- a/web/static/app.js +++ b/web/static/app.js @@ -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(); } // ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ diff --git a/web/static/index.html b/web/static/index.html index ebe2679f..d6d1ad89 100644 --- a/web/static/index.html +++ b/web/static/index.html @@ -63,6 +63,11 @@