Function bezierPath

  • Given a Bézier curve and an easing function, produce a sequence of points suitable for animating the eased movement along the curve. See https://en.wikipedia.org/wiki/Bézier_curve for an explanation of Bézier curves. The easing function must satisfy:

    • easing(0) = 0 and easing(1) = 1, so that the interpolation goes from P_0 to P_n
    • easing(t) is always in [0, 1], so that the interpolation stays on the curve

    Parameters

    • controlPoints: Point[]

      Bézier curve control points P_0 through P_n, nonempty

    • easing: (ti: number) => number

      function mapping input interpolation parameter ti, 0 <= ti <= 1, to an applied interpolation parameter, as constrained above

    • renameMe: undefined

      TODO: you determine the detailed precondition, including a weaker static type

    Returns Point[]

    TODO: you determine the detailed postcondition, but you may NOT add "throws" cases