1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 07:42:55 +08:00

Add box for gradient comparison

This commit is contained in:
Andrei Zavatski 2022-11-30 05:12:26 +03:00
parent 2eaefcad30
commit fa1000777d

View File

@ -14,6 +14,7 @@ namespace osu.Game.Tests.Visual.Background
public partial class TestSceneTrianglesV2Background : OsuTestScene public partial class TestSceneTrianglesV2Background : OsuTestScene
{ {
private readonly TrianglesV2 triangles; private readonly TrianglesV2 triangles;
private readonly Box box;
public TestSceneTrianglesV2Background() public TestSceneTrianglesV2Background()
{ {
@ -24,25 +25,44 @@ namespace osu.Game.Tests.Visual.Background
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Gray Colour = Color4.Gray
}, },
new Container new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(500, 100), AutoSizeAxes = Axes.Both,
Masking = true, Direction = FillDirection.Vertical,
CornerRadius = 40, Spacing = new Vector2(0, 5),
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Container
{ {
RelativeSizeAxes = Axes.Both, Size = new Vector2(500, 100),
Colour = Color4.Red Masking = true,
CornerRadius = 40,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Red
},
triangles = new TrianglesV2
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both
}
}
}, },
triangles = new TrianglesV2 new Container
{ {
Anchor = Anchor.Centre, Size = new Vector2(500, 100),
Origin = Anchor.Centre, Masking = true,
RelativeSizeAxes = Axes.Both CornerRadius = 40,
Child = box = new Box
{
RelativeSizeAxes = Axes.Both
}
} }
} }
} }
@ -53,16 +73,16 @@ namespace osu.Game.Tests.Visual.Background
{ {
base.LoadComplete(); base.LoadComplete();
AddSliderStep("Spawn ratio", 0f, 5f, 1f, s => AddSliderStep("Spawn ratio", 0f, 10f, 1f, s =>
{ {
triangles.SpawnRatio = s; triangles.SpawnRatio = s;
triangles.Reset(1234); triangles.Reset(1234);
}); });
AddSliderStep("Thickness", 0f, 1f, 0.02f, t => triangles.Thickness = t); AddSliderStep("Thickness", 0f, 1f, 0.02f, t => triangles.Thickness = t);
AddStep("White colour", () => triangles.Colour = Color4.White); AddStep("White colour", () => box.Colour = triangles.Colour = Color4.White);
AddStep("Vertical gradient", () => triangles.Colour = ColourInfo.GradientVertical(Color4.White, Color4.Red)); AddStep("Vertical gradient", () => box.Colour = triangles.Colour = ColourInfo.GradientVertical(Color4.White, Color4.Red));
AddStep("Horizontal gradient", () => triangles.Colour = ColourInfo.GradientHorizontal(Color4.White, Color4.Red)); AddStep("Horizontal gradient", () => box.Colour = triangles.Colour = ColourInfo.GradientHorizontal(Color4.White, Color4.Red));
} }
} }
} }