Fix: 烟花/下雨改用clearRect不遮挡背景,雷电次数增至10次更密集

This commit is contained in:
2026-02-27 14:17:56 +08:00
parent 709e0d4975
commit 215fbd7221
3 changed files with 10 additions and 16 deletions
+3 -4
View File
@@ -112,11 +112,10 @@ const FireworksEffect = (() => {
// 动画循环
function animate(now) {
// 用半透明黑色覆盖,产生运动拖尾效果
ctx.fillStyle = "rgba(0, 0, 0, 0.18)";
ctx.fillRect(0, 0, w, h);
// 清除画布(保持透明,不遮挡聊天背景)
ctx.clearRect(0, 0, w, h);
// 更新并绘制存活粒子
// 更新并绘制存活粒子(粒子自带 alpha 衰减,视觉上有淡出效果)
particles = particles.filter((p) => p.alpha > 0.02);
particles.forEach((p) => {
p.update();