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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="zh-CN">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Apple 风格天气卡片 - 增强版</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root {
|
| 9 |
+
--card-width: 280px;
|
| 10 |
+
--card-height: 400px;
|
| 11 |
+
--card-radius: 24px;
|
| 12 |
+
--primary-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
| 13 |
+
|
| 14 |
+
/* 深色模式变量 */
|
| 15 |
+
--bg-color: #000;
|
| 16 |
+
--text-color: #fff;
|
| 17 |
+
--card-bg-wind: linear-gradient(135deg, #2c3e50, #1a2530);
|
| 18 |
+
--card-bg-rain: linear-gradient(135deg, #1a2a3a, #0d1520);
|
| 19 |
+
--card-bg-sunny: linear-gradient(135deg, #1e3c72, #2a5298);
|
| 20 |
+
--card-bg-snow: linear-gradient(135deg, #243949, #141e30);
|
| 21 |
+
--header-gradient: linear-gradient(90deg, #64b5f6, #e0f7fa);
|
| 22 |
+
--card-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
|
| 23 |
+
--btn-bg: rgba(255, 255, 255, 0.1);
|
| 24 |
+
--btn-hover: rgba(255, 255, 255, 0.2);
|
| 25 |
+
--btn-active: linear-gradient(135deg, #64b5f6, #1976d2);
|
| 26 |
+
--detail-bg: rgba(0, 0, 0, 0.3);
|
| 27 |
+
--secondary-text: #aaa;
|
| 28 |
+
--card-border: none;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* 浅色模式变量 */
|
| 32 |
+
[data-theme="light"] {
|
| 33 |
+
--bg-color: #f5f7fa;
|
| 34 |
+
--text-color: #333;
|
| 35 |
+
--card-bg-wind: linear-gradient(135deg, #e0f7fa, #b3e5fc);
|
| 36 |
+
--card-bg-rain: linear-gradient(135deg, #cfd8dc, #b0bec5);
|
| 37 |
+
--card-bg-sunny: linear-gradient(135deg, #ffecb3, #ffe082);
|
| 38 |
+
--card-bg-snow: linear-gradient(135deg, #e8eaf6, #c5cae9);
|
| 39 |
+
--header-gradient: linear-gradient(90deg, #1976d2, #2196f3);
|
| 40 |
+
--card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
| 41 |
+
--btn-bg: rgba(0, 0, 0, 0.05);
|
| 42 |
+
--btn-hover: rgba(0, 0, 0, 0.1);
|
| 43 |
+
--btn-active: linear-gradient(135deg, #1976d2, #64b5f6);
|
| 44 |
+
--detail-bg: rgba(255, 255, 255, 0.7);
|
| 45 |
+
--secondary-text: #666;
|
| 46 |
+
--card-border: 1px solid rgba(0, 0, 0, 0.1);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
* {
|
| 50 |
+
margin: 0;
|
| 51 |
+
padding: 0;
|
| 52 |
+
box-sizing: border-box;
|
| 53 |
+
transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
body {
|
| 57 |
+
font-family: var(--primary-font);
|
| 58 |
+
background-color: var(--bg-color);
|
| 59 |
+
color: var(--text-color);
|
| 60 |
+
min-height: 100vh;
|
| 61 |
+
display: flex;
|
| 62 |
+
flex-direction: column;
|
| 63 |
+
align-items: center;
|
| 64 |
+
justify-content: center;
|
| 65 |
+
padding: 20px;
|
| 66 |
+
overflow-x: hidden;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.header {
|
| 70 |
+
text-align: center;
|
| 71 |
+
margin-bottom: 40px;
|
| 72 |
+
width: 100%;
|
| 73 |
+
position: relative;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.header h1 {
|
| 77 |
+
font-size: 36px;
|
| 78 |
+
font-weight: 600;
|
| 79 |
+
margin-bottom: 10px;
|
| 80 |
+
background: var(--header-gradient);
|
| 81 |
+
-webkit-background-clip: text;
|
| 82 |
+
-webkit-text-fill-color: transparent;
|
| 83 |
+
text-shadow: 0 0 30px rgba(100, 181, 246, 0.3);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.header p {
|
| 87 |
+
font-size: 18px;
|
| 88 |
+
color: var(--secondary-text);
|
| 89 |
+
max-width: 600px;
|
| 90 |
+
margin: 0 auto;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/* 主题切换开关 */
|
| 94 |
+
.theme-switch-wrapper {
|
| 95 |
+
position: absolute;
|
| 96 |
+
top: 0;
|
| 97 |
+
right: 20px;
|
| 98 |
+
display: flex;
|
| 99 |
+
align-items: center;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.theme-switch {
|
| 103 |
+
display: inline-block;
|
| 104 |
+
height: 34px;
|
| 105 |
+
position: relative;
|
| 106 |
+
width: 60px;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.theme-switch input {
|
| 110 |
+
display: none;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.slider {
|
| 114 |
+
background-color: #ccc;
|
| 115 |
+
bottom: 0;
|
| 116 |
+
cursor: pointer;
|
| 117 |
+
left: 0;
|
| 118 |
+
position: absolute;
|
| 119 |
+
right: 0;
|
| 120 |
+
top: 0;
|
| 121 |
+
transition: .4s;
|
| 122 |
+
border-radius: 34px;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.slider:before {
|
| 126 |
+
background-color: white;
|
| 127 |
+
bottom: 4px;
|
| 128 |
+
content: "";
|
| 129 |
+
height: 26px;
|
| 130 |
+
left: 4px;
|
| 131 |
+
position: absolute;
|
| 132 |
+
transition: .4s;
|
| 133 |
+
width: 26px;
|
| 134 |
+
border-radius: 50%;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
input:checked + .slider {
|
| 138 |
+
background-color: #2196F3;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
input:checked + .slider:before {
|
| 142 |
+
transform: translateX(26px);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
.slider-icons {
|
| 146 |
+
position: absolute;
|
| 147 |
+
width: 100%;
|
| 148 |
+
height: 100%;
|
| 149 |
+
display: flex;
|
| 150 |
+
justify-content: space-between;
|
| 151 |
+
align-items: center;
|
| 152 |
+
padding: 0 8px;
|
| 153 |
+
box-sizing: border-box;
|
| 154 |
+
pointer-events: none;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.slider-icons span {
|
| 158 |
+
font-size: 14px;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/* 温度单位切换 */
|
| 162 |
+
.temp-unit-toggle {
|
| 163 |
+
position: absolute;
|
| 164 |
+
top: 0;
|
| 165 |
+
left: 20px;
|
| 166 |
+
background: var(--btn-bg);
|
| 167 |
+
border-radius: 20px;
|
| 168 |
+
padding: 5px 15px;
|
| 169 |
+
cursor: pointer;
|
| 170 |
+
backdrop-filter: blur(10px);
|
| 171 |
+
-webkit-backdrop-filter: blur(10px);
|
| 172 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 173 |
+
color: var(--text-color);
|
| 174 |
+
font-weight: 500;
|
| 175 |
+
transition: all 0.3s ease;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
.temp-unit-toggle:hover {
|
| 179 |
+
background: var(--btn-hover);
|
| 180 |
+
transform: translateY(-2px);
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
.controls {
|
| 184 |
+
display: flex;
|
| 185 |
+
justify-content: center;
|
| 186 |
+
margin-bottom: 30px;
|
| 187 |
+
gap: 15px;
|
| 188 |
+
flex-wrap: wrap;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
.control-btn {
|
| 192 |
+
background: var(--btn-bg);
|
| 193 |
+
border: none;
|
| 194 |
+
color: var(--text-color);
|
| 195 |
+
padding: 12px 24px;
|
| 196 |
+
border-radius: 50px;
|
| 197 |
+
font-size: 16px;
|
| 198 |
+
font-weight: 500;
|
| 199 |
+
cursor: pointer;
|
| 200 |
+
transition: all 0.3s ease;
|
| 201 |
+
backdrop-filter: blur(10px);
|
| 202 |
+
-webkit-backdrop-filter: blur(10px);
|
| 203 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.control-btn:hover {
|
| 207 |
+
background: var(--btn-hover);
|
| 208 |
+
transform: translateY(-2px);
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.control-btn.active {
|
| 212 |
+
background: var(--btn-active);
|
| 213 |
+
box-shadow: 0 5px 15px rgba(25, 118, 210, 0.4);
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
.cards-container {
|
| 217 |
+
display: flex;
|
| 218 |
+
flex-wrap: wrap;
|
| 219 |
+
justify-content: center;
|
| 220 |
+
gap: 30px;
|
| 221 |
+
max-width: 1200px;
|
| 222 |
+
margin: 0 auto;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
.weather-card {
|
| 226 |
+
width: var(--card-width);
|
| 227 |
+
height: var(--card-height);
|
| 228 |
+
border-radius: var(--card-radius);
|
| 229 |
+
overflow: hidden;
|
| 230 |
+
position: relative;
|
| 231 |
+
box-shadow: var(--card-shadow);
|
| 232 |
+
transition: transform 0.5s ease, box-shadow 0.5s ease, height 0.5s ease;
|
| 233 |
+
display: flex;
|
| 234 |
+
flex-direction: column;
|
| 235 |
+
border: var(--card-border);
|
| 236 |
+
cursor: pointer;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
.weather-card:hover {
|
| 240 |
+
transform: translateY(-10px);
|
| 241 |
+
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
.weather-card.expanded {
|
| 245 |
+
height: 500px;
|
| 246 |
+
z-index: 10;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
.card-header {
|
| 250 |
+
padding: 25px;
|
| 251 |
+
display: flex;
|
| 252 |
+
flex-direction: column;
|
| 253 |
+
z-index: 2;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
.location {
|
| 257 |
+
font-size: 22px;
|
| 258 |
+
font-weight: 600;
|
| 259 |
+
margin-bottom: 5px;
|
| 260 |
+
display: flex;
|
| 261 |
+
align-items: center;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
.location-icon {
|
| 265 |
+
margin-right: 8px;
|
| 266 |
+
opacity: 0.7;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
.date {
|
| 270 |
+
font-size: 14px;
|
| 271 |
+
color: var(--secondary-text);
|
| 272 |
+
margin-bottom: 20px;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.temperature {
|
| 276 |
+
font-size: 48px;
|
| 277 |
+
font-weight: 700;
|
| 278 |
+
margin-bottom: 5px;
|
| 279 |
+
display: flex;
|
| 280 |
+
align-items: center;
|
| 281 |
+
cursor: pointer;
|
| 282 |
+
transition: transform 0.3s ease;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
.temperature:hover {
|
| 286 |
+
transform: scale(1.05);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
.temperature span {
|
| 290 |
+
font-size: 24px;
|
| 291 |
+
margin-left: 5px;
|
| 292 |
+
font-weight: 400;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
.weather-type {
|
| 296 |
+
font-size: 18px;
|
| 297 |
+
color: var(--text-color);
|
| 298 |
+
opacity: 0.9;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.card-content {
|
| 302 |
+
flex: 1;
|
| 303 |
+
position: relative;
|
| 304 |
+
overflow: hidden;
|
| 305 |
+
display: flex;
|
| 306 |
+
align-items: flex-end;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
.weather-details {
|
| 310 |
+
width: 100%;
|
| 311 |
+
padding: 20px;
|
| 312 |
+
background: var(--detail-bg);
|
| 313 |
+
backdrop-filter: blur(10px);
|
| 314 |
+
-webkit-backdrop-filter: blur(10px);
|
| 315 |
+
z-index: 2;
|
| 316 |
+
display: flex;
|
| 317 |
+
justify-content: space-between;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
.detail {
|
| 321 |
+
display: flex;
|
| 322 |
+
flex-direction: column;
|
| 323 |
+
align-items: center;
|
| 324 |
+
transition: transform 0.3s ease;
|
| 325 |
+
cursor: pointer;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
.detail:hover {
|
| 329 |
+
transform: translateY(-5px);
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.detail-label {
|
| 333 |
+
font-size: 12px;
|
| 334 |
+
color: var(--secondary-text);
|
| 335 |
+
margin-bottom: 5px;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
.detail-value {
|
| 339 |
+
font-size: 16px;
|
| 340 |
+
font-weight: 600;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
/* 扩展内容 */
|
| 344 |
+
.expanded-content {
|
| 345 |
+
height: 0;
|
| 346 |
+
overflow: hidden;
|
| 347 |
+
transition: height 0.5s ease;
|
| 348 |
+
background: var(--detail-bg);
|
| 349 |
+
backdrop-filter: blur(10px);
|
| 350 |
+
-webkit-backdrop-filter: blur(10px);
|
| 351 |
+
padding: 0 20px;
|
| 352 |
+
opacity: 0;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
.weather-card.expanded .expanded-content {
|
| 356 |
+
height: 100px;
|
| 357 |
+
opacity: 1;
|
| 358 |
+
padding: 20px;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
.hourly-forecast {
|
| 362 |
+
display: flex;
|
| 363 |
+
justify-content: space-between;
|
| 364 |
+
overflow-x: auto;
|
| 365 |
+
padding-bottom: 10px;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
.hourly-item {
|
| 369 |
+
display: flex;
|
| 370 |
+
flex-direction: column;
|
| 371 |
+
align-items: center;
|
| 372 |
+
min-width: 50px;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
.hourly-time {
|
| 376 |
+
font-size: 12px;
|
| 377 |
+
color: var(--secondary-text);
|
| 378 |
+
margin-bottom: 5px;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
.hourly-temp {
|
| 382 |
+
font-size: 14px;
|
| 383 |
+
font-weight: 600;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
.hourly-icon {
|
| 387 |
+
font-size: 18px;
|
| 388 |
+
margin: 5px 0;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/* 风天气特效 */
|
| 392 |
+
.wind-card {
|
| 393 |
+
background: var(--card-bg-wind);
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
.cloud {
|
| 397 |
+
position: absolute;
|
| 398 |
+
background: rgba(255, 255, 255, 0.8);
|
| 399 |
+
border-radius: 50%;
|
| 400 |
+
z-index: 1;
|
| 401 |
+
opacity: 0.7;
|
| 402 |
+
filter: blur(5px);
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
.wind-line {
|
| 406 |
+
position: absolute;
|
| 407 |
+
height: 2px;
|
| 408 |
+
background: rgba(255, 255, 255, 0.3);
|
| 409 |
+
z-index: 1;
|
| 410 |
+
transform-origin: left center;
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
.tree {
|
| 414 |
+
position: absolute;
|
| 415 |
+
bottom: 70px;
|
| 416 |
+
width: 10px;
|
| 417 |
+
height: 60px;
|
| 418 |
+
background: #3d2817;
|
| 419 |
+
z-index: 1;
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
.tree::after {
|
| 423 |
+
content: '';
|
| 424 |
+
position: absolute;
|
| 425 |
+
width: 60px;
|
| 426 |
+
height: 60px;
|
| 427 |
+
background: #2d5f3d;
|
| 428 |
+
border-radius: 50%;
|
| 429 |
+
top: -30px;
|
| 430 |
+
left: -25px;
|
| 431 |
+
transform-origin: center bottom;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
/* 雨天特效 */
|
| 435 |
+
.rain-card {
|
| 436 |
+
background: var(--card-bg-rain);
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
.raindrop {
|
| 440 |
+
position: absolute;
|
| 441 |
+
width: 2px;
|
| 442 |
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.7));
|
| 443 |
+
z-index: 1;
|
| 444 |
+
border-radius: 50%;
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
.puddle {
|
| 448 |
+
position: absolute;
|
| 449 |
+
bottom: 80px;
|
| 450 |
+
background: rgba(255, 255, 255, 0.2);
|
| 451 |
+
border-radius: 50%;
|
| 452 |
+
transform: scaleY(0.3);
|
| 453 |
+
filter: blur(2px);
|
| 454 |
+
z-index: 1;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
.ripple {
|
| 458 |
+
position: absolute;
|
| 459 |
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
| 460 |
+
border-radius: 50%;
|
| 461 |
+
transform: translate(-50%, -50%) scale(0);
|
| 462 |
+
opacity: 1;
|
| 463 |
+
z-index: 1;
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
/* 晴天特效 */
|
| 467 |
+
.sunny-card {
|
| 468 |
+
background: var(--card-bg-sunny);
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
.sun {
|
| 472 |
+
position: absolute;
|
| 473 |
+
width: 80px;
|
| 474 |
+
height: 80px;
|
| 475 |
+
background: radial-gradient(circle, #ffeb3b, #ff9800);
|
| 476 |
+
border-radius: 50%;
|
| 477 |
+
top: 60px;
|
| 478 |
+
right: 30px;
|
| 479 |
+
box-shadow: 0 0 40px #ff9800, 0 0 80px #ffeb3b;
|
| 480 |
+
z-index: 1;
|
| 481 |
+
cursor: pointer;
|
| 482 |
+
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
.sun:hover {
|
| 486 |
+
transform: scale(1.1);
|
| 487 |
+
box-shadow: 0 0 60px #ff9800, 0 0 100px #ffeb3b;
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
.sun-ray {
|
| 491 |
+
position: absolute;
|
| 492 |
+
background: linear-gradient(to right, rgba(255, 235, 59, 0), rgba(255, 235, 59, 0.8), rgba(255, 235, 59, 0));
|
| 493 |
+
height: 2px;
|
| 494 |
+
transform-origin: left center;
|
| 495 |
+
z-index: 1;
|
| 496 |
+
opacity: 0.7;
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
/* 雪天特效 */
|
| 500 |
+
.snow-card {
|
| 501 |
+
background: var(--card-bg-snow);
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
.snowflake {
|
| 505 |
+
position: absolute;
|
| 506 |
+
width: 8px;
|
| 507 |
+
height: 8px;
|
| 508 |
+
background: white;
|
| 509 |
+
border-radius: 50%;
|
| 510 |
+
filter: blur(1px);
|
| 511 |
+
z-index: 1;
|
| 512 |
+
opacity: 0.8;
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
.snow-ground {
|
| 516 |
+
position: absolute;
|
| 517 |
+
bottom: 0;
|
| 518 |
+
left: 0;
|
| 519 |
+
width: 100%;
|
| 520 |
+
height: 40px;
|
| 521 |
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4));
|
| 522 |
+
z-index: 1;
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
/* 响应式设计 */
|
| 526 |
+
@media (max-width: 768px) {
|
| 527 |
+
.cards-container {
|
| 528 |
+
flex-direction: column;
|
| 529 |
+
align-items: center;
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
.weather-card {
|
| 533 |
+
width: 100%;
|
| 534 |
+
max-width: var(--card-width);
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
.header h1 {
|
| 538 |
+
font-size: 28px;
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
.header p {
|
| 542 |
+
font-size: 16px;
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
.theme-switch-wrapper, .temp-unit-toggle {
|
| 546 |
+
position: relative;
|
| 547 |
+
top: 0;
|
| 548 |
+
right: 0;
|
| 549 |
+
left: 0;
|
| 550 |
+
margin: 10px auto;
|
| 551 |
+
}
|
| 552 |
+
}
|
| 553 |
+
|
| 554 |
+
/* 动画效果 */
|
| 555 |
+
@keyframes float {
|
| 556 |
+
0%, 100% { transform: translateY(0) translateX(0); }
|
| 557 |
+
50% { transform: translateY(-15px) translateX(10px); }
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
@keyframes sway {
|
| 561 |
+
0%, 100% { transform: rotate(-5deg); }
|
| 562 |
+
50% { transform: rotate(5deg); }
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
@keyframes fall {
|
| 566 |
+
0% { transform: translateY(-10px); opacity: 0; }
|
| 567 |
+
10% { opacity: 1; }
|
| 568 |
+
100% { transform: translateY(200px); opacity: 0.7; }
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
@keyframes rippleEffect {
|
| 572 |
+
0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
|
| 573 |
+
100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
@keyframes pulse {
|
| 577 |
+
0%, 100% { transform: scale(1); opacity: 1; }
|
| 578 |
+
50% { transform: scale(1.1); opacity: 0.8; }
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
@keyframes rotate {
|
| 582 |
+
from { transform: rotate(0deg); }
|
| 583 |
+
to { transform: rotate(360deg); }
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
@keyframes snowfall {
|
| 587 |
+
0% { transform: translateY(-10px) translateX(0); opacity: 0; }
|
| 588 |
+
10% { opacity: 1; }
|
| 589 |
+
100% { transform: translateY(300px) translateX(20px); opacity: 0.6; }
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
/* 过渡效果 */
|
| 593 |
+
.fade-in {
|
| 594 |
+
animation: fadeIn 0.5s ease forwards;
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
@keyframes fadeIn {
|
| 598 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 599 |
+
to { opacity: 1; transform: translateY(0); }
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
/* 苹果风格的磨砂玻璃效果 */
|
| 603 |
+
.glass-effect {
|
| 604 |
+
background: rgba(255, 255, 255, 0.1);
|
| 605 |
+
backdrop-filter: blur(10px);
|
| 606 |
+
-webkit-backdrop-filter: blur(10px);
|
| 607 |
+
border-radius: 10px;
|
| 608 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
/* 天气图标 */
|
| 612 |
+
.weather-icon {
|
| 613 |
+
position: absolute;
|
| 614 |
+
top: 25px;
|
| 615 |
+
right: 25px;
|
| 616 |
+
font-size: 30px;
|
| 617 |
+
z-index: 2;
|
| 618 |
+
cursor: pointer;
|
| 619 |
+
transition: transform 0.3s ease;
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
+
.weather-icon:hover {
|
| 623 |
+
transform: scale(1.2) rotate(10deg);
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
/* 底部版权信息 */
|
| 627 |
+
.footer {
|
| 628 |
+
margin-top: 50px;
|
| 629 |
+
text-align: center;
|
| 630 |
+
color: var(--secondary-text);
|
| 631 |
+
font-size: 14px;
|
| 632 |
+
width: 100%;
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
.footer a {
|
| 636 |
+
color: #64b5f6;
|
| 637 |
+
text-decoration: none;
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
.footer a:hover {
|
| 641 |
+
text-decoration: underline;
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
/* 交互提示 */
|
| 645 |
+
.interaction-hint {
|
| 646 |
+
position: absolute;
|
| 647 |
+
background: rgba(0, 0, 0, 0.7);
|
| 648 |
+
color: white;
|
| 649 |
+
padding: 8px 12px;
|
| 650 |
+
border-radius: 8px;
|
| 651 |
+
font-size: 12px;
|
| 652 |
+
pointer-events: none;
|
| 653 |
+
opacity: 0;
|
| 654 |
+
transition: opacity 0.3s ease;
|
| 655 |
+
z-index: 100;
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
/* 动画控制按钮 */
|
| 659 |
+
.animation-controls {
|
| 660 |
+
position: absolute;
|
| 661 |
+
bottom: 10px;
|
| 662 |
+
right: 10px;
|
| 663 |
+
z-index: 3;
|
| 664 |
+
display: flex;
|
| 665 |
+
gap: 5px;
|
| 666 |
+
}
|
| 667 |
+
|
| 668 |
+
.animation-btn {
|
| 669 |
+
width: 30px;
|
| 670 |
+
height: 30px;
|
| 671 |
+
border-radius: 50%;
|
| 672 |
+
background: rgba(255, 255, 255, 0.2);
|
| 673 |
+
border: none;
|
| 674 |
+
color: white;
|
| 675 |
+
display: flex;
|
| 676 |
+
align-items: center;
|
| 677 |
+
justify-content: center;
|
| 678 |
+
cursor: pointer;
|
| 679 |
+
font-size: 14px;
|
| 680 |
+
transition: all 0.3s ease;
|
| 681 |
+
}
|
| 682 |
+
|
| 683 |
+
.animation-btn:hover {
|
| 684 |
+
background: rgba(255, 255, 255, 0.4);
|
| 685 |
+
transform: scale(1.1);
|
| 686 |
+
}
|
| 687 |
+
</style>
|
| 688 |
+
</head>
|
| 689 |
+
<body>
|
| 690 |
+
<div class="header">
|
| 691 |
+
<h1>Apple 风格天气卡片</h1>
|
| 692 |
+
<p>精美动画展示不同天气状况,体验苹果级别的设计美学</p>
|
| 693 |
+
|
| 694 |
+
<!-- 主题切换开关 -->
|
| 695 |
+
<div class="theme-switch-wrapper">
|
| 696 |
+
<label class="theme-switch" for="checkbox">
|
| 697 |
+
<input type="checkbox" id="checkbox" />
|
| 698 |
+
<div class="slider">
|
| 699 |
+
<div class="slider-icons">
|
| 700 |
+
<span>🌙</span>
|
| 701 |
+
<span>☀️</span>
|
| 702 |
+
</div>
|
| 703 |
+
</div>
|
| 704 |
+
</label>
|
| 705 |
+
</div>
|
| 706 |
+
|
| 707 |
+
<!-- 温度单位切换 -->
|
| 708 |
+
<div class="temp-unit-toggle" id="temp-unit-toggle">°C</div>
|
| 709 |
+
</div>
|
| 710 |
+
|
| 711 |
+
<div class="controls">
|
| 712 |
+
<button class="control-btn active" data-weather="all">全部显示</button>
|
| 713 |
+
<button class="control-btn" data-weather="wind">大风</button>
|
| 714 |
+
<button class="control-btn" data-weather="rain">降雨</button>
|
| 715 |
+
<button class="control-btn" data-weather="sunny">晴天</button>
|
| 716 |
+
<button class="control-btn" data-weather="snow">降雪</button>
|
| 717 |
+
</div>
|
| 718 |
+
|
| 719 |
+
<div class="cards-container">
|
| 720 |
+
<!-- 风天气卡片 -->
|
| 721 |
+
<div class="weather-card wind-card" data-type="wind">
|
| 722 |
+
<div class="card-header">
|
| 723 |
+
<div class="location"><span class="location-icon">📍</span>北京</div>
|
| 724 |
+
<div class="date">周一, 3月25日</div>
|
| 725 |
+
<div class="temperature" data-celsius="16">16<span class="temp-unit">°C</span></div>
|
| 726 |
+
<div class="weather-type">大风</div>
|
| 727 |
+
<div class="weather-icon">💨</div>
|
| 728 |
+
</div>
|
| 729 |
+
<div class="card-content" id="wind-animation">
|
| 730 |
+
<!-- 动态生成云朵和风线 -->
|
| 731 |
+
<div class="tree" id="tree1"></div>
|
| 732 |
+
<div class="tree" id="tree2"></div>
|
| 733 |
+
|
| 734 |
+
<!-- 动画控制按钮 -->
|
| 735 |
+
<div class="animation-controls">
|
| 736 |
+
<button class="animation-btn" data-action="pause">⏸️</button>
|
| 737 |
+
<button class="animation-btn" data-action="play">▶️</button>
|
| 738 |
+
</div>
|
| 739 |
+
</div>
|
| 740 |
+
<div class="weather-details">
|
| 741 |
+
<div class="detail" data-info="风速信息">
|
| 742 |
+
<div class="detail-label">风速</div>
|
| 743 |
+
<div class="detail-value">28 km/h</div>
|
| 744 |
+
</div>
|
| 745 |
+
<div class="detail" data-info="湿度信息">
|
| 746 |
+
<div class="detail-label">湿度</div>
|
| 747 |
+
<div class="detail-value">45%</div>
|
| 748 |
+
</div>
|
| 749 |
+
<div class="detail" data-info="气压信息">
|
| 750 |
+
<div class="detail-label">气压</div>
|
| 751 |
+
<div class="detail-value">1012 hPa</div>
|
| 752 |
+
</div>
|
| 753 |
+
</div>
|
| 754 |
+
<div class="expanded-content">
|
| 755 |
+
<div class="hourly-forecast">
|
| 756 |
+
<div class="hourly-item">
|
| 757 |
+
<div class="hourly-time">现在</div>
|
| 758 |
+
<div class="hourly-icon">💨</div>
|
| 759 |
+
<div class="hourly-temp">16°</div>
|
| 760 |
+
</div>
|
| 761 |
+
<div class="hourly-item">
|
| 762 |
+
<div class="hourly-time">14:00</div>
|
| 763 |
+
<div class="hourly-icon">💨</div>
|
| 764 |
+
<div class="hourly-temp">17°</div>
|
| 765 |
+
</div>
|
| 766 |
+
<div class="hourly-item">
|
| 767 |
+
<div class="hourly-time">15:00</div>
|
| 768 |
+
<div class="hourly-icon">💨</div>
|
| 769 |
+
<div class="hourly-temp">17°</div>
|
| 770 |
+
</div>
|
| 771 |
+
<div class="hourly-item">
|
| 772 |
+
<div class="hourly-time">16:00</div>
|
| 773 |
+
<div class="hourly-icon">💨</div>
|
| 774 |
+
<div class="hourly-temp">16°</div>
|
| 775 |
+
</div>
|
| 776 |
+
<div class="hourly-item">
|
| 777 |
+
<div class="hourly-time">17:00</div>
|
| 778 |
+
<div class="hourly-icon">💨</div>
|
| 779 |
+
<div class="hourly-temp">15°</div>
|
| 780 |
+
</div>
|
| 781 |
+
</div>
|
| 782 |
+
</div>
|
| 783 |
+
</div>
|
| 784 |
+
|
| 785 |
+
<!-- 雨天卡片 -->
|
| 786 |
+
<div class="weather-card rain-card" data-type="rain">
|
| 787 |
+
<div class="card-header">
|
| 788 |
+
<div class="location"><span class="location-icon">📍</span>上海</div>
|
| 789 |
+
<div class="date">周一, 3月25日</div>
|
| 790 |
+
<div class="temperature" data-celsius="14">14<span class="temp-unit">°C</span></div>
|
| 791 |
+
<div class="weather-type">中雨</div>
|
| 792 |
+
<div class="weather-icon">🌧️</div>
|
| 793 |
+
</div>
|
| 794 |
+
<div class="card-content" id="rain-animation">
|
| 795 |
+
<!-- 动态生成雨滴和水洼 -->
|
| 796 |
+
|
| 797 |
+
<!-- 动画控制按钮 -->
|
| 798 |
+
<div class="animation-controls">
|
| 799 |
+
<button class="animation-btn" data-action="pause">⏸️</button>
|
| 800 |
+
<button class="animation-btn" data-action="play">▶️</button>
|
| 801 |
+
</div>
|
| 802 |
+
</div>
|
| 803 |
+
<div class="weather-details">
|
| 804 |
+
<div class="detail" data-info="风速信息">
|
| 805 |
+
<div class="detail-label">风速</div>
|
| 806 |
+
<div class="detail-value">12 km/h</div>
|
| 807 |
+
</div>
|
| 808 |
+
<div class="detail" data-info="湿度信息">
|
| 809 |
+
<div class="detail-label">湿度</div>
|
| 810 |
+
<div class="detail-value">85%</div>
|
| 811 |
+
</div>
|
| 812 |
+
<div class="detail" data-info="降水量信息">
|
| 813 |
+
<div class="detail-label">降水量</div>
|
| 814 |
+
<div class="detail-value">8.2 mm</div>
|
| 815 |
+
</div>
|
| 816 |
+
</div>
|
| 817 |
+
<div class="expanded-content">
|
| 818 |
+
<div class="hourly-forecast">
|
| 819 |
+
<div class="hourly-item">
|
| 820 |
+
<div class="hourly-time">现在</div>
|
| 821 |
+
<div class="hourly-icon">🌧️</div>
|
| 822 |
+
<div class="hourly-temp">14°</div>
|
| 823 |
+
</div>
|
| 824 |
+
<div class="hourly-item">
|
| 825 |
+
<div class="hourly-time">14:00</div>
|
| 826 |
+
<div class="hourly-icon">🌧️</div>
|
| 827 |
+
<div class="hourly-temp">14°</div>
|
| 828 |
+
</div>
|
| 829 |
+
<div class="hourly-item">
|
| 830 |
+
<div class="hourly-time">15:00</div>
|
| 831 |
+
<div class="hourly-icon">🌧️</div>
|
| 832 |
+
<div class="hourly-temp">13°</div>
|
| 833 |
+
</div>
|
| 834 |
+
<div class="hourly-item">
|
| 835 |
+
<div class="hourly-time">16:00</div>
|
| 836 |
+
<div class="hourly-icon">🌦️</div>
|
| 837 |
+
<div class="hourly-temp">13°</div>
|
| 838 |
+
</div>
|
| 839 |
+
<div class="hourly-item">
|
| 840 |
+
<div class="hourly-time">17:00</div>
|
| 841 |
+
<div class="hourly-icon">🌦️</div>
|
| 842 |
+
<div class="hourly-temp">12°</div>
|
| 843 |
+
</div>
|
| 844 |
+
</div>
|
| 845 |
+
</div>
|
| 846 |
+
</div>
|
| 847 |
+
|
| 848 |
+
<!-- 晴天卡片 -->
|
| 849 |
+
<div class="weather-card sunny-card" data-type="sunny">
|
| 850 |
+
<div class="card-header">
|
| 851 |
+
<div class="location"><span class="location-icon">📍</span>深圳</div>
|
| 852 |
+
<div class="date">周一, 3月25日</div>
|
| 853 |
+
<div class="temperature" data-celsius="28">28<span class="temp-unit">°C</span></div>
|
| 854 |
+
<div class="weather-type">晴天</div>
|
| 855 |
+
<div class="weather-icon">☀️</div>
|
| 856 |
+
</div>
|
| 857 |
+
<div class="card-content" id="sunny-animation">
|
| 858 |
+
<div class="sun"></div>
|
| 859 |
+
<!-- 动态生成阳光射线 -->
|
| 860 |
+
|
| 861 |
+
<!-- 动画控制按钮 -->
|
| 862 |
+
<div class="animation-controls">
|
| 863 |
+
<button class="animation-btn" data-action="pause">⏸️</button>
|
| 864 |
+
<button class="animation-btn" data-action="play">▶️</button>
|
| 865 |
+
</div>
|
| 866 |
+
</div>
|
| 867 |
+
<div class="weather-details">
|
| 868 |
+
<div class="detail" data-info="风速信息">
|
| 869 |
+
<div class="detail-label">风速</div>
|
| 870 |
+
<div class="detail-value">5 km/h</div>
|
| 871 |
+
</div>
|
| 872 |
+
<div class="detail" data-info="湿度信息">
|
| 873 |
+
<div class="detail-label">湿度</div>
|
| 874 |
+
<div class="detail-value">30%</div>
|
| 875 |
+
</div>
|
| 876 |
+
<div class="detail" data-info="紫外线信息">
|
| 877 |
+
<div class="detail-label">紫外线</div>
|
| 878 |
+
<div class="detail-value">很强</div>
|
| 879 |
+
</div>
|
| 880 |
+
</div>
|
| 881 |
+
<div class="expanded-content">
|
| 882 |
+
<div class="hourly-forecast">
|
| 883 |
+
<div class="hourly-item">
|
| 884 |
+
<div class="hourly-time">现在</div>
|
| 885 |
+
<div class="hourly-icon">☀️</div>
|
| 886 |
+
<div class="hourly-temp">28°</div>
|
| 887 |
+
</div>
|
| 888 |
+
<div class="hourly-item">
|
| 889 |
+
<div class="hourly-time">14:00</div>
|
| 890 |
+
<div class="hourly-icon">☀️</div>
|
| 891 |
+
<div class="hourly-temp">29°</div>
|
| 892 |
+
</div>
|
| 893 |
+
<div class="hourly-item">
|
| 894 |
+
<div class="hourly-time">15:00</div>
|
| 895 |
+
<div class="hourly-icon">☀️</div>
|
| 896 |
+
<div class="hourly-temp">30°</div>
|
| 897 |
+
</div>
|
| 898 |
+
<div class="hourly-item">
|
| 899 |
+
<div class="hourly-time">16:00</div>
|
| 900 |
+
<div class="hourly-icon">☀️</div>
|
| 901 |
+
<div class="hourly-temp">29°</div>
|
| 902 |
+
</div>
|
| 903 |
+
<div class="hourly-item">
|
| 904 |
+
<div class="hourly-time">17:00</div>
|
| 905 |
+
<div class="hourly-icon">🌤️</div>
|
| 906 |
+
<div class="hourly-temp">27°</div>
|
| 907 |
+
</div>
|
| 908 |
+
</div>
|
| 909 |
+
</div>
|
| 910 |
+
</div>
|
| 911 |
+
|
| 912 |
+
<!-- 雪天卡片 -->
|
| 913 |
+
<div class="weather-card snow-card" data-type="snow">
|
| 914 |
+
<div class="card-header">
|
| 915 |
+
<div class="location"><span class="location-icon">📍</span>哈尔滨</div>
|
| 916 |
+
<div class="date">周一, 3月25日</div>
|
| 917 |
+
<div class="temperature" data-celsius="-5">-5<span class="temp-unit">°C</span></div>
|
| 918 |
+
<div class="weather-type">小雪</div>
|
| 919 |
+
<div class="weather-icon">❄️</div>
|
| 920 |
+
</div>
|
| 921 |
+
<div class="card-content" id="snow-animation">
|
| 922 |
+
<!-- 动态生成雪花 -->
|
| 923 |
+
<div class="snow-ground"></div>
|
| 924 |
+
|
| 925 |
+
<!-- 动画控制按钮 -->
|
| 926 |
+
<div class="animation-controls">
|
| 927 |
+
<button class="animation-btn" data-action="pause">⏸️</button>
|
| 928 |
+
<button class="animation-btn" data-action="play">▶️</button>
|
| 929 |
+
</div>
|
| 930 |
+
</div>
|
| 931 |
+
<div class="weather-details">
|
| 932 |
+
<div class="detail" data-info="风速信息">
|
| 933 |
+
<div class="detail-label">风速</div>
|
| 934 |
+
<div class="detail-value">8 km/h</div>
|
| 935 |
+
</div>
|
| 936 |
+
<div class="detail" data-info="湿度信息">
|
| 937 |
+
<div class="detail-label">湿度</div>
|
| 938 |
+
<div class="detail-value">78%</div>
|
| 939 |
+
</div>
|
| 940 |
+
<div class="detail" data-info="能见度信息">
|
| 941 |
+
<div class="detail-label">能见度</div>
|
| 942 |
+
<div class="detail-value">2.5 km</div>
|
| 943 |
+
</div>
|
| 944 |
+
</div>
|
| 945 |
+
<div class="expanded-content">
|
| 946 |
+
<div class="hourly-forecast">
|
| 947 |
+
<div class="hourly-item">
|
| 948 |
+
<div class="hourly-time">现在</div>
|
| 949 |
+
<div class="hourly-icon">❄️</div>
|
| 950 |
+
<div class="hourly-temp">-5°</div>
|
| 951 |
+
</div>
|
| 952 |
+
<div class="hourly-item">
|
| 953 |
+
<div class="hourly-time">14:00</div>
|
| 954 |
+
<div class="hourly-icon">❄️</div>
|
| 955 |
+
<div class="hourly-temp">-4°</div>
|
| 956 |
+
</div>
|
| 957 |
+
<div class="hourly-item">
|
| 958 |
+
<div class="hourly-time">15:00</div>
|
| 959 |
+
<div class="hourly-icon">❄️</div>
|
| 960 |
+
<div class="hourly-temp">-4°</div>
|
| 961 |
+
</div>
|
| 962 |
+
<div class="hourly-item">
|
| 963 |
+
<div class="hourly-time">16:00</div>
|
| 964 |
+
<div class="hourly-icon">🌨️</div>
|
| 965 |
+
<div class="hourly-temp">-6°</div>
|
| 966 |
+
</div>
|
| 967 |
+
<div class="hourly-item">
|
| 968 |
+
<div class="hourly-time">17:00</div>
|
| 969 |
+
<div class="hourly-icon">🌨️</div>
|
| 970 |
+
<div class="hourly-temp">-7°</div>
|
| 971 |
+
</div>
|
| 972 |
+
</div>
|
| 973 |
+
</div>
|
| 974 |
+
</div>
|
| 975 |
+
</div>
|
| 976 |
+
|
| 977 |
+
<!-- 交互提示 -->
|
| 978 |
+
<div class="interaction-hint" id="interaction-hint"></div>
|
| 979 |
+
|
| 980 |
+
<div class="footer">
|
| 981 |
+
<p>© 2025 Apple 风格天气卡片 | 设计与开发:苹果前端工程师</p>
|
| 982 |
+
</div>
|
| 983 |
+
|
| 984 |
+
<script>
|
| 985 |
+
// 初始化所有天气动画
|
| 986 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 987 |
+
// 初始化动画
|
| 988 |
+
initWindAnimation();
|
| 989 |
+
initRainAnimation();
|
| 990 |
+
initSunnyAnimation();
|
| 991 |
+
initSnowAnimation();
|
| 992 |
+
|
| 993 |
+
// 设置控制按钮事件
|
| 994 |
+
setupControlButtons();
|
| 995 |
+
|
| 996 |
+
// 设置主题切换
|
| 997 |
+
setupThemeToggle();
|
| 998 |
+
|
| 999 |
+
// 设置温度单位切换
|
| 1000 |
+
setupTempUnitToggle();
|
| 1001 |
+
|
| 1002 |
+
// 设置卡片交互
|
| 1003 |
+
setupCardInteractions();
|
| 1004 |
+
|
| 1005 |
+
// 设置动画控制
|
| 1006 |
+
setupAnimationControls();
|
| 1007 |
+
|
| 1008 |
+
// 设置交互提示
|
| 1009 |
+
setupInteractionHints();
|
| 1010 |
+
});
|
| 1011 |
+
|
| 1012 |
+
// 设置控制按钮
|
| 1013 |
+
function setupControlButtons() {
|
| 1014 |
+
const buttons = document.querySelectorAll('.control-btn');
|
| 1015 |
+
const cards = document.querySelectorAll('.weather-card');
|
| 1016 |
+
|
| 1017 |
+
buttons.forEach(button => {
|
| 1018 |
+
button.addEventListener('click', function() {
|
| 1019 |
+
// 移除所有按钮的active类
|
| 1020 |
+
buttons.forEach(btn => btn.classList.remove('active'));
|
| 1021 |
+
// 给当前按钮添加active类
|
| 1022 |
+
this.classList.add('active');
|
| 1023 |
+
|
| 1024 |
+
const weatherType = this.getAttribute('data-weather');
|
| 1025 |
+
|
| 1026 |
+
// 显示或隐藏卡片
|
| 1027 |
+
cards.forEach(card => {
|
| 1028 |
+
if (weatherType === 'all' || card.getAttribute('data-type') === weatherType) {
|
| 1029 |
+
card.style.display = 'flex';
|
| 1030 |
+
// 添加淡入动画
|
| 1031 |
+
card.classList.add('fade-in');
|
| 1032 |
+
} else {
|
| 1033 |
+
card.style.display = 'none';
|
| 1034 |
+
}
|
| 1035 |
+
});
|
| 1036 |
+
});
|
| 1037 |
+
});
|
| 1038 |
+
}
|
| 1039 |
+
|
| 1040 |
+
// 设置主题切换
|
| 1041 |
+
function setupThemeToggle() {
|
| 1042 |
+
const themeToggle = document.getElementById('checkbox');
|
| 1043 |
+
|
| 1044 |
+
// 检查本地存储中的主题设置
|
| 1045 |
+
const currentTheme = localStorage.getItem('theme');
|
| 1046 |
+
if (currentTheme === 'light') {
|
| 1047 |
+
document.documentElement.setAttribute('data-theme', 'light');
|
| 1048 |
+
themeToggle.checked = true;
|
| 1049 |
+
}
|
| 1050 |
+
|
| 1051 |
+
themeToggle.addEventListener('change', function() {
|
| 1052 |
+
if (this.checked) {
|
| 1053 |
+
document.documentElement.setAttribute('data-theme', 'light');
|
| 1054 |
+
localStorage.setItem('theme', 'light');
|
| 1055 |
+
} else {
|
| 1056 |
+
document.documentElement.removeAttribute('data-theme');
|
| 1057 |
+
localStorage.setItem('theme', 'dark');
|
| 1058 |
+
}
|
| 1059 |
+
});
|
| 1060 |
+
}
|
| 1061 |
+
|
| 1062 |
+
// 设置温度单位切换
|
| 1063 |
+
function setupTempUnitToggle() {
|
| 1064 |
+
const tempUnitToggle = document.getElementById('temp-unit-toggle');
|
| 1065 |
+
const tempElements = document.querySelectorAll('.temperature');
|
| 1066 |
+
const tempUnitElements = document.querySelectorAll('.temp-unit');
|
| 1067 |
+
const hourlyTempElements = document.querySelectorAll('.hourly-temp');
|
| 1068 |
+
|
| 1069 |
+
let isCelsius = true;
|
| 1070 |
+
|
| 1071 |
+
tempUnitToggle.addEventListener('click', function() {
|
| 1072 |
+
isCelsius = !isCelsius;
|
| 1073 |
+
|
| 1074 |
+
if (isCelsius) {
|
| 1075 |
+
tempUnitToggle.textContent = '°C';
|
| 1076 |
+
tempUnitElements.forEach(el => el.textContent = '°C');
|
| 1077 |
+
|
| 1078 |
+
// 转换温度显示
|
| 1079 |
+
tempElements.forEach(el => {
|
| 1080 |
+
const celsius = parseFloat(el.getAttribute('data-celsius'));
|
| 1081 |
+
el.childNodes[0].nodeValue = celsius;
|
| 1082 |
+
});
|
| 1083 |
+
|
| 1084 |
+
// 转换小时预报温度
|
| 1085 |
+
hourlyTempElements.forEach(el => {
|
| 1086 |
+
const tempText = el.textContent;
|
| 1087 |
+
const fahrenheit = parseFloat(tempText);
|
| 1088 |
+
if (!isNaN(fahrenheit) && tempText.includes('°F')) {
|
| 1089 |
+
const celsius = Math.round((fahrenheit - 32) * 5 / 9);
|
| 1090 |
+
el.textContent = `${celsius}°`;
|
| 1091 |
+
}
|
| 1092 |
+
});
|
| 1093 |
+
} else {
|
| 1094 |
+
tempUnitToggle.textContent = '°F';
|
| 1095 |
+
tempUnitElements.forEach(el => el.textContent = '°F');
|
| 1096 |
+
|
| 1097 |
+
// 转换温度显示
|
| 1098 |
+
tempElements.forEach(el => {
|
| 1099 |
+
const celsius = parseFloat(el.getAttribute('data-celsius'));
|
| 1100 |
+
const fahrenheit = Math.round(celsius * 9 / 5 + 32);
|
| 1101 |
+
el.childNodes[0].nodeValue = fahrenheit;
|
| 1102 |
+
});
|
| 1103 |
+
|
| 1104 |
+
// 转换小时预报温度
|
| 1105 |
+
hourlyTempElements.forEach(el => {
|
| 1106 |
+
const tempText = el.textContent;
|
| 1107 |
+
const celsius = parseFloat(tempText);
|
| 1108 |
+
if (!isNaN(celsius) && !tempText.includes('°F')) {
|
| 1109 |
+
const fahrenheit = Math.round(celsius * 9 / 5 + 32);
|
| 1110 |
+
el.textContent = `${fahrenheit}°F`;
|
| 1111 |
+
}
|
| 1112 |
+
});
|
| 1113 |
+
}
|
| 1114 |
+
|
| 1115 |
+
// 添加动画效果
|
| 1116 |
+
tempUnitToggle.classList.add('fade-in');
|
| 1117 |
+
setTimeout(() => {
|
| 1118 |
+
tempUnitToggle.classList.remove('fade-in');
|
| 1119 |
+
}, 500);
|
| 1120 |
+
});
|
| 1121 |
+
}
|
| 1122 |
+
|
| 1123 |
+
// 设置卡片交互
|
| 1124 |
+
function setupCardInteractions() {
|
| 1125 |
+
const cards = document.querySelectorAll('.weather-card');
|
| 1126 |
+
|
| 1127 |
+
cards.forEach(card => {
|
| 1128 |
+
card.addEventListener('click', function() {
|
| 1129 |
+
// 切换展开状态
|
| 1130 |
+
this.classList.toggle('expanded');
|
| 1131 |
+
});
|
| 1132 |
+
|
| 1133 |
+
// 温度点击事件
|
| 1134 |
+
const tempElement = card.querySelector('.temperature');
|
| 1135 |
+
tempElement.addEventListener('click', function(e) {
|
| 1136 |
+
e.stopPropagation(); // 阻止冒泡到卡片
|
| 1137 |
+
|
| 1138 |
+
// 添加脉动动画
|
| 1139 |
+
this.style.animation = 'pulse 0.5s ease';
|
| 1140 |
+
setTimeout(() => {
|
| 1141 |
+
this.style.animation = '';
|
| 1142 |
+
}, 500);
|
| 1143 |
+
});
|
| 1144 |
+
|
| 1145 |
+
// 天气图标点击事件
|
| 1146 |
+
const weatherIcon = card.querySelector('.weather-icon');
|
| 1147 |
+
weatherIcon.addEventListener('click', function(e) {
|
| 1148 |
+
e.stopPropagation(); // 阻止冒泡到卡片
|
| 1149 |
+
|
| 1150 |
+
// 随机旋转角度
|
| 1151 |
+
const rotation = Math.random() * 40 - 20;
|
| 1152 |
+
this.style.transform = `scale(1.3) rotate(${rotation}deg)`;
|
| 1153 |
+
|
| 1154 |
+
setTimeout(() => {
|
| 1155 |
+
this.style.transform = '';
|
| 1156 |
+
}, 500);
|
| 1157 |
+
});
|
| 1158 |
+
|
| 1159 |
+
// 太阳点击事件(仅晴天卡片)
|
| 1160 |
+
if (card.classList.contains('sunny-card')) {
|
| 1161 |
+
const sun = card.querySelector('.sun');
|
| 1162 |
+
if (sun) {
|
| 1163 |
+
sun.addEventListener('click', function(e) {
|
| 1164 |
+
e.stopPropagation(); // 阻止冒泡到卡片
|
| 1165 |
+
|
| 1166 |
+
// 增强太阳光芒
|
| 1167 |
+
this.style.boxShadow = '0 0 80px #ff9800, 0 0 120px #ffeb3b';
|
| 1168 |
+
|
| 1169 |
+
setTimeout(() => {
|
| 1170 |
+
this.style.boxShadow = '';
|
| 1171 |
+
}, 1000);
|
| 1172 |
+
});
|
| 1173 |
+
}
|
| 1174 |
+
}
|
| 1175 |
+
});
|
| 1176 |
+
}
|
| 1177 |
+
|
| 1178 |
+
// 设置动画控制
|
| 1179 |
+
function setupAnimationControls() {
|
| 1180 |
+
const animationButtons = document.querySelectorAll('.animation-btn');
|
| 1181 |
+
|
| 1182 |
+
animationButtons.forEach(button => {
|
| 1183 |
+
button.addEventListener('click', function(e) {
|
| 1184 |
+
e.stopPropagation(); // 阻止冒泡到卡片
|
| 1185 |
+
|
| 1186 |
+
const action = this.getAttribute('data-action');
|
| 1187 |
+
const container = this.closest('.card-content');
|
| 1188 |
+
|
| 1189 |
+
if (action === 'pause') {
|
| 1190 |
+
// 暂停所有动画
|
| 1191 |
+
const animatedElements = container.querySelectorAll('*');
|
| 1192 |
+
animatedElements.forEach(el => {
|
| 1193 |
+
el.style.animationPlayState = 'paused';
|
| 1194 |
+
});
|
| 1195 |
+
} else if (action === 'play') {
|
| 1196 |
+
// 恢复所有动画
|
| 1197 |
+
const animatedElements = container.querySelectorAll('*');
|
| 1198 |
+
animatedElements.forEach(el => {
|
| 1199 |
+
el.style.animationPlayState = 'running';
|
| 1200 |
+
});
|
| 1201 |
+
}
|
| 1202 |
+
});
|
| 1203 |
+
});
|
| 1204 |
+
}
|
| 1205 |
+
|
| 1206 |
+
// 设置交互提示
|
| 1207 |
+
function setupInteractionHints() {
|
| 1208 |
+
const hintElement = document.getElementById('interaction-hint');
|
| 1209 |
+
const interactiveElements = document.querySelectorAll('[data-info]');
|
| 1210 |
+
|
| 1211 |
+
interactiveElements.forEach(element => {
|
| 1212 |
+
element.addEventListener('mouseenter', function() {
|
| 1213 |
+
const info = this.getAttribute('data-info');
|
| 1214 |
+
hintElement.textContent = info;
|
| 1215 |
+
hintElement.style.opacity = '1';
|
| 1216 |
+
|
| 1217 |
+
// 设置提示位置
|
| 1218 |
+
const rect = this.getBoundingClientRect();
|
| 1219 |
+
hintElement.style.top = `${rect.top - 30}px`;
|
| 1220 |
+
hintElement.style.left = `${rect.left + rect.width / 2}px`;
|
| 1221 |
+
hintElement.style.transform = 'translateX(-50%)';
|
| 1222 |
+
});
|
| 1223 |
+
|
| 1224 |
+
element.addEventListener('mouseleave', function() {
|
| 1225 |
+
hintElement.style.opacity = '0';
|
| 1226 |
+
});
|
| 1227 |
+
});
|
| 1228 |
+
}
|
| 1229 |
+
|
| 1230 |
+
// 风天气动画
|
| 1231 |
+
function initWindAnimation() {
|
| 1232 |
+
const windContainer = document.getElementById('wind-animation');
|
| 1233 |
+
const tree1 = document.getElementById('tree1');
|
| 1234 |
+
const tree2 = document.getElementById('tree2');
|
| 1235 |
+
|
| 1236 |
+
// 设置树的位置
|
| 1237 |
+
tree1.style.left = '60px';
|
| 1238 |
+
tree2.style.left = '180px';
|
| 1239 |
+
|
| 1240 |
+
// 添加树摇摆动画
|
| 1241 |
+
tree1.style.animation = 'sway 3s ease-in-out infinite';
|
| 1242 |
+
tree2.style.animation = 'sway 4s ease-in-out infinite';
|
| 1243 |
+
|
| 1244 |
+
// 创建云朵
|
| 1245 |
+
for (let i = 0; i < 5; i++) {
|
| 1246 |
+
createCloud(windContainer);
|
| 1247 |
+
}
|
| 1248 |
+
|
| 1249 |
+
// 创建风线
|
| 1250 |
+
for (let i = 0; i < 15; i++) {
|
| 1251 |
+
createWindLine(windContainer);
|
| 1252 |
+
}
|
| 1253 |
+
|
| 1254 |
+
// 每隔一段时间创建新的风线
|
| 1255 |
+
setInterval(() => {
|
| 1256 |
+
createWindLine(windContainer);
|
| 1257 |
+
}, 300);
|
| 1258 |
+
}
|
| 1259 |
+
|
| 1260 |
+
// 创建云朵
|
| 1261 |
+
function createCloud(container) {
|
| 1262 |
+
const cloud = document.createElement('div');
|
| 1263 |
+
cloud.className = 'cloud';
|
| 1264 |
+
|
| 1265 |
+
// 随机大小和位置
|
| 1266 |
+
const size = Math.random() * 50 + 30;
|
| 1267 |
+
const top = Math.random() * 150;
|
| 1268 |
+
const left = Math.random() * 200;
|
| 1269 |
+
|
| 1270 |
+
cloud.style.width = `${size}px`;
|
| 1271 |
+
cloud.style.height = `${size * 0.6}px`;
|
| 1272 |
+
cloud.style.top = `${top}px`;
|
| 1273 |
+
cloud.style.left = `${left}px`;
|
| 1274 |
+
|
| 1275 |
+
// 添加浮动动画
|
| 1276 |
+
const duration = Math.random() * 10 + 10;
|
| 1277 |
+
cloud.style.animation = `float ${duration}s ease-in-out infinite`;
|
| 1278 |
+
|
| 1279 |
+
container.appendChild(cloud);
|
| 1280 |
+
}
|
| 1281 |
+
|
| 1282 |
+
// 创建风线
|
| 1283 |
+
function createWindLine(container) {
|
| 1284 |
+
const line = document.createElement('div');
|
| 1285 |
+
line.className = 'wind-line';
|
| 1286 |
+
|
| 1287 |
+
// 随机大小和位置
|
| 1288 |
+
const width = Math.random() * 50 + 20;
|
| 1289 |
+
const top = Math.random() * 200 + 20;
|
| 1290 |
+
const left = 0;
|
| 1291 |
+
const angle = Math.random() * 10 - 5;
|
| 1292 |
+
|
| 1293 |
+
line.style.width = `${width}px`;
|
| 1294 |
+
line.style.top = `${top}px`;
|
| 1295 |
+
line.style.left = `${left}px`;
|
| 1296 |
+
line.style.transform = `rotate(${angle}deg)`;
|
| 1297 |
+
|
| 1298 |
+
// 添加动画
|
| 1299 |
+
line.style.animation = 'fadeIn 1s forwards';
|
| 1300 |
+
|
| 1301 |
+
container.appendChild(line);
|
| 1302 |
+
|
| 1303 |
+
// 一段时间后移除
|
| 1304 |
+
setTimeout(() => {
|
| 1305 |
+
line.remove();
|
| 1306 |
+
}, 1000);
|
| 1307 |
+
}
|
| 1308 |
+
|
| 1309 |
+
// 雨天动画
|
| 1310 |
+
function initRainAnimation() {
|
| 1311 |
+
const rainContainer = document.getElementById('rain-animation');
|
| 1312 |
+
|
| 1313 |
+
// 创建水洼
|
| 1314 |
+
for (let i = 0; i < 5; i++) {
|
| 1315 |
+
createPuddle(rainContainer);
|
| 1316 |
+
}
|
| 1317 |
+
|
| 1318 |
+
// 持续创建雨滴
|
| 1319 |
+
setInterval(() => {
|
| 1320 |
+
createRaindrop(rainContainer);
|
| 1321 |
+
}, 50);
|
| 1322 |
+
}
|
| 1323 |
+
|
| 1324 |
+
// 创建雨滴
|
| 1325 |
+
function createRaindrop(container) {
|
| 1326 |
+
const raindrop = document.createElement('div');
|
| 1327 |
+
raindrop.className = 'raindrop';
|
| 1328 |
+
|
| 1329 |
+
// 随机位置和大小
|
| 1330 |
+
const height = Math.random() * 20 + 10;
|
| 1331 |
+
const left = Math.random() * 280;
|
| 1332 |
+
|
| 1333 |
+
raindrop.style.height = `${height}px`;
|
| 1334 |
+
raindrop.style.left = `${left}px`;
|
| 1335 |
+
raindrop.style.top = '0';
|
| 1336 |
+
|
| 1337 |
+
// 添加下落动画
|
| 1338 |
+
const duration = Math.random() * 0.5 + 0.5;
|
| 1339 |
+
raindrop.style.animation = `fall ${duration}s linear`;
|
| 1340 |
+
|
| 1341 |
+
container.appendChild(raindrop);
|
| 1342 |
+
|
| 1343 |
+
// 雨滴落地后创建涟漪并移除雨滴
|
| 1344 |
+
setTimeout(() => {
|
| 1345 |
+
createRipple(container, left, 200);
|
| 1346 |
+
raindrop.remove();
|
| 1347 |
+
}, duration * 1000);
|
| 1348 |
+
}
|
| 1349 |
+
|
| 1350 |
+
// 创建水洼
|
| 1351 |
+
function createPuddle(container) {
|
| 1352 |
+
const puddle = document.createElement('div');
|
| 1353 |
+
puddle.className = 'puddle';
|
| 1354 |
+
|
| 1355 |
+
// 随机大小和位置
|
| 1356 |
+
const size = Math.random() * 60 + 40;
|
| 1357 |
+
const left = Math.random() * 200 + 40;
|
| 1358 |
+
|
| 1359 |
+
puddle.style.width = `${size}px`;
|
| 1360 |
+
puddle.style.height = `${size}px`;
|
| 1361 |
+
puddle.style.left = `${left}px`;
|
| 1362 |
+
|
| 1363 |
+
container.appendChild(puddle);
|
| 1364 |
+
}
|
| 1365 |
+
|
| 1366 |
+
// 创建涟漪
|
| 1367 |
+
function createRipple(container, x, y) {
|
| 1368 |
+
const ripple = document.createElement('div');
|
| 1369 |
+
ripple.className = 'ripple';
|
| 1370 |
+
|
| 1371 |
+
ripple.style.left = `${x}px`;
|
| 1372 |
+
ripple.style.top = `${y}px`;
|
| 1373 |
+
ripple.style.animation = 'rippleEffect 1s linear';
|
| 1374 |
+
|
| 1375 |
+
container.appendChild(ripple);
|
| 1376 |
+
|
| 1377 |
+
// 动画结束后移除
|
| 1378 |
+
setTimeout(() => {
|
| 1379 |
+
ripple.remove();
|
| 1380 |
+
}, 1000);
|
| 1381 |
+
}
|
| 1382 |
+
|
| 1383 |
+
// 晴天动画
|
| 1384 |
+
function initSunnyAnimation() {
|
| 1385 |
+
const sunnyContainer = document.getElementById('sunny-animation');
|
| 1386 |
+
const sun = sunnyContainer.querySelector('.sun');
|
| 1387 |
+
|
| 1388 |
+
// 添加太阳脉动动画
|
| 1389 |
+
sun.style.animation = 'pulse 4s ease-in-out infinite';
|
| 1390 |
+
|
| 1391 |
+
// 创建阳光射线
|
| 1392 |
+
for (let i = 0; i < 12; i++) {
|
| 1393 |
+
createSunRay(sunnyContainer, i * 30);
|
| 1394 |
+
}
|
| 1395 |
+
}
|
| 1396 |
+
|
| 1397 |
+
// 创建阳光射线
|
| 1398 |
+
function createSunRay(container, angle) {
|
| 1399 |
+
const ray = document.createElement('div');
|
| 1400 |
+
ray.className = 'sun-ray';
|
| 1401 |
+
|
| 1402 |
+
// 设置射线属性
|
| 1403 |
+
const length = Math.random() * 100 + 100;
|
| 1404 |
+
|
| 1405 |
+
ray.style.width = `${length}px`;
|
| 1406 |
+
ray.style.top = '100px';
|
| 1407 |
+
ray.style.right = '70px';
|
| 1408 |
+
ray.style.transform = `rotate(${angle}deg)`;
|
| 1409 |
+
|
| 1410 |
+
// 添加动画
|
| 1411 |
+
const duration = Math.random() * 3 + 3;
|
| 1412 |
+
ray.style.animation = `pulse ${duration}s ease-in-out infinite`;
|
| 1413 |
+
|
| 1414 |
+
container.appendChild(ray);
|
| 1415 |
+
}
|
| 1416 |
+
|
| 1417 |
+
// 雪天动画
|
| 1418 |
+
function initSnowAnimation() {
|
| 1419 |
+
const snowContainer = document.getElementById('snow-animation');
|
| 1420 |
+
|
| 1421 |
+
// 持续创建雪花
|
| 1422 |
+
setInterval(() => {
|
| 1423 |
+
createSnowflake(snowContainer);
|
| 1424 |
+
}, 100);
|
| 1425 |
+
}
|
| 1426 |
+
|
| 1427 |
+
// 创建雪花
|
| 1428 |
+
function createSnowflake(container) {
|
| 1429 |
+
const snowflake = document.createElement('div');
|
| 1430 |
+
snowflake.className = 'snowflake';
|
| 1431 |
+
|
| 1432 |
+
// 随机大小和位置
|
| 1433 |
+
const size = Math.random() * 6 + 2;
|
| 1434 |
+
const left = Math.random() * 280;
|
| 1435 |
+
|
| 1436 |
+
snowflake.style.width = `${size}px`;
|
| 1437 |
+
snowflake.style.height = `${size}px`;
|
| 1438 |
+
snowflake.style.left = `${left}px`;
|
| 1439 |
+
snowflake.style.top = '0';
|
| 1440 |
+
|
| 1441 |
+
// 添加下落动画
|
| 1442 |
+
const duration = Math.random() * 5 + 5;
|
| 1443 |
+
snowflake.style.animation = `snowfall ${duration}s linear`;
|
| 1444 |
+
|
| 1445 |
+
container.appendChild(snowflake);
|
| 1446 |
+
|
| 1447 |
+
// 动画结束后移除
|
| 1448 |
+
setTimeout(() => {
|
| 1449 |
+
snowflake.remove();
|
| 1450 |
+
}, duration * 1000);
|
| 1451 |
+
}
|
| 1452 |
+
</script>
|
| 1453 |
+
</body>
|
| 1454 |
+
</html>
|