When I was drawing my field of flowers, I wanted a series of clouds to float lazily across the screen. And since no two clouds are exactly alike, I wanted each cloud to be a little different. But, in the end, I didn’t have time to find a way to create random clouds, and I decided that having the same cloud float across the screen every time was “good enough”.

Well, apparently “good enough” isn’t good enough because my brain has been working on a solution for drawing random clouds… and now I think I have one. While not perfect, most of these clouds look pretty cute.

I create each cloud by combining one rectangle and four circles. The dimensions of the rectangle and the four circles are all calculated from the height of the rectangle, which is 80 pixels in this example. I calculate the width of the rectangle by multiplying the height by a random number between 1.5 and 2.

Rectangle: width: , height:

I calculate the radii of all four circles by multiplying the height by a random number between 0.5 and 0.75—and I line up the bottom of circle 1 with the bottom left corner of the rectangle, the bottom of circle 2 with the bottom right corner, the left of circle 3 with the top left corner, and the right of circle 4 with the top right corner.

Circle 1 radius: ; circle 2 radius: ; circle 3 radius: ; circle 4 radius:

By coming up with an algorithm for drawing clouds, I can use it to draw either one perfectly designed cloud or dozens of random clouds. This would have been useful to have when I was drawing fields of flowers, but it’s also something I can use in future drawings.

Draw a translucent cloud.