Package snap.util

Class Interpolator

java.lang.Object
snap.util.Interpolator

public class Interpolator extends Object
This class provides functionality to interpolate between two numbers given a ratio between 0-1.
  • Field Details

    • LINEAR

      public static Interpolator LINEAR
      Linear interpolator.
    • EASE_IN

      public static Interpolator EASE_IN
      Ease In interpolator.
    • EASE_OUT

      public static Interpolator EASE_OUT
      Ease Out interpolator.
    • EASE_BOTH

      public static Interpolator EASE_BOTH
      Ease Both interpolator.
  • Constructor Details

    • Interpolator

      protected Interpolator(Interpolator.Direction aDir)
      Creates a new interpolator with given direction.
  • Method Details

    • getName

      public String getName()
      Returns the name of this interpolator.
    • getValue

      public double getValue(double aRatio, double aStart, double anEnd)
      Returns a value given a ratio and start/end values.
    • getRatio

      protected double getRatio(double aRatio)
      Returns a new ratio given normal ratio.
    • interp

      protected double interp(double aRatio, double aStart, double aEnd)
      Direction In interpolation.
    • interpOut

      protected double interpOut(double aRatio, double aStart, double aEnd)
      Direction Out interpolation.
    • interpBoth

      protected double interpBoth(double aRatio, double aStart, double anEnd)
      Direction Both interpolation.
    • toString

      public String toString()
      Returns a string representation of this interpolator.
      Overrides:
      toString in class Object
    • getInterpolatorCount

      public static int getInterpolatorCount()
      Returns number of shared common interpolators.
    • getInterpolator

      public static Interpolator getInterpolator(int anIndex)
      Returns the individual common interpolator at given index.
    • getInterpolator

      public static Interpolator getInterpolator(String aName)
      Returns a shared interpolator for given name.