Skip to content

Commit

Permalink
Match slider snaking in speed and slider tail circle fade animation w…
Browse files Browse the repository at this point in the history
…ith osu!stable
  • Loading branch information
Rian8337 committed Jan 22, 2025
1 parent 03c71be commit eea96e3
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/ru/nsu/ccfit/zuev/osu/game/GameplaySlider.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,22 +250,31 @@ public void init(final GameObjectListener listener, final Scene scene,
timePreempt = (float) beatmapSlider.timePreempt / 1000;
float fadeInDuration = (float) beatmapSlider.timeFadeIn / 1000;

// When snaking in is enabled, the first repeat or tail needs to be delayed until the snaking completes.
float fadeInDelay = Config.isSnakingInSliders() ? timePreempt / 3 : 0;

if (GameHelper.isHidden()) {
float fadeOutDuration = timePreempt * (float) ModHidden.FADE_OUT_DURATION_MULTIPLIER;
float finalTailAlpha = (fadeInDuration - fadeInDelay) / fadeInDuration;

headCirclePiece.registerEntityModifier(Modifiers.sequence(
Modifiers.fadeIn(fadeInDuration),
Modifiers.fadeOut(fadeOutDuration)
));

tailCirclePiece.registerEntityModifier(Modifiers.sequence(
Modifiers.fadeIn(fadeInDuration),
Modifiers.fadeOut(fadeOutDuration)
Modifiers.delay(fadeInDelay),
Modifiers.alpha(fadeInDuration - fadeInDelay, 0, finalTailAlpha),
Modifiers.alpha(fadeOutDuration, finalTailAlpha, 0)
));

} else {
headCirclePiece.registerEntityModifier(Modifiers.fadeIn(fadeInDuration));
tailCirclePiece.registerEntityModifier(Modifiers.fadeIn(fadeInDuration));

tailCirclePiece.registerEntityModifier(Modifiers.sequence(
Modifiers.delay(fadeInDelay),
Modifiers.fadeIn(fadeInDuration)
));
}

if (approachCircle.isVisible()) {
Expand All @@ -289,6 +298,11 @@ public void init(final GameObjectListener listener, final Scene scene,
endArrow.setPosition(pathEndPosition.x, pathEndPosition.y);
}

endArrow.registerEntityModifier(Modifiers.sequence(
Modifiers.delay(fadeInDelay),
Modifiers.fadeIn(fadeInDuration)
));

scene.attachChild(endArrow, 0);
}
scene.attachChild(tailCirclePiece, 0);
Expand Down Expand Up @@ -771,17 +785,10 @@ public void update(final float dt) {
approachCircle.setAlpha(0);
}

float percentage = (float) (1 + elapsedSpanTime / timePreempt);

if (percentage <= 0.5f) {
// Following core doing a very cute show animation ^_^"
percentage = Math.min(1, percentage * 2);

if (beatmapSlider.getSpanCount() > 1) {
endArrow.setAlpha(percentage);
}
if (Config.isSnakingInSliders()) {
float percentage = FMath.clamp((float) (timePreempt + elapsedSpanTime) / (timePreempt / 3), 0, 1);

if (Config.isSnakingInSliders()) {
if (percentage < 1) {
if (superPath != null && sliderBody != null) {
float l = superPath.getMeasurer().maxLength() * percentage;

Expand All @@ -792,12 +799,7 @@ public void update(final float dt) {

tailCirclePiece.setPosition(position.x, position.y);
endArrow.setPosition(position.x, position.y);
}
} else if (percentage - dt / timePreempt <= 0.5f) {
if (beatmapSlider.getSpanCount() > 1) {
endArrow.setAlpha(1);
}
if (Config.isSnakingInSliders()) {
} else {
if (!preStageFinish && superPath != null && sliderBody != null) {
sliderBody.setEndLength(superPath.getMeasurer().maxLength());
preStageFinish = true;
Expand Down

0 comments on commit eea96e3

Please sign in to comment.