Skip to main content

step_switch_thumb

Function step_switch_thumb 

Source
pub fn step_switch_thumb(
    commands: Commands<'_, '_>,
    tick: Res<'_, Tick>,
    anim: Res<'_, AnimationsActive>,
    q: Query<'_, '_, (Entity, &SwitchThumbSlide, &mut Style, Option<&Visible>)>,
)
Expand description

Advance every active SwitchThumbSlide, writing the eased offset into the thumb’s Style::inset.left and marking it dirty so layout repositions it. Pings AnimationsActive while running so the loop keeps ticking without an unrelated OS event; snaps to the endpoint and retires the component when done (or immediately if the thumb is hidden - a display: none subtree runs no animation, matching the CSS transition drivers in crate::transition).