Skip to content

Commit d62889d

Browse files
Win11Win11
authored andcommitted
refactor(cooldown): 使用 CSS 背景动画替代多个 Snowflake 组件
优化冷却状态雪花效果的渲染性能
1 parent b122806 commit d62889d

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

web/src/index.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,11 @@ body {
432432
100% { background-position: 1rem 1rem; }
433433
}
434434

435+
@keyframes snowing {
436+
0% { background-position: 0 0; }
437+
100% { background-position: 50px 100px; }
438+
}
439+
435440
.animate-streaming-badge {
436441
animation: pulseSoft 1.5s ease-in-out infinite;
437442
display: inline-block;
@@ -461,6 +466,16 @@ body {
461466
animation: marquee 1s linear infinite;
462467
}
463468

469+
.animate-snowing {
470+
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;
477+
}
478+
464479
/* Marquee effect for table rows - direct background animation */
465480
.animate-marquee-row {
466481
background-color: rgba(0, 120, 212, 0.08);

web/src/pages/client-routes/components/provider-row.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,8 @@ export function ProviderRowContent({
256256
<>
257257
<div className="absolute inset-0 bg-gradient-to-br from-cyan-500/5 via-transparent to-blue-600/5 pointer-events-none animate-pulse" />
258258
<div className="absolute inset-x-0 top-0 h-[1px] bg-gradient-to-r from-transparent via-cyan-400/20 to-transparent" />
259-
{/* 雪花动画 */}
260-
<div className="absolute inset-0 overflow-hidden pointer-events-none">
261-
{[...Array(6)].map((_, i) => (
262-
<Snowflake
263-
key={i}
264-
size={12}
265-
className="absolute -top-4 text-cyan-500/20 animate-snowfall"
266-
style={{
267-
left: `${Math.random() * 100}%`,
268-
animationDelay: `${Math.random() * 5}s`,
269-
animationDuration: `${5 + Math.random() * 5}s`,
270-
}}
271-
/>
272-
))}
273-
</div>
259+
{/* 雪花动画 (CSS Background) */}
260+
<div className="absolute inset-0 animate-snowing pointer-events-none opacity-60" />
274261
</>
275262
)}
276263

0 commit comments

Comments
 (0)