Skip to content

Commit 08e82c3

Browse files
Win11Win11
authored andcommitted
style(cooldown): 增强雪花动画景深效果
使用三层伪元素模拟近/中/远不同速度和大小的雪花飘落
1 parent d62889d commit 08e82c3

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

web/src/index.css

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,19 @@ body {
432432
100% { background-position: 1rem 1rem; }
433433
}
434434

435-
@keyframes snowing {
435+
@keyframes snowing-near {
436436
0% { background-position: 0 0; }
437-
100% { background-position: 50px 100px; }
437+
100% { background-position: 150px 300px; }
438+
}
439+
440+
@keyframes snowing-mid {
441+
0% { background-position: 0 0; }
442+
100% { background-position: -120px 240px; }
443+
}
444+
445+
@keyframes snowing-far {
446+
0% { background-position: 0 0; }
447+
100% { background-position: 90px 180px; }
438448
}
439449

440450
.animate-streaming-badge {
@@ -467,13 +477,42 @@ body {
467477
}
468478

469479
.animate-snowing {
480+
/* Layer 1: Near (Large & Fast) */
481+
background-image:
482+
radial-gradient(6px 6px at 20% 30%, rgba(34, 211, 238, 0.5) 50%, transparent 50%),
483+
radial-gradient(8px 8px at 40% 70%, rgba(34, 211, 238, 0.4) 50%, transparent 50%),
484+
radial-gradient(5px 5px at 60% 40%, rgba(34, 211, 238, 0.5) 50%, transparent 50%),
485+
radial-gradient(7px 7px at 80% 80%, rgba(34, 211, 238, 0.4) 50%, transparent 50%);
486+
background-size: 150px 150px;
487+
animation: snowing-near 6s linear infinite;
488+
}
489+
490+
.animate-snowing::before {
491+
content: '';
492+
position: absolute;
493+
inset: 0;
494+
/* Layer 2: Mid (Medium) */
495+
background-image:
496+
radial-gradient(4px 4px at 10% 80%, rgba(34, 211, 238, 0.3) 50%, transparent 50%),
497+
radial-gradient(5px 5px at 30% 20%, rgba(34, 211, 238, 0.3) 50%, transparent 50%),
498+
radial-gradient(3.5px 3.5px at 60% 60%, rgba(34, 211, 238, 0.3) 50%, transparent 50%),
499+
radial-gradient(4.5px 4.5px at 90% 40%, rgba(34, 211, 238, 0.3) 50%, transparent 50%);
500+
background-size: 120px 120px;
501+
animation: snowing-mid 8s linear infinite;
502+
}
503+
504+
.animate-snowing::after {
505+
content: '';
506+
position: absolute;
507+
inset: 0;
508+
/* Layer 3: Far (Small & Slow) */
470509
background-image:
471-
radial-gradient(6px 6px at 20% 30%, rgba(34, 211, 238, 0.4) 50%, transparent 50%),
472-
radial-gradient(8px 8px at 40% 70%, rgba(34, 211, 238, 0.3) 50%, transparent 50%),
473-
radial-gradient(5px 5px at 60% 40%, rgba(34, 211, 238, 0.4) 50%, transparent 50%),
474-
radial-gradient(7px 7px at 80% 80%, rgba(34, 211, 238, 0.3) 50%, transparent 50%);
475-
background-size: 100px 100px;
476-
animation: snowing 5s linear infinite;
510+
radial-gradient(2px 2px at 5% 45%, rgba(34, 211, 238, 0.2) 50%, transparent 50%),
511+
radial-gradient(2.5px 2.5px at 25% 95%, rgba(34, 211, 238, 0.2) 50%, transparent 50%),
512+
radial-gradient(2px 2px at 55% 15%, rgba(34, 211, 238, 0.2) 50%, transparent 50%),
513+
radial-gradient(2.5px 2.5px at 85% 55%, rgba(34, 211, 238, 0.2) 50%, transparent 50%);
514+
background-size: 90px 90px;
515+
animation: snowing-far 12s linear infinite;
477516
}
478517

479518
/* Marquee effect for table rows - direct background animation */

0 commit comments

Comments
 (0)