mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 23:53:00 +08:00
Interpolate ParallaxContainer's scale
Things were a bit jumpy when a screen was adjusting `ParallaxAmount`. This smoothes the applied scale changes to look great again. Most noticeable when hitting the retry hotkey (`~`) from gameplay.
This commit is contained in:
parent
c11f6efab5
commit
6ad962fc8b
@ -66,8 +66,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount;
|
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount;
|
||||||
|
|
||||||
content.Position = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000), content.Position, offset, 0, 1000, Easing.OutQuint);
|
double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000);
|
||||||
content.Scale = new Vector2(1 + ParallaxAmount);
|
|
||||||
|
content.Position = Interpolation.ValueAt(elapsed, content.Position, offset, 0, 1000, Easing.OutQuint);
|
||||||
|
content.Scale = Interpolation.ValueAt(elapsed, content.Scale, new Vector2(1 + ParallaxAmount), 0, 1000, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
firstUpdate = false;
|
firstUpdate = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user