Skip to main content

activity_blink

Function activity_blink 

Source
pub const fn activity_blink(preference: MotionPreference) -> Option<Duration>
Expand description

How fast the activity mark blinks, given whether the reader has asked for less motion.

The same seam as notice_lifetime: the preference is the platform’s to report, and taking the answer rather than the platform keeps this crate off everyone’s dependency graph.

assert_eq!(
    activity_blink(MotionPreference::Full),
    Some(Cadence::Activity.duration())
);
assert_eq!(activity_blink(MotionPreference::Reduced), None);

None is not “the caller decides” and it is not “draw nothing”. It means the mark does not blink: it is drawn, lit, and still, for as long as the wait lasts. The reader still learns that something is happening, which is the whole content of the mark; what they are spared is the movement. A renderer that hides the mark instead has removed the information rather than the animation, and reduced motion asks for the second.

A web surface does not call this. The generated stylesheet carries a prefers-reduced-motion block that does the same thing in the cascade, which is why reduced_motion_css exists.