test/
test.rs

1//! Test, none of the gradient should show any red.
2use bevy::color::palettes::css::RED;
3use bevy::color::palettes::css::WHITE;
4use bevy::prelude::*;
5use bevy_ui_gradients::*;
6
7fn main() {
8    App::new()
9        .add_plugins((DefaultPlugins, UiGradientsPlugin))
10        .add_systems(Startup, setup)
11        .run();
12}
13
14fn setup(mut commands: Commands) {
15    commands.spawn(Camera2d);
16    commands.spawn(Node::default()).with_children(|commands| {
17        for _ in 0..10 {
18            commands.spawn((
19                Node {
20                    aspect_ratio: Some(1.),
21                    height: Val::Px(103.),
22                    border: UiRect::all(Val::Px(10.)),
23                    margin: UiRect::left(Val::Px(30.)),
24                    ..default()
25                },
26                BorderRadius::all(Val::Px(20.)),
27                BackgroundGradient::from(ConicGradient {
28                    start: 0.,
29                    stops: vec![
30                        AngularColorStop::new(RED, 0.),
31                        AngularColorStop::new(RED, 0.),
32                        AngularColorStop::new(Color::NONE, 0.),
33                    ],
34                    position: Position::CENTER,
35                }),
36                BorderColor(WHITE.into()),
37            ));
38        }
39    });
40}