ixfx
    Preparing search index...

    Function interpolatorInterval

    • Interpolates between A->B over duration. Given the same A & B values, steps will be larger if it's a longer duration, and shorter if it's a smaller duration.

      A function is returned, which when invoked yields a value between A..B.

      Alternatively to step through by the same amount regardless of time, use interpolatorStepped.

      // Interpolate from 0..1 over one minute
      const v = interpolatorInterval({mins:1});
      v(); // Compute current value

      Use start and end points:

      // Interpolate from 100-200 over 10 seconds
      const v = interpolatorInterval({secs:10}, 100, 200);
      v(); // Compute current value

      Parameters

      • duration: Interval

        Duration for interpolation

      • a: number = 0

        Start point

      • b: number = 1

        End point

      • Optionaloptions: Partial<InterpolateOptions>

        Options for interpolation

      Returns (retargetB?: number, retargetA?: number) => number