com.hdcookbook.grin.features.parts
Class PointsEasingEquation

java.lang.Object
  extended by com.hdcookbook.grin.features.parts.EasingEquation
      extended by com.hdcookbook.grin.features.parts.PointsEasingEquation

public class PointsEasingEquation
extends EasingEquation

This class represents an degenerate case of an easing function that consists of just listing the in between points. It can be used by the GRIN compiler to generate a linear interpolation that approximates that list of points within a certain error.


Field Summary
 
Fields inherited from class com.hdcookbook.grin.features.parts.EasingEquation
framesAdded
 
Constructor Summary
PointsEasingEquation(int[][] points)
           
 
Method Summary
 void addKeyFrames(java.util.ArrayList<int[]> keyFrames, int[] end)
          Approximate this easing function with linear interpolation segments, making sure that the error doesn't exceed maxError units.
 double evaluate(double t, double b, double c, double d)
          Evaluate the eqsing equation.
 
Methods inherited from class com.hdcookbook.grin.features.parts.EasingEquation
setMaxError, trimUnneededKeyFrames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointsEasingEquation

public PointsEasingEquation(int[][] points)
Method Detail

addKeyFrames

public void addKeyFrames(java.util.ArrayList<int[]> keyFrames,
                         int[] end)
                  throws java.io.IOException
Description copied from class: EasingEquation
Approximate this easing function with linear interpolation segments, making sure that the error doesn't exceed maxError units. We start the easing from keyFrames[size-1], and add to keyFrames.

Overrides:
addKeyFrames in class EasingEquation
Parameters:
keyFrames - a list of { frame#, value, ... } int arrays
end - Where to ease to, { frame#, value, ... }
Throws:
java.io.IOException

evaluate

public double evaluate(double t,
                       double b,
                       double c,
                       double d)
Description copied from class: EasingEquation
Evaluate the eqsing equation.

Specified by:
evaluate in class EasingEquation
Parameters:
t - current time in frames, seconds, or any other unit
b - beginning value
c - change in value
d - duration in frames, seconds, or any other unit