Ooh! My computer is better at drawing than I am. But then, I barely know which way to hold a pencil, so that’s hardly much of a surprise.

From Code to Pretty Pictures: It’s Processing!

Haje Jan Kamps
4 min readDec 17, 2015

If you’ve been following my past blog posts, you’ll have seen that I’ve written a bit of code here and there. I created a bot that analyses racism on Twitter, and created some code to do a data-journalism type piece on who Twitter’s verified users are.

In both pieces, I warn that I’m not a coder, which is definitely true; I always suspect that people who actually know how to code would laugh at my attempts. But that isn’t going to stop me!

Processing is one of the languages I keep coming back to. If I understand it correctly, it’s an easy-to-learn, well-documented version of Java (with great tutorials and documentation) — but it’s also especially well suited to doing visual and graphical things. Perfect for artists and people wanting to create interfaces between computers and the real world.

Or, as they put it themselves:

Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts.

Sweet.

So, I figured I’d share a few of the projects I’ve been playing with…

Gravity Wells with Earth and Moon

This piece of code simulates a simple 2D world with a planet and a moon. The moon circulates around the planet, and little dots fly into view from the left and right. The dots are drawn in by the gravity:

You can grab the source-code from GitHub here.

Digital Spirograph

Another thing I’ve been playing with for a while are digital spirographs. Basically, using math to place dots on a canvas based on four different patterns, and seeded with random numbers, creating pretty patterns.

It’s a little bit of math, but that’s the great thing about Processing; I think I’ve learned more about trigonometry from messing about with a bit of code and seeing what happens than I ever did in school. At least now I can see what difference it makes when you change a variable here or replace cosine with sine there!

Again, source code is available on GitHub.

Word Clouds

I also used Processing to create a series of word clouds based on the Wikipedia articles for the countries:

The word clouds aren’t particularly pretty, but they work, and they do actually show some cool differences between the different countries. This one uses a couple of unlicensed fonts and some additional scripts to actually grab the info from Wikipedia, so I can’t share the source code, but it was a fun project.

BubbleSines

Another fun one again includes a bit of math, but it also tries to play with an illusion of depth of field, by altering the transparency and size of the individual dots, creating some pretty cool optical illusions:

Source code on GitHub.

Have a go!

So — Processing is completely free, relatively easy to learn (start with the examples and simply start changing stuff to see what happen), and there’s a vibrant community out there. Have a go!

--

--

Haje Jan Kamps
Haje Jan Kamps

Written by Haje Jan Kamps

Writer, startup pitch coach, enthusiastic dabbler in photography.

Responses (1)