This is a cool new concept. Someone has implemented the Processing language (formerly known as proce55ing) in javascript.

Follow this link:



and you should see some bouncing balls, if you have javascript enabled. (N.B. This doesn't work in IE, or old browsers, because it uses the canvas element.)

Now do 'View Page Source' on that page. At the top of the file is the script used to make the bouncing balls. The Processing language is designed for this sort of thing so it is nice and simple. But your browser doesn't support Processing! The rest of the file is javascript, that takes the Processing script and converts it into javascript on the fly, so it will run.

Now download the html file to your computer. Edit the 8th line to read:

float gravity = 0.0;

and re-open the file in a browser. The balls move around without any gravity. You're programming in Processing, without the Processing IDE, and without compiling. This is pretty cool stuff.

Make some changes to the code and send it to your friends. This is what programming should be like; lightweight and fun.

Some context:

  • Flash and Java applets can do all this too but you need the user to have the plugin, and you need to compile the code, with a toolkit that's a sizeable download.

  • Javascript is the one language that is in everyone's browser, without having to rely on the user having a plugin. But javascript may not be what you want to program in.

  • Google's GWT does something similar, by converting Java code to javascript. But you still need to compile your code, this just works.

  • There's a battle going on over 'rich internet applications'. Some of the technologies are compared here with the help of more bouncing balls.

Notes:

In the html file above I've put the javascript into the same file for ease of use, but the intention is that the processing-to-javascript conversion would live in a different file so it would be cached for speed. See the demos on the processing.js page.

It would have been nice to have the bouncing balls appear in this post, but the wise people at LiveJournal strip out javascript as a matter of policy.


This post was originally on LiveJournal.