Animated Shapes
CPS 004.1, 17 July 2002
You are to write a Java applet that displays a variety of animated shapes. They should each animate
differently, but perhaps synchronized into a larger kind of animation. On a computer, animating a shape
involves making many tiny changes to an object's attribute quickly over time, or in other words,
extending a loop over time. However, instead of writing the loop directly, you will write only the body, or
work, of the loop as a specifically named method of a specific class and GP will determine when to call
your function repeatedly.
This assignment is meant to familiarize you with the following concepts discussed in class and your
reading:
- Animation
- Instance versus Local variables
- Extending GP classes
Specifications
You should animate at least five different shapes within your applet. You should create three different
behaviors that each change a different attribute of a given shape, e.g., move to a point, grow for a time,
spin, etc. Since there will be fewer kinds of behaviors than shapes, you must make your behaviors flexible
enough so they can be parameterized by which shape and amount of change to animate, e.g., spin in a
different direction, move at a different speed, or grow at a different rate.
You should do this by creating three classes that extend
GP.Behaviors
and are added to the shape to
animate. You can be creative in determining how each shape animates, but you must implement at least
one of each of the following kinds of behaviors:
On your applet's web page, you should provide directions that tell the user what behavior to expect for a
particular kind of shape.
An example can be seen online
here.
A worked out example can be seen online
here.
Note, the Step
method for an object that extends any
GP.Behavior
is never called directly within your code; instead it is
called by GP only after it has been added to a shape.
What to Submit
When you are finished, you and your partner should transfer the entire project folder created by Visual
J++ to your respective public_html/cps4 folder in the acpub system and update your course web page to
link to the newly transferred project using the guidelines given
here.