/**
 *  The ColorWheel turtle draws a circular gradient of all the colors.  
 *  Shows how to create colors using Color.getHSBColor() 
 */

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

public class ColorWheel extends Turtle
{


    /**
     *  Main entry point to the code.  Draws a color wheel by drawing 360 
     *  radii with a different color for each one.
     */
    public void runTurtle()
    {
        setPenWidth( 5 );
        setAutoUpdate( false );

        for ( int i = 0; i < 360; i = i + 1 )
        {
            setPenColor( Color.getHSBColor( i / 360.0f, 1.0f, 1.0f ) );
            center();
            forward( 200 );
            right( 1 );

            // Only update the display every 10th line drawn.  This decreases
            // time to draw the wheel
            if ( ( i % 10 ) == 0 )
                updateDisplay();
        }
    }
}
