sub_arctic.anim
Class anticipation_line

java.lang.Object
  |
  +--sub_arctic.anim.line_trajectory
        |
        +--sub_arctic.anim.anticipation_line

public class anticipation_line
extends line_trajectory

This class implements a trajectory along a line, but with cartoonish anticipation and overshoot. The first 20% of the line (0.0-0.2) are spent in anticipation. We compute 10% of the distance traveled (the dimensions x and y are dealt with separately) and move opposite the target direction that amount and then back to our starting point. This is done via a sin curve, so we are sure we end up where we started. As we go across this line we are adding 5% of the total distance traveled into the value and modulating that 5% with a sin function so the object travels in a slightly curved path. The last 20% is the overshoot, and we do that again with a sin.


Field Summary
static double antic_amount
          This is the amount of backup on anticipation.
static double curve_amount
          This is amount of curvature to put in the path.
static double cutoff_point
          Where we start the anticipation and overshoot (in terms of time).
static double overshoot_amount
          This is the amount of overshoot at the end.
 
Fields inherited from class sub_arctic.anim.line_trajectory
_delta_x, _delta_y, _pacer, _x_origin, _y_origin
 
Constructor Summary
anticipation_line(int x1, int y1, int x2, int y2, pacer p)
          Construct a cartoon line between two points. You should make sure that if you use a pacing function which is a slow_in_slow_out that the result of the slow part is 0.2 (== cutoff_point).
 
Method Summary
 java.lang.Object object_for_parm(double parm)
          This does the work for this trajectory.
 
Methods inherited from class sub_arctic.anim.line_trajectory
pacing_function
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

antic_amount

public static double antic_amount
This is the amount of backup on anticipation. Defaults to 10%.

curve_amount

public static double curve_amount
This is amount of curvature to put in the path. Defaults to 5%.

overshoot_amount

public static double overshoot_amount
This is the amount of overshoot at the end. Defaults to 10%.

cutoff_point

public static double cutoff_point
Where we start the anticipation and overshoot (in terms of time). Defaults to 0.2.
Constructor Detail

anticipation_line

public anticipation_line(int x1,
                         int y1,
                         int x2,
                         int y2,
                         pacer p)
Construct a cartoon line between two points.

You should make sure that if you use a pacing function which is a slow_in_slow_out that the result of the slow part is 0.2 (== cutoff_point).

Parameters:
int - x1 starting x coordinate
int - y1 starting y coordinate
int - x2 ending x coordinate
int - y2 ending y coordinate
Method Detail

object_for_parm

public java.lang.Object object_for_parm(double parm)
This does the work for this trajectory. It maps the current time onto a Point.

Parameters:
double - parm the amount of time to be mapped
Overrides:
object_for_parm in class line_trajectory