1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Merge pull request #19264 from TacoGuyAT/triangles-animation-tweaks

Increase responsiveness of osu! logo triangles to the beat
This commit is contained in:
Dean Herbert 2022-07-21 15:40:38 +09:00 committed by GitHub
commit 55bde4eeb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 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 { get; private set; }
protected EffectControlPoint LastEffectPoint { get; private set; }
/// <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,11 @@ namespace osu.Game.Screens.Menu
.FadeTo(visualizer_default_alpha * 1.8f * amplitudeAdjust, early_activation, Easing.Out).Then()
.FadeTo(visualizer_default_alpha, beatLength);
}
this.Delay(early_activation).Schedule(() =>
{
triangles.Velocity += amplitudeAdjust * (effectPoint.KiaiMode ? 6 : 3);
});
}
public void PlayIntro()
@ -340,22 +347,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 ? 4 : 2), 0.995f, Time.Elapsed);
}
else
{
triangles.Velocity = paused_velocity;
triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, triangles_paused_velocity, 0.9f, Time.Elapsed);
}
}