mirror of
https://github.com/ppy/osu.git
synced 2026-05-20 21:01:17 +08:00
Merge pull request #33189 from peppy/fix-clock-animation
Fix analog clock animation not animating when hand crosses zero
This commit is contained in:
@@ -70,8 +70,18 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
float rotation = fraction * 360 - 90;
|
||||
|
||||
// The case where a hand is completing a rotation.
|
||||
// Animate and then move back one full rotation so we don't need to track outside of 0..360
|
||||
if (Math.Abs(hand.Rotation - rotation) > 180)
|
||||
hand.RotateTo(rotation);
|
||||
{
|
||||
float animRotation = rotation;
|
||||
while (animRotation < hand.Rotation)
|
||||
animRotation += 180;
|
||||
|
||||
hand.RotateTo(animRotation, duration, Easing.OutElastic)
|
||||
.Then()
|
||||
.RotateTo(rotation);
|
||||
}
|
||||
else
|
||||
hand.RotateTo(rotation, duration, Easing.OutElastic);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,14 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
private int? lastSecond;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
UpdateDisplay(DateTimeOffset.Now);
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
Reference in New Issue
Block a user