Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shadow to fan slides #579

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Layout;
using osu.Framework.Utils;
using osuTK;
using osuTK.Graphics;

Expand Down Expand Up @@ -63,17 +66,20 @@ protected override bool OnInvalidate(Invalidation invalidation, InvalidationSour
return base.OnInvalidate(invalidation, source);
}

private float chevHeight, chevWidth;

public ChevronBackingTexture(float lengthScale, float heightScale)
: base(cachedFrameBuffer: true)
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
chevHeight = 16 + (10 * heightScale);
chevWidth = 6 + (210 * lengthScale);
AutoSizeAxes = Axes.Both;

float chevHeight = 16 + (10 * heightScale);
float chevWidth = 6 + (210 * lengthScale);
BufferedContainer content;

AddInternal(new Container
// Effect container
// We are doing this ourelves to increase the padding'
AddInternal(content = new Container
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Expand Down Expand Up @@ -161,7 +167,15 @@ public ChevronBackingTexture(float lengthScale, float heightScale)
},
},
}
});
}.WithEffect(new GlowEffect
{
BlurSigma = new Vector2(20),
Placement = EffectPlacement.Behind,
Colour = Color4.Black
}));

// PadExtent doesn't fully avoid the clipped shadows, we pad with a more conservative estimate
content.Padding = new MarginPadding(Blur.KernelSize(25));
}
}
}
Expand Down
Loading