fix: hold white illumination until photo capture completes

This commit is contained in:
2026-11-08 13:06:07 +01:00
parent 82eab93fe1
commit 85cf19dac7
2 changed files with 12 additions and 4 deletions

View File

@@ -8,3 +8,4 @@
- Brand the header as `winf photobooth`, using the standard winf.at favicon, without a tagline or live-camera badge.
- Size instruction panels to their content and use consistent padding at the screen edges.
- Scale branding, icons, typography, and spacing with screen dimensions; cap the centered instruction panel width on large monitors.
- The monitor provides room lighting: keep the translucent white overlay on throughout the countdown and until photo capture returns; do not fade it out early.

View File

@@ -45,8 +45,9 @@ impl Sequence {
let elapsed = now.duration_since(start).as_secs_f32();
Presentation {
countdown: (3 - elapsed as i32).clamp(1, 3),
// A brief translucent white flash when the palm circle fills.
flash_opacity: 0.75 * (1.0 - elapsed / 0.4).clamp(0.0, 1.0),
// The monitor lights the room: hold white illumination until
// the countdown completes and take_picture() returns.
flash_opacity: 0.75,
awaiting_release: false,
}
}
@@ -81,14 +82,14 @@ mod tests {
sequence
.presentation(start + Duration::from_millis(200))
.flash_opacity,
0.375
0.75
);
for (ms, number) in [(999, 3), (1000, 2), (1999, 2), (2000, 1), (2999, 1)] {
let now = start + Duration::from_millis(ms);
// Lowering the hand must not cancel an already-started countdown.
assert!(!sequence.tick(false, false, now));
assert_eq!(sequence.presentation(now).countdown, number);
assert_eq!(sequence.presentation(now).flash_opacity, 0.0);
assert_eq!(sequence.presentation(now).flash_opacity, 0.75);
}
assert!(sequence.tick(true, true, start + Duration::from_secs(3)));
assert!(
@@ -102,6 +103,12 @@ mod tests {
.countdown,
0
);
assert_eq!(
sequence
.presentation(start + Duration::from_secs(3))
.flash_opacity,
0.0
);
assert!(!sequence.tick(true, true, start + Duration::from_secs(4)));
assert!(!sequence.tracking());
assert!(!sequence.tick(false, false, start + Duration::from_secs(5)));