org.jdesktop.animation.timing.interpolation
Class KeyFrames

java.lang.Object
  extended by org.jdesktop.animation.timing.interpolation.KeyFrames

public class KeyFrames
extends Object

KeyFrames holds information about the times at which values are sampled (KeyTimes) and the values at those times (KeyValues). It also holds information about how to interpolate between these values for times that lie between the sampling points.


Constructor Summary
KeyFrames(KeyValues keyValues)
          Simplest variation; determine keyTimes based on even division of 0-1 range based on number of keyValues.
KeyFrames(KeyValues keyValues, Interpolator... interpolators)
          Utility constructor that assumes even division of times according to size of keyValues and interpolation according to interpolators parameter.
KeyFrames(KeyValues keyValues, KeyTimes keyTimes)
          This variant takes both keyValues (values at each point in time) and keyTimes (times at which values are sampled).
KeyFrames(KeyValues keyValues, KeyTimes keyTimes, Interpolator... interpolators)
          Full constructor: caller provides an instance of all key* structures which will be used to calculate between all times in the keyTimes list.
 
Method Summary
 int getInterval(float fraction)
          Returns time interval that contains this time fraction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyFrames

public KeyFrames(KeyValues keyValues)
Simplest variation; determine keyTimes based on even division of 0-1 range based on number of keyValues. This constructor assumes LINEAR interpolation.

Parameters:
keyValues - values that will be assumed at each time in keyTimes

KeyFrames

public KeyFrames(KeyValues keyValues,
                 KeyTimes keyTimes)
This variant takes both keyValues (values at each point in time) and keyTimes (times at which values are sampled).

Parameters:
keyValues - values that the animation will assume at each of the corresponding times in keyTimes
keyTimes - times at which the animation will assume the corresponding values in keyValues
Throws:
IllegalArgumentException - keyTimes and keySizes must have the same number of elements since these structures are meant to have corresponding entries; an exception is thrown otherwise.

KeyFrames

public KeyFrames(KeyValues keyValues,
                 KeyTimes keyTimes,
                 Interpolator... interpolators)
Full constructor: caller provides an instance of all key* structures which will be used to calculate between all times in the keyTimes list. A null interpolator parameter is equivalent to calling KeyFrames(KeyValues, KeyTimes).

Parameters:
keyValues - values that the animation will assume at each of the corresponding times in keyTimes
keyTimes - times at which the animation will assume the corresponding values in keyValues
interpolators - collection of Interpolators that control the calculation of values in each of the intervals defined by keyFrames. If this value is null, a LinearInterpolator will be used for all intervals. If there is only one interpolator, that interpolator will be used for all intervals. Otherwise, there must be a number of interpolators equal to the number of intervals (which is one less than the number of keyTimes).
Throws:
IllegalArgumentException - keyTimes and keyValues must have the same number of elements since these structures are meant to have corresponding entries; an exception is thrown otherwise.
IllegalArgumentException - The number of interpolators must either be zero (interpolators == null), one, or one less than the size of keyTimes.

KeyFrames

public KeyFrames(KeyValues keyValues,
                 Interpolator... interpolators)
Utility constructor that assumes even division of times according to size of keyValues and interpolation according to interpolators parameter.

Parameters:
keyValues - values that the animation will assume at each of the corresponding times in keyTimes
interpolators - collection of Interpolators that control the calculation of values in each of the intervals defined by keyFrames. If this value is null, a LinearInterpolator will be used for all intervals. If there is only one interpolator, that interpolator will be used for all intervals. Otherwise, there must be a number of interpolators equal to the number of intervals (which is one less than the number of keyTimes).
Throws:
IllegalArgumentException - The number of interpolators must either be zero (interpolators == null), one, or one less than the size of keyTimes.
Method Detail

getInterval

public int getInterval(float fraction)
Returns time interval that contains this time fraction