优化聊天室特效加载与移动端性能
This commit is contained in:
@@ -102,7 +102,9 @@ const GoldRainEffect = (() => {
|
||||
const w = canvas.width;
|
||||
const h = canvas.height;
|
||||
const DURATION = 8600;
|
||||
const COIN_COUNT = Math.min(58, Math.max(28, Math.floor(w / 28)));
|
||||
const isMobile = window.matchMedia?.("(max-width: 640px)")?.matches || window.innerWidth <= 640;
|
||||
const densityScale = isMobile ? 0.72 : 1;
|
||||
const COIN_COUNT = Math.round(Math.min(58, Math.max(28, Math.floor(w / 28))) * densityScale);
|
||||
const coins = Array.from({ length: COIN_COUNT }, () => new Coin(w, h));
|
||||
const startTime = performance.now();
|
||||
let animId = null;
|
||||
|
||||
Reference in New Issue
Block a user