Skip to main content

blink

Function blink 

Source
pub fn blink(
    elapsed: Duration,
    motion: MotionPreference,
) -> (bool, Option<Duration>)
Expand description

Which state the activity mark is in, elapsed into a wait, and how long it holds that state.

Lit for the first half-period of every cycle of Cadence::Activity, dark for the second. Lit and still, with no next flip, whenever activity_blink gives no cadence or a zero one. The delay is what a renderer that schedules its own repaints waits before drawing the flip.

let ms = Duration::from_millis;
assert_eq!(blink(ms(0), MotionPreference::Full), (true, Some(ms(500))));
assert_eq!(blink(ms(600), MotionPreference::Full), (false, Some(ms(400))));
assert_eq!(blink(ms(1100), MotionPreference::Full), (true, Some(ms(400))));
assert_eq!(blink(ms(600), MotionPreference::Reduced), (true, None));