Graphics

There is demonstration code giving a quick overview of some of the CodeWorld graphics functions.

Colors

There is a short list of built-in colors. There are also some interesting functions like lighter, darker, and translucent which modify existing colors.

Components of colors in CodeWorld are decimals between 0.0 and 1.0, not the more traditional integers from 0 to 255. Usually you can just divide by 255 to make the conversion. The color (RGB 0.25 0.75 1.00) represents a teal color that would be written (64,191,255) in the traditional system.

Notice the interesting list assortedColors.

Exercises

  1. Create a picture with circles of radius 4 in the center of the visible part of each quadrant.

  2. Produce a bunch of solid colored circles starting with this list of colors and radii.

     colorRadius :: [(Color, Double)]
     colorRadius = zip assortedColors [1..10]
    
  3. Create a patchwork quilt of a bunch of 2x2 solid rectangles with a similar color pattern.

  4. Use lettering and styledLettering to label the first three quadrants. Use scaled to vary the size of the text. Draw a four using coordinates with thickPolyline in the fourth quadrant.

Last modified October 29, 2024: Renamed. (815cfb5)