nextuppreviouscontents
Next:Entry PointsUp:Objects in an AnimationPrevious:Entry PointsContents




This section is a copy of [1] , which is available at:
http://www.cc.gatech.edu/gvu/softviz/parviz/polkastuff/polkadoc-lite.ps.
The POLKA document is copyrighted by John T. Stasko, College of Computing, Georgia Institute of Technology, Atlanta, GA 30332-0280, and is available for noncommercial use.

Action

An Action is just what its name implies: an action. OK, let's describe it a little more. An Action encapsulates a modification to an AnimObject such as changing its position, size, color, fill, and so on. Once an Action is created, it can be ``programmed'' or ``scheduled'' onto an AnimObject to commence at a particular frame number (see AnimObject::Program earlier in the documentation). Multiple different Actions can be programmed onto an AnimObject at the same time, or a particular Action can be used to program many different AnimObjects.

An Action is composed of 1) an Action type, which can be something like movement, resizing, change in color, etc., and 2) a sequence of dx, dy offsets that we call a path. Just think of a path as a sequence of steps in the $x$-$y$ space.

In a movement Action, the control points or offsets in the associated path define where the AnimObject should next be located. Think of a control point in a path like a frame in a motion picture. In subsequent frames, images have changed location by some small increment. If we iterate the frames in this series, the object appears to move along this path. The length of an Action is the number of offsets its path contains.

Paths are not only used for movement, however. Every Action utilizes its path component to define its exact changes to an object.

Below is the class definition for an Action:

class Action {
   public:
      Action();
      Action(const char *);
      Action(const char *, int, double [], double []);
      Action(const char *, int);
      Action(const char *, MOTION);
      Action(const char *, const char *);
      Action(const char *, Loc *, Loc *, MOTION);
      Action(const char *, Loc *, Loc *, int);
      Action(const char *, Loc *, Loc *, double);
      ~Action();

      int       Length();
      double    Deltax();
      double    Deltay();
      Action *Copy();
      Action *ChangeType(const char *);
      Action *Reverse();
      Action *Smooth();
      Action *Rotate(int);
      Action *Scale(double, double);
      Action *Extend(double, double);
      Action *Interpolate(double);
      Action *Example(Loc *, Loc *);
      Action *Iterate(int);
      Action *Concatenate(Action *);
      Action *Compose(Action *);
};
Quite imposing, isn't it? Well, not really, once you play with it a little. Basically, there are just lots of different member functions that allow you to make paths in lots of different ways. When you want a path for movement, certain functions are especially useful. When you want one for a color change, others may be helpful. Just remember that down underneath is simply a type (which is just a character string) and a list of relative offsets.

In all the constructors below (except first), the initial argument $t$ identifies the Action type. This is simply a character string. The types that we have predefined and designated how AnimObjects will react to them are ``MOVE,'' ``RESIZE,'' ``VIS,'' ``COLOR,'' ``FILL,'' ``RAISE,'' ``LOWER,'' ``ALTER_LL,'' ``ALTER_UR'' and others. Simply designate this string when you create an Action. Below we described how each of these affects the different AnimObjects.

MOVE - move the AnimObject along the given path. The first movement of the AnimObject corresponds to the first relative offset in the path. All these relative offsets are with respect to the AnimObject's previous position on the screen.

VIS - switch the visibility of the AnimObject for each offset in the given path. At each offset in the path, if the AnimObject is visible, it will become invisible, and vice-versa.

COLOR - change the AnimObject to the color indicated by the path.

ALTER - change the string shown for a Text AnimObject.

FILL - change the "fill" component of the AnimObject. This works differently for different types of AnimObjects. For rectangles, circles, ellipses, polygons, and pies, this transition alters the AnimObject's fill style value by the x value of the offsets in the path. The x value is simply added in. If the AnimObject's fill value goes below 0.0, it is automatically set back to 0.0. If it goes above 1.0, it is set back to 1.0. Actually, the full range of values between 0.0 and 1.0 is not available. We currently implement 40 different fills that range between the two extremes. For lines, polylines, and splines, the x value of each offset is added to the line's width parameter value, and the y value is added to the line's style parameter value (see AnimObject constructors for information on width and styles). Extreme values are reset to 0.0 and 1.0 as in rectangles and circles.

RESIZE - resize the AnimObject along the path. The various types of AnimObjects each have a ``method'' in which they are resized. Since lines can have positive or negative sizes, they are resized by altering the line's size for each offset in the path. Rectangles can have only positive sizes, so resizing a rectangle corresponds to ``dragging'' the upper right corner of the rectangle along the given path. If one of the rectangle's dimensions would become negative, it is set to 0. Circles are resized by modifying the circle's radius by the amount given in the x component of each offset in the path. On an ellipse, the resize transition adds the x value to the ellipse's x radius and the y value to the y radius. Pies work similarly. For polylines, polygons, and splines the transitions RESIZE1-RESIZE7 modify relative positions of the respective vertex number, plus all others after it in numerical order, by the relative offsets of the path. These are useful, for example, with a forward arrow polyline that has many of its edges compressed down to start. They can subsequently be grown out in all different directions, one at a time. Currently, resizing has no affect on text.

GRAB - the GRAB actions modify polylines, polygons, and splines by altering the relative position of a particular vertex on the AnimObject (except the one denoting the AnimObject's position) by the relative offsets of the path. As opposed to RESIZE, the transitions GRAB1-GRAB7 alter only one particular vertex in the AnimObject's definition. Think of grabbing that vertex and swinging it around while all the other points stay anchored. With a Pie object, the $x$ component modifies the beginning angle of the pie (0.0->1.0 corresponds to a complete circle) and the $y$ component modifies the delta angle. GRABs have no effect on other AnimObjects.

RAISE - bring the AnimObject to the viewing plane closest to the viewer. The AnimObject's position is not changed, only its relative ordering (top to bottom) with respect to other AnimObjects.

LOWER - push the given AnimObject to the viewing plane farthest from the viewer. The AnimObject's position is not changed, only its relative ordering (top to bottom) with respect to other AnimObjects. It will possibly be obscured by every other AnimObject.

ALTER_LL - this modifies the coordinate value of the lower left corner of the View by adding the $x$ and $y$ offset values of the Action to it. The AnimObject provided is totally ignored (but just don't use a Set because the coordinate will be modified for every member of the Set). This Action is useful to pan and zoom the View window in synchronization with the animation loop.

ALTER_UR - this modifies the coordinate value of the upper right corner of the View. Using both the ALTER_LL and ALTER_UR together on the same path at the same time allows you to pan the View around.
 
 
 
 

Below is a further explanation of the different Action types and the number of offsets in the path of an Action:


nextuppreviouscontents
Next:Entry PointsUp:Objects in an AnimationPrevious:Entry PointsContents
Ha Hoai Phuong

2002-11-11