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:
parent
2402070ef1
commit
85ebe7b8d5
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user