Class Interpolator

java.lang.Object
tripleplay.util.Interpolator

public abstract class Interpolator extends Object
Abstracts the process of interpolation between two values.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    An interpolator that starts to change slowly and ramps up to full speed.
    An interpolator that undershoots the starting value, then speeds up into the final value
    An interpolator that eases away from the starting value, speeds up, then eases into the final value.
    An interpolator that starts to change quickly and eases into the final value.
    An interpolator that eases into the final value and overshoots it before settling on it.
    An interpolator that eases past the final value then back towards it elastically.
    A linear interpolator.
    An interpolator that always returns the starting position.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract float
    apply(float v)
    Interpolates between zero and one according to this interpolator's function.
    float
    apply(float dt, float t)
    Interpolates between zero and one according to this interpolator's function.
    float
    apply(float start, float range, float dt, float t)
    Interpolates between two values.
    float
    applyClamp(float dt, float t)
    Interpolates between two values, as in apply(float,float) except that dt is clamped to [0..t] to avoid interpolation weirdness if dt is ever negative or exceeds t.
    float
    applyClamp(float start, float range, float dt, float t)
    Interpolates between two values, as in apply(float) except that dt is clamped to [0..t] to avoid interpolation weirdness if dt is ever negative or exceeds t.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NOOP

      public static Interpolator NOOP
      An interpolator that always returns the starting position.
    • LINEAR

      public static Interpolator LINEAR
      A linear interpolator.
    • EASE_IN

      public static Interpolator EASE_IN
      An interpolator that starts to change slowly and ramps up to full speed.
    • EASE_OUT

      public static Interpolator EASE_OUT
      An interpolator that starts to change quickly and eases into the final value.
    • EASE_INOUT

      public static Interpolator EASE_INOUT
      An interpolator that eases away from the starting value, speeds up, then eases into the final value.
    • EASE_IN_BACK

      public static Interpolator EASE_IN_BACK
      An interpolator that undershoots the starting value, then speeds up into the final value
    • EASE_OUT_BACK

      public static Interpolator EASE_OUT_BACK
      An interpolator that eases into the final value and overshoots it before settling on it.
    • BOUNCE_OUT

      public static Interpolator BOUNCE_OUT
    • EASE_OUT_ELASTIC

      public static Interpolator EASE_OUT_ELASTIC
      An interpolator that eases past the final value then back towards it elastically.
  • Constructor Details

    • Interpolator

      public Interpolator()
  • Method Details

    • apply

      public abstract float apply(float v)
      Interpolates between zero and one according to this interpolator's function.
      Parameters:
      v - a value between zero and one (usually elapsed/total time).
    • apply

      public float apply(float dt, float t)
      Interpolates between zero and one according to this interpolator's function.
      Parameters:
      dt - the amount of time that has elapsed.
      t - the total amount of time for the interpolation. If t == 0, the result is undefined.
    • applyClamp

      public float applyClamp(float dt, float t)
      Interpolates between two values, as in apply(float,float) except that dt is clamped to [0..t] to avoid interpolation weirdness if dt is ever negative or exceeds t.
    • apply

      public float apply(float start, float range, float dt, float t)
      Interpolates between two values.
      Parameters:
      start - the starting value.
      range - the difference between the ending value and the starting value.
      dt - the amount of time that has elapsed.
      t - the total amount of time for the interpolation. If t == 0, start+range will be returned.
    • applyClamp

      public float applyClamp(float start, float range, float dt, float t)
      Interpolates between two values, as in apply(float) except that dt is clamped to [0..t] to avoid interpolation weirdness if dt is ever negative or exceeds t.