Semaphore rewrite

April 26, 2011 at 01:14 AM | categories: javascript, projects, semaphore

New decade, new tech.

A few years back, I wrote a Processing sketch to play with semaphore. That project is suprisingly one of my more popular, but I wasn't too happy with the fact that it was a Java applet.

So, I rewrote it in Javascript!

Stuff used

It would have been trivial to port the original project to John Resig's super-awesome Processing.js, but that doesn't work on IE. Now normally I don't care about IE support, but this seemed like a nice small project to try out a different library. So, I have rewritten semaphore using the nice-ish Raphaël library, which renders to SVG on most browsers, and VML on IE.

This was a mostly painless experience, although Raphaël's docs could use a lot of work. If you're interested in quick and easy graphics in Javascript, I would definitely recommend that you give it a try.

The lack of proper local transformations, however, I think would be a deal-breaker in a larger project. Animating a rotation of a group of objects around a pivot point specified in their local coordinates is not, as far as I can tell, possible. Keeping track of the full stack of transformations for groups (or sets as they're called by Raphaël) was fine for a project of my scale, but if you were animating a more complex jointed object would be untenable.

That said, it's early days. Hopefully Raphaël keeps getting better!