1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

    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.
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

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



Similar Discussions: Computer Science Simple Animations
  1. Sports science (Replies: 1)

  2. Science help (Replies: 1)

  3. Colloid science (Replies: 1)

  4. Atmospheric Science (Replies: 5)

Loading...