This iteration includes major changes. First, the createBox function was getting really long, so I pulled the parts of the function out that actually create the various elements (rectangles, circles, letters and words) and made separate functions. These functions are then called inside switch statements in the createBox function. I knew I was going to get more numerous and more complex elments to add to the page. This change in structure paves the way for that.
Then I created a function for making boxes with borders, which has a lot of variability and is quite long. The function breaks down to three parts. First, I need two colors from the color scheme (one for the background and one for the borders). Then I determing the size of the borders, and finally, I decide to either put borders on all sides, two sides or one side. You will notice I set two of the segments to display boxes with borders so that they come up frequently in this version.
Code Snippets for 16
You can see in the createBox function I have added a switch statement to run the appropriate function to add either a box, circle, letter or word. This one is set with boxes with borders to come up twice, as I was testing the function for making different types of boxes with different types of borders
Most of these functions for creating the different elements on the page are pretty simple, but because the createBox function was getting long, it made sense to pull them out.
The function for making rectangles with borders is much longer because there are so many possible configurations. I had to get two colors out of the array, one for the background of the rectangle and one for the borders.