diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 28831a6d2c7b..e1c94176bc74 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -6,13 +6,17 @@ using System; using System.Diagnostics; using System.Linq; +using System.Runtime.InteropServices; using JetBrains.Annotations; +using Microsoft.Extensions.Logging; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Skinning.Default; +using osu.Game.Rulesets.Taiko.UI; using osu.Game.Skinning; using osuTK; @@ -38,6 +42,21 @@ public TaikoAction? HitAction private double? lastPressHandleTime; + /// + /// Duration of the Fade-In time of the hit. + /// + private const double fade_in_duration = 5000; + + /// + /// Opacity difference of fade-in effect between scroll speeds. + /// + private const double fade_in_curve_factor = 200; + + /// + /// Minimum time between HitObject.StartTime and LifetimeStart. + /// + private const double min_start_time_delta = 90; + private readonly Bindable type = new Bindable(); public DrawableHit() @@ -142,6 +161,19 @@ public override void OnReleased(KeyBindingReleaseEvent e) base.OnReleased(e); } + protected override void UpdateInitialTransforms() + { + double start_time_delta = HitObject.StartTime - LifetimeStart; + // scale Alpha value to adjust to stable's fade-in object opacity when LifetimeStart begins, being the first accessible time point in which changing Alpha is possible + Alpha = (float)(1d - Math.Exp(-(start_time_delta - min_start_time_delta) / fade_in_curve_factor)); + + using (BeginAbsoluteSequence(LifetimeStart)) + { + // makes the fade-in effect negligible on low enough scroll speeds + this.FadeIn(fade_in_duration * (1 - Alpha)); + } + } + protected override void UpdateHitStateTransforms(ArmedState state) { Debug.Assert(HitObject.HitWindows != null); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 28617b35f68c..f0e072b7c8a8 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -35,6 +35,15 @@ public partial class DrawableSwell : DrawableTaikoHitObject /// private const double ring_appear_offset = 100; + /// + /// Offset away from the start time of the swell at which the Fade-In effect starts. + /// + private const double fade_in_offset = 1833; + /// + /// Duration of the Fade-In time of the swell. + /// + private const double fade_in_duration = 666; + private Vector2 baseSize; private readonly Container ticks; @@ -248,10 +257,20 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) } } + protected override void UpdateInitialTransforms() + { + // allow for the fade-in effect + Alpha = 0; + } + protected override void UpdateStartTimeStateTransforms() { base.UpdateStartTimeStateTransforms(); + // swell fade-in effect from stable + using (BeginDelayedSequence(-fade_in_offset)) + this.FadeIn(fade_in_duration, Easing.In); + using (BeginDelayedSequence(-ring_appear_offset)) targetRing.ScaleTo(target_ring_scale, 400, Easing.OutQuint); }