use bevy::prelude::*; pub fn spawn_slider( commands: &mut Commands, root: Entity, ){ let slider = commands .spawn(( Node { display: Display::Flex, width: Val::Percent(30.0), height: Val::Percent(3.0), border: UiRect{ left: Val::Px(2.0), right: Val::Px(2.0), top: Val::Px(2.0), bottom: Val::Px(2.0), }, ..default() }, BackgroundColor(Color::srgb_u8(216, 223, 233)), )).id(); let thumb = commands.spawn(( Node{ height: Val::Percent(100.0), aspect_ratio: Some(1.0), ..default() }, BackgroundColor(Color::srgb_u8(1, 226, 106)), )).id(); commands.entity(slider).add_child(thumb); commands.entity(root).add_child(slider); }