package visual.dynamic.described;


import java.awt.geom.Point2D;

import visual.statik.sampled.*;


/**
 * An animated crystal ball
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 *
 */
public class CrystalBall extends SampledSprite
{

    /**
     * Default Constructor
     *
     */
    public CrystalBall()
    {
	super();
        Content          content;
        ContentFactory   factory;
        
        factory = new ContentFactory();
        

        content = factory.createContent(
                   "/visual/dynamic/described/crystalball01.gif");
        addKeyTime(  500,   0.0, 350.0, -0.75, content);
        addKeyTime( 4000, 100.0, 200.0, -0.30, null);        

        content = factory.createContent(
                   "/visual/dynamic/described/crystalball02.gif");
        addKeyTime( 7500, 200.0,  50.0,  0.00, content);        
        
        setEndState(REMAIN);
    }




    /**
     * Add a key time
     *
     * @param time     The key time
     * @param x        The x position
     * @param y        The y position
     * @param r        The rotation angle
     * @param content  The static visual content
     */
    private void addKeyTime(int time, double x, double y,
                             double r, Content content)
    {
       addKeyTime(time, new Point2D.Double(x, y), new Double(r),
                   new Double(1.0), content);
    }

}
