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

This commit is contained in:
Sean Sube 2025-06-17 20:36:41 -05:00
parent 2402070ef1
commit 85ebe7b8d5
No known key found for this signature in database
GPG Key ID: 3EED7B957D362AF1

View File

@ -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);
};