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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user