• Returns the value of the oscillation between a and b at time t.

    Parameters

    • a: number

      The minimium value of the oscillation

    • b: number

      The maximum value of the oscillation

    • t: number

      The time

    • Optionalp: number = 1

      The period (must be nonzero)

    • Optionalf: (x: number) => number = Math.cos

      The periodic function (its period must be 2π)

    Returns number

    ((b - a) * (f(2π * t / p) + 1) / 2) + a