Function damp

  • Linear interpolation with factor based on user's FPS.

    http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/

    Parameters

    • current: number

      The starting value.

    • target: number

      The end value.

    • factor: number

      The interpolation factor, typically between 0 and 1. A lower value results in slower interpolation, while a higher value makes it faster.

    • delta: number

      Time elapsed since the last update in milliseconds

    • Optionalapproximation: number = 0

      A small threshold to determine when the difference between the interpolated value and the target is negligible. If the difference is within this threshold, the function returns target directly.

    Returns number