Fix: 烟花/下雨改用clearRect不遮挡背景,雷电次数增至10次更密集
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user