Graphic by Keith Ohlfs

CS111, Wellesley College, Fall 1997

Lab #10
[CS111 Home Page] [Syllabus] [Students] [Lecture Notes] [Assignments] [Programs] [Documentation] [Software Installation] [FAQ] [CS Dept.] [CWIS]

CS111 Lab #10: State Variables

You do not need to turn in this lab.

1. Kinetic Sculpture

Last week in lecture you were introduced to state variables, which allow you to change the state of a particular object. State variables are useful in any situation in which you need to keep track of a value and update it at different times. One such situation occurs with animation. To move an object, you need to keep track of its current position and then update that position with each time step. Here is an example of some types of animation you can do by updating different state variables. This particular example has several bouncing balls, rotating disks, chameleon squares and pulsating disks.

Kinetic Sculpture:

Creating your own animated figures.

Download the Kinetic folder from the CS111 download folder. This contains the project file KineticSculpture.proj. Open the project file, and open the KineticSculpture.java file. This has the source code for the four types of figures shown above. We will discuss in lab how each of these figures is updated at each time-step.

The KineticSculpture.java file also contains three dummy classes:

We will implement these three figures in lab. At the end, you should be able to construct a kinetic sculpture that looks as follows:

You do not need to turn in this lab.