Thursday 21 December 2017

A Gentle Intro to Processing - Coding for Artists

We had another introduction to Processing aimed at complete beginners, including artists who perhaps have never coded or aren't technical.

This was similar to the previous one we held in May, and was organised because members wanted another one. Understanding what members want is important to a successful group, and I hope we keep getting more feedback.



The slides for the event are always at: https://goo.gl/Gygvom

The previous write-up was fairly comprehensive so this one will focus on the differences.


Artists New To Coding

I was really pleased that the group included artists who don't consider themselves technologists or coders. It's been easy to reach coders who want to explore creativity, but we always have to make an effort to reach artists who are new to coding.

I was also really pleased we have members from St Martins and Goldsmiths too!


OpenProcessing.Org

Previously I introduced Processing using p5js - which is just a version made to work in a web browser. That avoids the need for any specific software - and is guaranteed to work on the widest range of devices from laptops to smartphones.

That still required us to mess about with source code text files, editors, using the browser to find the correct index.html file and so on ..

Since that first tutorial, I found OpenProcessing.org which takes away all of that complexity too. We simply code in the browser, and click an icon to see the results. Simple!

And in a classroom environment, where all kinds of things can go wrong, with all kinds of abilities and experience - open processing works really well, avoiding unnecessary obstacles and

I want to thank Neill B for suggesting I look at these kinds of solutions.


Topics

We started with the basic idea a canvas, introducing the structure of all processing code, and having a go hands-on with setting different background colours.

We then progressed to creating our first shapes - a rectangle, and then circles and ellipses too. This required us to understand the coordinate system Processing uses so that we can specify precisely and unambiguously.


The tutorial was structured alternate new ideas with a short "try it yourself" which seemed to work well.

We introduced the idea of repetition as a powerful artistic method for composing images, and looked at some early examples of computer art - from 1996!


Repetition is what computers are good at - they don't get bored, do it without error, and can do it extremely fast. It is not uncommon for examples of algorithmic art to have calculations thousands and millions of times.

We introduced the loop - processing's way of repeating code. I have to admit, Processing doesn't make it as easy as LOGO for example, and I think the Processing Foundation should fix this.

We used the loop to create a sequence of circles, and then expanded the idea to loops within loops - and used that to cover the canvas with circles.

That led naturally into the idea of colour, and how we can mix our own colours using Red, Green and Blue elements - as is common in the computer world - and in familiar tools like Photoshop, Gimp and Krita.


We were running short of time, as always, and briefly introduced the idea of functions - a way of packaging up useful code so it is re-usable by ourselves and others. W didn't get the chance to explore the really important idea of parameterisation and generalisation - transforming code from being very specific to being more generally applicable. The idea of abstraction is key for coders, mathematicians, and a powerful tool for artists.

We did get to see how functions can be used again and again with minimal extra typing, and also how improving or expanding a function benefits anyone using that function without extra effort.



More Advanced Topic - Recursion

We did get a chance to talk through and see a more advanced but incredibly powerful idea - recursion.

The idea of recursion is a definition that is self-referential. In terms of code, it means functions that call themselves. This can take some time to get used to - but it is worth the effort.

Mastering recursion means being able to describe in very very simple terms patterns that are incredibly, and sometimes infinitely, intricate. And the code is extremely simple too.


Here's the simple example created in eg class - with the code at https://www.openprocessing.org/sketch/491140.



We look at using randomness to shoot some of the creative decisions from ourselves to the computer - a significant step, and also using randomness to inject some organic realism into the patterns we create.

The following trees are created using recursion to define the overall branching structure, and randomness to point them in directions that are more realistic than perfect regularity.


The code for these trees is simple, using nothing more than what we covered in the class, except perhaps a little school-level trigonometry - https://www.openprocessing.org/sketch/491144.


Hackathon

There was some suggestions from the class that a creative session would be fun - a hackathon! We held one before, and we'll probably do one again.


Inspired Art

Ogaday, who was in the class, was inspired to create some recursive forms himself. Have a look at his code online -  https://www.openprocessing.org/user/112503

I love the recursive Sierpinski gasket made of circles.


and I really love these recursive circles!



References

The slides contain links to several resources including the code for the key exercises, as well as to useful tools like an RGB colour mixer.

At the end of the class I showed spirograph patterns created by following the orbits of points on a system of gears. The tutorial is here: http://makeyourownalgorithmicart.blogspot.co.uk/2017/11/spirograph.html