mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +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:
commit
55bde4eeb0
@ -28,7 +28,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
public class BeatSyncedContainer : Container
|
public class BeatSyncedContainer : Container
|
||||||
{
|
{
|
||||||
private int lastBeat;
|
private int lastBeat;
|
||||||
private TimingControlPoint lastTimingPoint;
|
protected TimingControlPoint LastTimingPoint { get; private set; }
|
||||||
|
protected EffectControlPoint LastEffectPoint { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, TimingControlPoint, EffectControlPoint, ChannelAmplitudes)"/>.
|
/// 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;
|
TimeSinceLastBeat = beatLength - TimeUntilNextBeat;
|
||||||
|
|
||||||
if (ReferenceEquals(timingPoint, lastTimingPoint) && beatIndex == lastBeat)
|
if (ReferenceEquals(timingPoint, LastTimingPoint) && beatIndex == lastBeat)
|
||||||
return;
|
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.
|
// 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;
|
lastBeat = beatIndex;
|
||||||
lastTimingPoint = timingPoint;
|
LastTimingPoint = timingPoint;
|
||||||
|
LastEffectPoint = effectPoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private const double early_activation = 60;
|
private const double early_activation = 60;
|
||||||
|
|
||||||
|
private const float triangles_paused_velocity = 0.5f;
|
||||||
|
|
||||||
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
|
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
|
||||||
|
|
||||||
public OsuLogo()
|
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 * 1.8f * amplitudeAdjust, early_activation, Easing.Out).Then()
|
||||||
.FadeTo(visualizer_default_alpha, beatLength);
|
.FadeTo(visualizer_default_alpha, beatLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Delay(early_activation).Schedule(() =>
|
||||||
|
{
|
||||||
|
triangles.Velocity += amplitudeAdjust * (effectPoint.KiaiMode ? 6 : 3);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayIntro()
|
public void PlayIntro()
|
||||||
@ -340,22 +347,17 @@ namespace osu.Game.Screens.Menu
|
|||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
const float scale_adjust_cutoff = 0.4f;
|
const float scale_adjust_cutoff = 0.4f;
|
||||||
const float velocity_adjust_cutoff = 0.98f;
|
|
||||||
const float paused_velocity = 0.5f;
|
|
||||||
|
|
||||||
if (musicController.CurrentTrack.IsRunning)
|
if (musicController.CurrentTrack.IsRunning)
|
||||||
{
|
{
|
||||||
float maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0;
|
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));
|
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 = (float)Interpolation.Damp(triangles.Velocity, triangles_paused_velocity * (LastEffectPoint.KiaiMode ? 4 : 2), 0.995f, Time.Elapsed);
|
||||||
triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50;
|
|
||||||
else
|
|
||||||
triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, 1, 0.995f, Time.Elapsed);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
triangles.Velocity = paused_velocity;
|
triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, triangles_paused_velocity, 0.9f, Time.Elapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user