/**
 *  The Fan turtle makes a neat fan pattern on the display
 */

import java.awt.*;
import javax.swing.*;
import com.otherwise.jurtle.Turtle;

public class Fan extends Turtle
{

    /**
     *  Main entry point to the code.  After hiding the turtle, it gets the
     *  display's size.  It the uses the size to draw a series of lines from
     *  the top left corner changing colors for each line.  It then does the 
     *  same for the top right corner.
     */
    public void runTurtle()
    {
        hideTurtle();

        Dimension size = getDisplaySize();

        for ( int i = 0; i < 90; i++ )
        {
            setPenColor( Color.getHSBColor( i / 90.0f, 1.0f, 1.0f ) );
            penUp();
            setPosition( 0, 0 );
            penDown();
            setHeading( 90 + i );
            forward( 1200 );
        }

        for ( int i = 0; i < 90; i++ )
        {
            setPenColor( Color.getHSBColor( i / 90.0f, 1.0f, 1.0f ) );
            penUp();
            setPosition( size.width, 0 );
            penDown();
            setHeading( 270 - i );
            forward( 1200 );
        }

    }


}

