„So, yesterday I read the awesome article about generative art by @GalaxyKate and now I’m sitting at home, writing a script creating bugs. Like, literally bugs.“
This was the tweet I posted earlier this year along with two images, containing a grid full of white bugs with black outlines. I would not have imagined getting such a huge and positive response.

After stumbling over GalaxyKate’s great talk and blog post about generative art and her procedural flowers, I finally wanted to write a generator by myself. Something nice to look at, with easily recognizable shapes. But what exactly? Leaves? Too boring. Butterflies? The wing pattern might be too complicated to begin with. But Beetles sounded right to me: They differ enough to be interesting and the 6 legs, 2 feelers and 2 wings make them easily recognizable.

The next evening I had two hours of spare time, because I waited for a conference call. So I opened Processing and began to think about how the beetles should look like. Processing was still rather new to me, as I only used it for some simple generative art projects. But it supports Bezièr curves and I had lots of experience with them through extensive Inkscpae
usage. So I started with 5 points to generate my first shape: the center, the neck (where the head should be positioned later), the left and right shoulder points and the bottom. For these I could define the first parameters: the distances from the 4 points to the center (both shoulder distances are the same) and the Bezièr handle lengths of the neck and bottom points. To find the right parameter bounds, I just tried increasing or decreasing the values until the body started looking weird.

Now that I had the body, I continued similarly with the wings and feelers. The head only is an ellipse. And finally the legs: they consist of two rectangles and a row of triangles. And now the Beetle shape is finished – yay! Over all, there are about 50 parameters.

Because of the great response to my tweet, I decided to keep going and give the bugs a colored version. Actually, this was the harder part. First: wing pattern. Two pattern ware created very fast: one which consists of small, random placed little dots, the other one consists of concentric rings with the center at the wing center point. But dots and rings were not exciting enough. So I decided to create a pattern made of wavy lines. Here I had lots of parameters to fiddle around with and a huge variety of wing pattern grew from this method. This is the part I am most proud of in retrospect.

Second: choosing colors. At first, I wanted to choose a random color and then color the different body parts in decreasing saturation. This looked nice, but again I thought it was not exciting enough. So I chose a second ‚highlight‘ color for the wing. This looked better, but not really harmonic. Next, I calculated the gradient between the colors and used the in between colors for the non-wing parts. This looked a lot better, but because I choose the HSB color space, I often generated dark beetles and I wanted them to be more colorful. This happened, because in HSB color space, the saturation parameter goes from ‚black‘ to ‚bright color‘. So if the random saturation value is low, the other values don’t matter anymore: the result will be blackish. Gladly the resolution for this problem is simple: I switched to the HSL color space.

Now that the beetles can be generated, I started creating fun applications: first the twitter bot @beetlesbot that generates a new beetle every 6 hours and adds a nice generated name to the bug. To create this bot, I had to port the whole code to p5.js (javascript version of Processing). And to make a nicer image, I added the wing pattern in low opacity to the background. This improved the bot images a lot! I made pen plotter plots, and therefor had to rewrite the whole code again in paper.js and find a new way to generate the wing pattern. I printed stickers, t-shirts and fabric to make shawls from it and I have lots of other ideas what to do with my new little friends.

If you want to play with the generator yourself, I recommend visiting beetles.bleeptrack.de where you can generate them yourself and play around with the parameter sliders.