From a9d1e54c27f6f5778c208d6c79ec7c866e44931e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:05:11 +0900 Subject: [PATCH 1/3] Adjust triangle movement based on amplitude --- osu.Game/Graphics/Backgrounds/Triangles.cs | 7 ++++++- osu.Game/Screens/Menu/OsuLogo.cs | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 830d0adc97..5cca57be8a 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -44,6 +44,11 @@ namespace osu.Game.Graphics.Backgrounds /// public bool HideAlphaDiscrepancies = true; + /// + /// The relative velocity of the triangles. Default is 1. + /// + public float Velocity = 1; + public float TriangleScale { get { return triangleScale; } @@ -78,7 +83,7 @@ namespace osu.Game.Graphics.Backgrounds foreach (var t in Children) { t.Alpha = adjustedAlpha; - t.Position -= new Vector2(0, (float)(t.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 950)) / triangleScale); + t.Position -= new Vector2(0, (float)(t.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 950)) / triangleScale * Velocity); if (ExpireOffScreenTriangles && t.DrawPosition.Y + t.DrawSize.Y * t.Scale.Y < 0) t.Expire(); } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 116f7291e2..3bd27073c6 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input; +using osu.Framework.MathUtils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; @@ -38,6 +39,8 @@ namespace osu.Game.Screens.Menu private readonly Container colourAndTriangles; + private Triangles triangles; + public Action Action; public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X * 0.74f; @@ -149,7 +152,7 @@ namespace osu.Game.Screens.Menu RelativeSizeAxes = Axes.Both, Colour = OsuPink, }, - new Triangles + triangles = new Triangles { TriangleScale = 4, ColourLight = OsuColour.FromHex(@"ff7db7"), @@ -260,8 +263,14 @@ namespace osu.Game.Screens.Menu { base.Update(); + const float velocity_adjust_cutoff = 0.98f; var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); + + if (maxAmplitude > velocity_adjust_cutoff) + triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50; + else + triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, 1, 0.995f, Time.Elapsed); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From 16d9a677d0b66359c00a82d0962aa17335972e14 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:05:28 +0900 Subject: [PATCH 2/3] Add a low-end cutoff for scale adjust --- osu.Game/Screens/Menu/OsuLogo.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 3bd27073c6..b1979063dd 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -263,9 +263,11 @@ namespace osu.Game.Screens.Menu { base.Update(); + const float scale_adjust_cutoff = 0.4f; const float velocity_adjust_cutoff = 0.98f; + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; - logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); + logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, EasingTypes.OutQuint); if (maxAmplitude > velocity_adjust_cutoff) triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50; From 03f9a863668e960c235cd955688a19cff3fe0abd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:29:12 +0900 Subject: [PATCH 3/3] Add missing readonly --- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index b1979063dd..44b7b6bceb 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Menu private readonly Container colourAndTriangles; - private Triangles triangles; + private readonly Triangles triangles; public Action Action;