Class Interpolator

    • Field Detail

      • LINEAR

        public static final Interpolator LINEAR
        Linear interpolation x = interpolate(x)
      • LOG2

        public static final Interpolator LOG2
        Log2 interpolation Math.log(1 + x)/Math.log(2) = interpolate(x)
    • Constructor Detail

      • Interpolator

        public Interpolator()
    • Method Detail

      • newBezierInterpolator

        public static Interpolator newBezierInterpolator​(float px1,
                                                         float py1,
                                                         float px2,
                                                         float py2)
        Builds a bezier interpolator with two control points (px1, py1) and (px2, py2). The points should all be in range [0, 1].
        Parameters:
        px1 - the x-coordinate of first control point, between [0, 1]
        py1 - the y-coordinate of first control point, between [0, 1]
        px2 - the x-coordinate of second control point, between [0, 1]
        py2 - the y-coordinate of second control point, between [0, 1]
        Returns:
        new bezier interpolator
      • interpolate

        public abstract float interpolate​(float x)
        This function takes an input value between 0 and 1 and returns another value, also between 0 and 1.
        Parameters:
        x - a value between 0 and 1
        Returns:
        a value between 0 and 1. Values outside of this boundary may be clamped to the interval [0,1] and cause undefined results.