Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media
Class Interpolator

    java.lang.Object
      org.monte.media.Interpolator

Direct Known Subclasses:
  AbstractSplineInterpolator

    public abstract class Interpolator

extends java.lang.Object

A linear interpolator for use in conjunction with an Animator object.

Version:
  2.0 2008-04-28 Current time is currentTimeMillis a parameter.
  1.2 2007-08-26 An interpolator can currentTimeMillis override another interpolator.
  1.1 2005-11-02 Notify all, when finished.
  1.0 December 22, 2003 Created.
Author:
  Werner Randelshofer

Constructor Summary
`Interpolator()` Creates a new interpolator which interpolates from 0 to 1 within one second.
`Interpolator(boolean reverse)` Creates a new interpolator which interpolates into the specified direction within one second.
`Interpolator(float startValue, float endValue)` Creates a new interpolator which interpolates from the specified start value to the specified end value within one second.
`Interpolator(float startValue, float endValue, long timespan)` Creates a new interpolator which interpolates from the specified start value to the specified end value within the specified timespan.
`Interpolator(long timespan)` Creates a new interpolator which interpolates from 0 to 1 within the specified timespan.

Method Summary
`void` | `finish(long currentTimeMillis)` Finishes the interpolation and calls this.notifyAll() allowing other threads to synchronize on isFinished() of the interpolator.
`protected float` | `getFraction(float linearFraction)` Computes a fraction from the specified linear fraction.
`void` | `initialize(long currentTimeMillis)` Initializes the interpolation.
`void` | `interpolate(long currentTimeMillis)` Interpolates with the current time millis.
`boolean` | `isElapsed(long currentTimeMillis)` Returns true, if the timespan of the Interpolator has elapsed since initialize was called.
`boolean` | `isFinished()`
`boolean` | `isSequential(Interpolator that)`
`boolean` | `replaces(Interpolator that)` Returns true, if this interpolator replaces interpolations by that interpolator.
`void` | `setTimespan(long t)`
`protected abstract void` | `update(float fraction)` Updates the interpolator.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Interpolator

    public Interpolator()

  Creates a new interpolator which interpolates from 0 to 1 within one second.

### Interpolator

    public Interpolator(long timespan)

  Creates a new interpolator which interpolates from 0 to 1 within the specified timespan.

### Interpolator

    public Interpolator(boolean reverse)

  Creates a new interpolator which interpolates into the specified direction within one second.

  Parameters:
    `reverse` - Set this to true, if you want to interpolate from 1 to 0 instead of from 0 to 1.

### Interpolator

    public Interpolator(float startValue,
                        float endValue)

  Creates a new interpolator which interpolates from the specified start value to the specified end value within one second.

  Parameters:
    `startValue` - A value between 0 and 1.
    `endValue` - A value between 0 and 1.

### Interpolator

    public Interpolator(float startValue,
                        float endValue,
                        long timespan)

  Creates a new interpolator which interpolates from the specified start value to the specified end value within the specified timespan.

  Parameters:
    `startValue` - A value between 0 and 1.
    `endValue` - A value between 0 and 1.
    `timespan` - A timespan in milliseconds.

Method Detail

### update

    protected abstract void update(float fraction)

  Updates the interpolator.

  Parameters:
    `fraction` - An interpolated fraction between 0 and 1.

### getFraction

    protected float getFraction(float linearFraction)

  Computes a fraction from the specified linear fraction. In the simplest case, this method returns the linear fraction. The returned value must be between 0 and 1.

  Parameters:
    `linearFraction` - The linear fraction between 0 and 1.
  Returns:
    A computed fraction between 0 and 1.

### replaces

    public boolean replaces(Interpolator that)

  Returns true, if this interpolator replaces interpolations by that interpolator.

### initialize

    public void initialize(long currentTimeMillis)

  Initializes the interpolation.

  Once this method has been called, method #finish must be called before the interpolator can be destroyed.

  Parameters:
    `currentTimeMillis` -

### isElapsed

    public boolean isElapsed(long currentTimeMillis)

  Returns true, if the timespan of the Interpolator has elapsed since initialize was called.

  Parameters:
    `currentTimeMillis` - The current time.
  Returns:
    Returns true, if the time since initialize was called is greater or equal the timespan of the interpolator.

### interpolate

    public void interpolate(long currentTimeMillis)

  Interpolates with the current time millis.

  Parameters:
    `currentTimeMillis` -

### finish

    public void finish(long currentTimeMillis)

  Finishes the interpolation and calls this.notifyAll() allowing other threads to synchronize on isFinished() of the interpolator.

  Parameters:
    `currentTimeMillis` -

### isFinished

    public boolean isFinished()

### isSequential

    public boolean isSequential(Interpolator that)

### setTimespan

    public void setTimespan(long t)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD