Streamlined Generative Art

Streamlined Generative Art

I've spent some time over the last few days streamlining my generative art process. I would like there to be as little friction as possible between having an idea and actually starting coding.

I've created a template folder, which contains the basic libraries I use - Rune.js and Download.js, as well as a bare-bones index.html and sketch.js. I've downloaded the lovely http-server, which starts a no-nonsense web server. Finally, I've built a couple of custom functions - the first lets me refresh a sketch without refreshing the whole page, and the second triggers a download of the image in SVG format (I'd be happy to share these if people are interested, but they're somewhat specific to my setup).

Now, my workflow looks a bit like this:

  • copy my _template folder, and rename it.
  • open the folder in a terminal and run http-server.
  • open the folder in Sublime Text (my text editor of choice).
  • open a web browser and go to http://localhost:8000.
  • start coding

That's all. It takes about 30 seconds, and most of that time is spent figuring out what to call the folder. I have a weird naming convention where folders are called something like d20200718a_rbgcirc. The d is for "Duncan", then the date, then a letter to handle multiple sketches in a day, then an underscore, then finally a descriptive name of some sort. This is definitely over-engineered for my needs.

Improving this process further would probably mean writing a shell script that automatically copies the template folder, asking for a descriptive name in the process, starts http-server, opens sublime text, and finally opens a web browser.

The only bit of that I don't know how to do is running http-server and then running a few more commands. For obvious reasons, the server needs to run before the browser is opened, but I'm not totally sure how to do that once the server is running and the window is, er, "busy". I assume there's some way, I just don't know what it is.

For now though, I'm happy with my system. I love how it takes most of the pain out of setting up a new sketch to work on. I'm sure it'll evolve over time, but right now it's doing a great job for me.