• Support PF! Buy your school textbooks, materials and every day products via PF Here!

Computer Science Simple Animations

  • Thread starter Hypnos_16
  • Start date
153
1
1. Homework Statement

Create a class called, ThreeObjectAnimation, that creates a graphic animation with three animation object. The ThreeObjectAnimation class should move three objects around the frame, either randomly, or following a fixed pattern. The movements should occur every 250 milliseconds. The ThreeObjectAnimation class should use three classes, ObjectA, ObjectB, and ObjectC for these three movable objects. The object are allowed to intersect. Each of these classes is responsible for drawing a distinct graphics object with at least four shapes and two colours.

The size and colour of the shapes drawn by ObjectA, ObjectB, and ObjectC should be modified every 500 milliseconds. For example, if ObjectA draw a rectangle, then the size of the rectangle could change, a circle in ObjectB could changle colour.

The Car class, on page 106, can be used as an example for the implementation of ObjectA, ObjectB, and ObjectC. The ThreeObjectAnimation class implementation can be based on DrawingTemplate form the course notes.

Note, there are two kinds of animations, one for modify how a object is drawn, and on the modifies where the object is drawn. The movement occurs every 250 ms and the modification of the object is every 500 ms.

The ObjectA, ObjectB, and ObjectC should implement the Animate interface and the Drawable interface. Drawing is done the the Drawable.draw method. Moving the center of the object is done with Animate.move, and changing how the object will be drawn is done with Animate.changeConfiguration.

The interfaces are:

--- Animate ---
public interface Animate {
void move( double x, double y);
void changeConfiguration();
}

--- Drawable -----
import java.awt.Graphics2D;

public interface Drawable {
void draw(Graphics2D g2d);
}

The ThreeObjectAnimation class will invoked Animate.move and Animate.changeConfiguration in the timer callback. The Drawable.draw could be call in the paintComponent method.



2. Homework Equations

N/A

3. The Attempt at a Solution

I'm having a hard time figuring out really where to start here, i have a basic idea for the three objects, i'm just having a really hard time making them work! If someone could help me with animating just one of them i could figure out the others on my own!

please! i really need help here you guys.
 

Want to reply to this thread?

"Computer Science Simple Animations" You must log in or register to reply here.

Related Threads for: Computer Science Simple Animations

Replies
1
Views
7K
Replies
2
Views
2K
Replies
5
Views
2K
  • Posted
Replies
1
Views
2K
  • Posted
Replies
1
Views
1K
  • Posted
Replies
1
Views
1K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top