untested visualizer complete.
This commit is contained in:
@@ -32,11 +32,14 @@ namespace RhythmBullet.Zer01HD.Utilities.Camera
|
||||
Matrix.CreateTranslation(new Vector3(bounds.Width * 0.5f, bounds.Height * 0.5f, 0f));
|
||||
}
|
||||
|
||||
public void LinearInterpolationToPosition(float alpha, Vector2 targetPosition)
|
||||
public void LinearInterpolationToPosition(float alpha, Vector2 targetPosition, float delta)
|
||||
{
|
||||
if (alpha < 0 && alpha > 1f) throw new ArgumentException("Alpha can't be greater than 1f, or less than 0.");
|
||||
Position.X = MathHelper.Lerp(Position.X, targetPosition.X, alpha);
|
||||
Position.Y = MathHelper.Lerp(Position.Y, targetPosition.Y, alpha);
|
||||
if (alpha <= 0 && alpha > 1f) throw new ArgumentException("Alpha can't be greater than 1f, less than or equal to 0.");
|
||||
|
||||
Vector2 distance = targetPosition - Position;
|
||||
distance *= (float)(1.0f - Math.Pow(1 - alpha, delta / 0.02f));
|
||||
|
||||
Position += distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ namespace RhythmBullet.Zer01HD.UI.Book
|
||||
Rectangle targetBounds = targetPage.Bounds;
|
||||
position.X = targetBounds.X + (targetBounds.Width * 0.5f);
|
||||
position.Y = targetBounds.Y + (targetBounds.Height * 0.5f);
|
||||
camera.LinearInterpolationToPosition(0.4f, position);
|
||||
camera.LinearInterpolationToPosition(0.4f, position, (float)gameTime.ElapsedGameTime.TotalSeconds);
|
||||
if (camera.Position == position)
|
||||
{
|
||||
targetPage = null;
|
||||
|
Reference in New Issue
Block a user