Add shared constant for parallax amount

This commit is contained in:
Dean Herbert 2019-11-07 09:30:50 +09:00
parent aaa06396f0
commit d400e4a5f6
1 changed files with 4 additions and 2 deletions

View File

@ -69,9 +69,11 @@ protected override void Update()
{
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount;
double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000);
const float parallax_duration = 100;
content.Position = Interpolation.ValueAt(elapsed, content.Position, offset, 0, 100, Easing.OutQuint);
double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, parallax_duration);
content.Position = Interpolation.ValueAt(elapsed, content.Position, offset, 0, parallax_duration, Easing.OutQuint);
content.Scale = Interpolation.ValueAt(elapsed, content.Scale, new Vector2(1 + System.Math.Abs(ParallaxAmount)), 0, 1000, Easing.OutQuint);
}