Template source code

Want to make your own generative drawing app?  Template code has been released on Github! Go grab it, fork it, edit it, and create your own personalized drawing tool.

Essentially, the code has been stripped down to a basic line-drawing app, but with the same structure and assumptions as Swarmpaint uses.  Those features / assumptions are:

  • draws based on movement paths of agent objects
  • save and undo are implemented
  • save and undo are bitmap-snapshot based (as opposed to storing pen movement history)
  • menu key brings up a UI screen that scales to something reasonable for the device size and resolution
  • app will generally behave nicely and remember where you left off when paused, quit or when it loses focus

While the template interaction isn’t that fascinating creatively, my goal was to make all of the infrastructure work from Swarmpaint available to others so that you can skip all of that headache and focus on making your drawing tool reflect your visual style.

If you want to dive in and just create weird motion, go in and customize the Agent class to suit what you want.  If you want to add new settings that you can control from the menu, add your variables, add a UI control (see the controlp5 docs for info) and add your setting to the file i/o section so that the setting’s state is saved when you pause and resume the app.

If you have questions on how to add something, give me a shout over email (josh at this domain name) or on Twitter!

Leave a Reply

Your email address will not be published. Required fields are marked *