Class LinearInterpolator

  • All Implemented Interfaces:
    Interpolator

    public final class LinearInterpolator
    extends java.lang.Object
    implements Interpolator
    This class implements the Interpolator interface by providing a simple interpolate function that simply returns the value that it was given. The net effect is that callers will end up calculating values linearly during intervals.

    Because there is no variation to this class, it is a singleton and is referenced by using the getInstance() static method.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static LinearInterpolator getInstance()
      Returns the single DiscreteInterpolator object
      float interpolate​(float fraction)
      This method always returns the value it was given, which will cause callers to calculate a linear interpolation between boundary values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        public static LinearInterpolator getInstance()
        Returns the single DiscreteInterpolator object
      • interpolate

        public float interpolate​(float fraction)
        This method always returns the value it was given, which will cause callers to calculate a linear interpolation between boundary values.
        Specified by:
        interpolate in interface Interpolator
        Parameters:
        fraction - a value between 0 and 1, representing the elapsed fraction of a time interval (either an entire animation cycle or an interval between two KeyTimes, depending on where this Interpolator has been set)
        Returns:
        the same value passed in as fraction