Skip to main content

Module cycle

Module cycle 

Source
Expand description

Cycle — show one of N children at a time, advancing on a fixed period. The “rotating loading tip” / status display pattern.

ctx.add(
    Cycle::new()
        .period(Duration::from_secs(3))
        .child(TextWidget::new(lit!("Tip: press Cmd-K to search")))
        .child(TextWidget::new(lit!("Tip: hold Shift to multi-select")))
        .child(TextWidget::new(lit!("Tip: drag the divider to resize"))),
);

Internally a Switcher whose Signal<usize> index is incremented by a per-frame effect. Children share a ZStack slot — at any given moment only the selected child is visible (others are dormant).

§Reduced motion

Honours prefers-reduced-motion: pins on the first child and does not install the timer driver. Subsequent children are still built (so widget construction is identical) but are never shown.

Structs§

Cycle
A wrapper that cycles through its children on a fixed period.