Logo triangles speed and beat sync tweaks

This commit is contained in:
TacoGuyAT 2022-07-21 06:13:45 +03:00
parent 7dfc18a0e3
commit ed8e065a86
2 changed files with 21 additions and 10 deletions

View File

@ -28,7 +28,8 @@ namespace osu.Game.Graphics.Containers
public class BeatSyncedContainer : Container
{
private int lastBeat;
private TimingControlPoint lastTimingPoint;
protected TimingControlPoint LastTimingPoint;
protected EffectControlPoint LastEffectPoint;
/// <summary>
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, TimingControlPoint, EffectControlPoint, ChannelAmplitudes)"/>.
@ -127,7 +128,7 @@ namespace osu.Game.Graphics.Containers
TimeSinceLastBeat = beatLength - TimeUntilNextBeat;
if (ReferenceEquals(timingPoint, lastTimingPoint) && beatIndex == lastBeat)
if (ReferenceEquals(timingPoint, LastTimingPoint) && beatIndex == lastBeat)
return;
// as this event is sometimes used for sound triggers where `BeginDelayedSequence` has no effect, avoid firing it if too far away from the beat.
@ -139,7 +140,8 @@ namespace osu.Game.Graphics.Containers
}
lastBeat = beatIndex;
lastTimingPoint = timingPoint;
LastTimingPoint = timingPoint;
LastEffectPoint = effectPoint;
}
}
}

View File

@ -90,6 +90,8 @@ namespace osu.Game.Screens.Menu
private const double early_activation = 60;
private const float triangles_paused_velocity = 0.5f;
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
public OsuLogo()
@ -319,6 +321,15 @@ namespace osu.Game.Screens.Menu
.FadeTo(visualizer_default_alpha * 1.8f * amplitudeAdjust, early_activation, Easing.Out).Then()
.FadeTo(visualizer_default_alpha, beatLength);
}
if (amplitudes.Maximum > 0.3f)
this.Delay(early_activation / 2).Schedule(() =>
triangles.Velocity = (float)Interpolation.Damp(
triangles.Velocity,
triangles_paused_velocity * (effectPoint.KiaiMode ? 6 : 2) + amplitudeAdjust * (effectPoint.KiaiMode ? 8 : 4),
0.3f,
Time.Elapsed
));
}
public void PlayIntro()
@ -340,22 +351,17 @@ namespace osu.Game.Screens.Menu
base.Update();
const float scale_adjust_cutoff = 0.4f;
const float velocity_adjust_cutoff = 0.98f;
const float paused_velocity = 0.5f;
if (musicController.CurrentTrack.IsRunning)
{
float maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0;
logoAmplitudeContainer.Scale = new Vector2((float)Interpolation.Damp(logoAmplitudeContainer.Scale.X, 1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 0.9f, Time.Elapsed));
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);
triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, triangles_paused_velocity * (LastEffectPoint.KiaiMode ? 6 : 2), 0.995f, Time.Elapsed);
}
else
{
triangles.Velocity = paused_velocity;
triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, triangles_paused_velocity, 0.9f, Time.Elapsed);
}
}
@ -378,6 +384,9 @@ namespace osu.Game.Screens.Menu
protected override bool OnClick(ClickEvent e)
{
//triangles.AccentColours = this.FindClosestParent<MainMenu>()!.GetBackgroundColours(2).Select(x => Graphics.Backgrounds.Triangles.InRange(x, 0)).ToArray();
//background.Colour = this.FindClosestParent<MainMenu>()!.GetBackgroundColours()[0];
if (Action?.Invoke() ?? true)
sampleClick.Play();