Draw the flag of the United States in the center of the canvas. It is 390 units wide and 208 units high. These sizes keep the stripes and star positions as whole numbers.

  1. Draw 13 equal horizontal stripes. Each stripe is 16 units high. Start with red (#BF0A30) at the top and alternate red and white. The bottom stripe is red.
  2. Draw a dark blue rectangle (#00205B) in the upper-left corner. It is 156 units wide and covers the top seven stripes.
  3. Add 50 small white five-pointed stars inside the blue rectangle. Draw each star with five lines, each 10 units long. Arrange the stars in nine rows. Alternate rows of six stars and five stars, starting and ending with six.
  4. The six-star rows start at x = -182. The five-star rows start at x = -169. Move 26 units right between stars. The rows start at y = 96 and move 12 units down each time.
  5. Set the pen width to 2 units with otto.pensize(2). Draw a black outline around the flag’s outside edge only. Do not outline the stripes or stars.

Flag of the United States