-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve slider ball and follow circle animations #14832
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
18534d6
Improve slider ball and follow circle animations
goodtrailer 024cf2e
Revert follow circle size to 2.4x
goodtrailer cffc424
Refactor slider ball and only change anims for legacy skins
goodtrailer 6b25b4e
Add back fast fade out for default slider balls and follow circles
goodtrailer 4d4ddee
Adjust default slider ball and follow circle fast fade outs
goodtrailer 8a697f0
Move slider ball transforms to HitObjectApplied event
goodtrailer 681d04d
Add legacy follow circle expansion anim on tracking stop
goodtrailer 196b9c9
Local bindables and remove subscriptions on slider ball/follow circle…
goodtrailer eeb84cc
Restored default slider ball/follow circle fade values
goodtrailer 0dfcb85
Merge branch 'master' into improve-slider-anims
peppy a77f768
Cache/resolve drawable slider ball
goodtrailer 0808957
Fix InspectCode issues
goodtrailer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Game.Rulesets.Objects.Drawables; | ||
using osu.Game.Rulesets.Osu.Objects.Drawables; | ||
using osuTK.Graphics; | ||
|
||
namespace osu.Game.Rulesets.Osu.Skinning.Default | ||
{ | ||
public class DefaultFollowCircle : CompositeDrawable | ||
{ | ||
private DrawableSlider slider; | ||
private readonly Bindable<bool> trackingBindable = new Bindable<bool>(); | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(DrawableHitObject drawableObject) | ||
{ | ||
slider = (DrawableSlider)drawableObject; | ||
|
||
RelativeSizeAxes = Axes.Both; | ||
|
||
InternalChild = new CircularContainer | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Masking = true, | ||
BorderThickness = 5, | ||
BorderColour = Color4.Orange, | ||
Blending = BlendingParameters.Additive, | ||
Child = new Box | ||
{ | ||
Colour = Color4.Orange, | ||
RelativeSizeAxes = Axes.Both, | ||
Alpha = 0.2f, | ||
} | ||
}; | ||
|
||
trackingBindable.BindTo(slider.Tracking); | ||
trackingBindable.BindValueChanged(trackingChanged, true); | ||
slider.ApplyCustomUpdateState += updateStateTransforms; | ||
} | ||
|
||
private void trackingChanged(ValueChangedEvent<bool> e) | ||
{ | ||
bool tracking = e.NewValue; | ||
|
||
if (slider.Ball.InputTracksVisualSize) | ||
this.ScaleTo(tracking ? DrawableSliderBall.FOLLOW_AREA : 1f, 300, Easing.OutQuint); | ||
else | ||
{ | ||
// We need to always be tracking the final size, at both endpoints. For now, this is achieved by removing the scale duration. | ||
this.ScaleTo(tracking ? DrawableSliderBall.FOLLOW_AREA : 1f); | ||
} | ||
|
||
this.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint); | ||
} | ||
|
||
private void updateStateTransforms(DrawableHitObject obj, ArmedState state) | ||
{ | ||
if (!(obj is DrawableSlider)) | ||
return; | ||
|
||
const float fade_out_time = 450f; | ||
|
||
using (BeginAbsoluteSequence(slider.StateUpdateTime)) | ||
this.FadeIn(); | ||
|
||
using (BeginAbsoluteSequence(slider.HitStateUpdateTime)) | ||
this.FadeOut(fade_out_time / 4, Easing.Out); | ||
} | ||
|
||
protected override void Dispose(bool isDisposing) | ||
{ | ||
base.Dispose(isDisposing); | ||
|
||
if (slider != null) | ||
slider.ApplyCustomUpdateState -= updateStateTransforms; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reasoning for this
FollowReceptor
change? It seems unrelated to the actual goal of this pull.(I also slightly dislike that it scrapes out the slider's ball the way it does, rather than the slider caching the ball explicitly and this component resolving it explicitly, but I suppose it's not horrible.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So
FollowReceptor
is separate from the actual follow circles because this pull request is supposed to only affect the animations of legacy skins. But because the old follow areas were tied directly to the follow circles themselves, that would mean legacy skins (with their different animations) would have different follow areas than the default skin.FollowReceptor
has the same animations as the default skin, so they match perfectly. Legacy skins will be a little off, but that's inevitable if legacy skins and default skin are going to have different animations.