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.
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:
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!
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.
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: