1
0
This commit is contained in:
2026-03-07 23:18:25 +09:00
parent 03e1ac06bf
commit b99314d838

View File

@@ -191,9 +191,10 @@ export default function App() {
// Only start timer on first damage // Only start timer on first damage
if (!scoreTimerRef.current) { if (!scoreTimerRef.current) {
scoreEndRef.current = Date.now() + 20000; scoreEndRef.current = Date.now() + 20000;
let lastLeft = -1;
const tick = () => { const tick = () => {
const left = Math.max(0, Math.ceil((scoreEndRef.current - Date.now()) / 1000)); const left = Math.max(0, Math.ceil((scoreEndRef.current - Date.now()) / 1000));
setScoreTimeLeft(left); if (left !== lastLeft) { lastLeft = left; setScoreTimeLeft(left); }
if (left > 0) scoreRafRef.current = requestAnimationFrame(tick); if (left > 0) scoreRafRef.current = requestAnimationFrame(tick);
}; };
tick(); tick();