From 85ebe7b8d5f4f1fd2d8a095838ed4606262175cb Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Tue, 17 Jun 2025 20:36:41 -0500 Subject: [PATCH] Fix screensaver animation blinking issue - Remove frequent screen clearing that caused black frames every few seconds - Keep only the 3-minute clear cycle for burn-in protection - Ensure smooth animation loop by scheduling next frame before any clearing - Eliminate brief black flashes that occurred at animation cycle boundaries - Maintain continuous visual flow without interruption --- client/src/components/Screensaver.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/client/src/components/Screensaver.tsx b/client/src/components/Screensaver.tsx index f88f1dd..4a20a14 100644 --- a/client/src/components/Screensaver.tsx +++ b/client/src/components/Screensaver.tsx @@ -272,7 +272,6 @@ export function Screensaver({ onClose }: ScreensaverProps) { console.log('Screensaver: Using colors', colors); let startTime = Date.now(); - let clearInterval = 0; const animate = () => { const currentTime = Date.now(); @@ -282,13 +281,6 @@ export function Screensaver({ onClose }: ScreensaverProps) { if (currentTime - lastClearTime > 180000) { ctx.clearRect(0, 0, canvas.width, canvas.height); setLastClearTime(currentTime); - clearInterval = 0; - } - - // Clear screen every few seconds for variety - if (clearInterval > 5000) { - ctx.clearRect(0, 0, canvas.width, canvas.height); - clearInterval = 0; } // Create gradient background @@ -313,7 +305,7 @@ export function Screensaver({ onClose }: ScreensaverProps) { // Draw clock drawClock(ctx, canvas.width, canvas.height); - clearInterval += 16; // ~60fps + // Schedule next frame before any potential clearing animationRef.current = requestAnimationFrame(animate); };