Expand description
Pulse — a wrapper widget that pulses its child’s opacity between
a min and max value on a fixed period, sine-shaped.
The classic “blinking red light” / recording-indicator / attention beacon pattern. The wrapped subtree pulses smoothly (sine interpolation), giving a breathing-light feel rather than a hard on/off blink.
ⓘ
ctx.add(
Pulse::opacity(0.3, 1.0)
.period(Duration::from_millis(1200))
.child(RectWidget::new().background(Color::RED)),
);§Layout semantics
Layout-transparent — the child reports its full natural size at
all opacity values. Identical layout footprint to Fade.
§Reduced motion
Honours prefers-reduced-motion: skips the per-frame driver and
pins opacity at the midpoint (min + max) / 2. The subtree stays
visible at a steady, non-distracting brightness so the indicator
still communicates “active” without animating.
Structs§
- Pulse
- Wraps a child and pulses its opacity smoothly between
minandmaxon a fixed period. Useful for recording indicators, notification beacons, and attention-grabbing status icons.