优化聊天室特效加载与移动端性能

This commit is contained in:
2026-04-25 03:34:19 +08:00
parent 128b52d0aa
commit e3cba255f9
6 changed files with 158 additions and 25 deletions
+2 -1
View File
@@ -66,7 +66,8 @@ const RainEffect = (() => {
const w = canvas.width;
const h = canvas.height;
const DURATION = 8000;
const DROP_COUNT = 200; // 增加雨滴数量(原 180
const isMobile = window.matchMedia?.("(max-width: 640px)")?.matches || window.innerWidth <= 640;
const DROP_COUNT = isMobile ? 130 : 200; // 移动端降低雨线数量,避免满屏线段拖慢滚动和输入。
const drops = Array.from({ length: DROP_COUNT }, () => {
const d = new Drop(w, h);