Glass's video fade stepped down whenever it was already at its target, so a fully shown video dipped every other frame. At 60 fps that was a 5 % dip; on a slow GPU (Raspberry Pi 4, ~10 fps during playback) the video went down to ~60 % every other frame and the backdrop flickered through. The fade now clamps to its target, like the picture fades do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -434,11 +434,14 @@ impl State {
|
||||
keep
|
||||
});
|
||||
|
||||
// Eases to the target and stays there. (It used to step down whenever
|
||||
// it was already at the target: a fully shown video dipped every
|
||||
// other frame, a visible flicker at a slow GPU's frame rate.)
|
||||
let target = if self.video_on { 1.0 } else { 0.0 };
|
||||
self.video_alpha = if target > self.video_alpha {
|
||||
(self.video_alpha + dt / 0.3).min(1.0)
|
||||
(self.video_alpha + dt / 0.3).min(target)
|
||||
} else {
|
||||
(self.video_alpha - dt / 0.3).max(0.0)
|
||||
(self.video_alpha - dt / 0.3).max(target)
|
||||
};
|
||||
if !self.video_on && self.video_alpha <= 0.0 {
|
||||
self.video = None;
|
||||
|
||||
Reference in New Issue
Block a user