Adjust metrics to make banana lens flares look better

This commit is contained in:
Dean Herbert
2022-10-28 19:35:50 +09:00
parent e87b541c58
commit 40efa1603b
4 changed files with 62 additions and 31 deletions

View File

@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
public float DisplayRotation => Rotation; public float DisplayRotation => Rotation;
public double DisplayStartTime => HitObject.StartTime;
/// <summary> /// <summary>
/// Whether this hit object should stay on the catcher plate when the object is caught by the catcher. /// Whether this hit object should stay on the catcher plate when the object is caught by the catcher.
/// </summary> /// </summary>

View File

@ -18,6 +18,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
{ {
public new PalpableCatchHitObject HitObject => (PalpableCatchHitObject)base.HitObject; public new PalpableCatchHitObject HitObject => (PalpableCatchHitObject)base.HitObject;
public double DisplayStartTime => LifetimeStart;
Bindable<Color4> IHasCatchObjectState.AccentColour => AccentColour; Bindable<Color4> IHasCatchObjectState.AccentColour => AccentColour;
public Bindable<bool> HyperDash { get; } = new Bindable<bool>(); public Bindable<bool> HyperDash { get; } = new Bindable<bool>();

View File

@ -16,6 +16,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
{ {
PalpableCatchHitObject HitObject { get; } PalpableCatchHitObject HitObject { get; }
double DisplayStartTime { get; }
Bindable<Color4> AccentColour { get; } Bindable<Color4> AccentColour { get; }
Bindable<bool> HyperDash { get; } Bindable<bool> HyperDash { get; }

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -18,46 +19,53 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
{ {
private Container stabilisedPieceContainer = null!; private Container stabilisedPieceContainer = null!;
protected override Drawable BorderPiece => stabilisedPieceContainer; private Drawable fadeContent = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddInternal(stabilisedPieceContainer = new Container AddInternal(fadeContent = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{ {
new Circle stabilisedPieceContainer = new Container
{ {
Colour = Color4.White.Opacity(0.4f), RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Blending = BlendingParameters.Additive, Children = new Drawable[]
Size = new Vector2(8), {
Scale = new Vector2(30, 1), new Circle
}, {
new Box Colour = Color4.White.Opacity(0.4f),
{ Anchor = Anchor.Centre,
Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White), Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X, Blending = BlendingParameters.Additive,
Blending = BlendingParameters.Additive, Size = new Vector2(8),
Anchor = Anchor.Centre, Scale = new Vector2(25, 1),
Origin = Anchor.CentreRight, },
Width = 1.6f, new Box
Height = 2, {
}, Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.8f)),
new Circle RelativeSizeAxes = Axes.X,
{ Blending = BlendingParameters.Additive,
Colour = ColourInfo.GradientHorizontal(Color4.White, Color4.White.Opacity(0)), Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.X, Origin = Anchor.CentreRight,
Blending = BlendingParameters.Additive, Width = 1.6f,
Anchor = Anchor.Centre, Height = 2,
Origin = Anchor.CentreLeft, },
Width = 1.6f, new Circle
Height = 2, {
Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0.8f), Color4.White.Opacity(0)),
RelativeSizeAxes = Axes.X,
Blending = BlendingParameters.Additive,
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
Width = 1.6f,
Height = 2,
},
}
}, },
new Circle new Circle
{ {
@ -88,10 +96,27 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
{ {
base.Update(); base.Update();
float scale = 0.5f + 0.5f * (1 / (ObjectState.DisplaySize.X / (CatchHitObject.OBJECT_RADIUS * 2))); const float parent_scale_application = 0.4f;
// relative to time on screen
const float lens_flare_start = 0.3f;
const float lens_flare_end = 0.3f;
// Undo some of the parent scale being applied to make the lens flare feel a bit better..
float scale = parent_scale_application + (1 - parent_scale_application) * (1 / (ObjectState.DisplaySize.X / (CatchHitObject.OBJECT_RADIUS * 2)));
stabilisedPieceContainer.Rotation = -ObjectState.DisplayRotation; stabilisedPieceContainer.Rotation = -ObjectState.DisplayRotation;
stabilisedPieceContainer.Scale = new Vector2(scale); stabilisedPieceContainer.Scale = new Vector2(scale, 1);
double duration = ObjectState.HitObject.StartTime - ObjectState.DisplayStartTime;
fadeContent.Alpha = MathHelper.Clamp(
Interpolation.ValueAt(
Time.Current, 1f, 0f,
ObjectState.DisplayStartTime + duration * lens_flare_start,
ObjectState.DisplayStartTime + duration * lens_flare_end,
Easing.OutQuint
), 0, 1);
} }
} }
} }