Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Computer Science Simple Animations

  1. Jan 30, 2012 #1
    1. The problem statement, all variables and given/known data

    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. Relevant equations


    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.
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted