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
-
Create a picture with circles of radius 4 in the center of the visible part of each quadrant.
-
Produce a bunch of solid colored circles starting with this list of colors and radii.
colorRadius :: [(Color, Double)] colorRadius = zip assortedColors [1..10]
-
Create a patchwork quilt of a bunch of 2x2 solid rectangles with a similar color pattern.
-
Use
lettering
andstyledLettering
to label the first three quadrants. Usescaled
to vary the size of the text. Draw a four using coordinates withthickPolyline
in the fourth quadrant.