The Joy of Processing

More exploration of the Processing toolset

Screenshot of processing application using 3d Matrix Transforms

I've been having fun with a tool called Processing, which I strongly recommend, and which we've mentioned a few times on the curiosity blog. To try out these simple demo apps, try clicking anywhere on the panels below.

To view this content, you need to install Java from java.com

To view this content, you need to install Java from java.com

The complete code for the simplest one above is as follows...



                    float d = 0;

                    float x=200;

                    float y=200;

                    

                    void setup(){

                    size(400, 400);

                    noFill();

                    stroke(255,255,255);

                    frameRate(30);

                    }

                    

                    void draw(){

                    background(0, 0, 0);

                    ellipse(x,y,d,d);

                    d=d+1;

                    }

                    

                    void mouseReleased(){

                    x = mouseX;

                    y = mouseY;

                    d = 0;

                    }

                

Why drops in a pool?

Katya's after creating an effect like a tear dripping in a pool of blood for World Aids day, so this seemed like a good starting point. Later, we should take advantage of the 3d drawing primitives to manipulate these animations and a camera's point of view to render the full animated storyboard which Katya's created, in a 3D OpenGL or software-rendered P3D world. You can see how this kind of project gives good scope for me to learn to throw processing around good, and as a tool for teaching programming.

On the left is a demonstrator of the framework which I wrote in a few minutes using the built in IDE. I later improved it to make it more fancy as you see on the right. I reconstructed the whole process of writing these programs step by step to teach Katya how it was done.

I've modified the code in this page to make the Processing applets XHTML compliant, but normally you use the applet pages autogenerated by Processing when you choose 'export', making it very suitable as a web-prototyping toolset. I also really like that the default export format includes the code, so visitors can learn for themselves how you did it. The normal Processing export of the simple implementation, and the more complex implementation are available.

What's the BIG DEAL with Processing anyway?

Just wanted to share my thoughts why processing is so bloody useful. Java is a great language, with powerful libraries available, but all this needs compilation, and libraries need to be properly referenced, language and class versioning can be trouble. All of this is designed into the Java language for good engineering reasons. However, these reasons, like bad security can often get in the way of you just doing a simple job. We're not sending a man to the moon here.

When I first learned Java it probably took me a day to get a window up which would render my draw commands onto it. There's a million and one spurious reasons why your AWT object wouldn't show any of the commands you wanted, or even appear at all, all of which need intensive debugging for a novice user.

Processing does away with this java overengineering, providing a good old-fashioned hacking environment which delivers results quickly.

That doesn't mean it can't be used for real world projects. Recently I've used it to prototype an experimental display I invented, and shown to Dave, but this isn't public yet.

Processing provides a built in IDE and interpreter for a simplified syntax with the all good stuff based on Java. At the same time it can bring in all the Java libraries you need. If they are not already part of the supported libraries, which do just about anything you can imagine, you can just import your own as you like.

I've been wondering about using it as a fancy multimedia presentation of this blog; my content is all authored in XML and can be served up in whatever structure I want, and Processing has simple XML libraries, giving an open an freely available open source Flash substitute. Watch this space.

Tagged:

processing (4)

java (2)

katya (2)

tutorial

code

tools

review

aids