Phos - a lightweight application library for HTML5 Canvas

So today's project was to break out the code that powers the NewScript/JS canvas implementation and turn it into a sort of stand-alone product. I'm going to do a little work to turn it into a useful application framework, so that you can develop rich apps, doing all sorts of flashy things, without having to do any real programming. For those who would like to get the latest code it is available via git:

git clone git://github.com/cthulhuology/Phos.git
What Phos does is setup a full window canvas widget which can be drawn to using a handful of very simple function calls. Currently the system allows for drawing:
  • lines
  • arcs
  • rectangles
  • rounded frames
  • text
  • images
Additionally, the Phos library provides a basic extensible widget system, by which you can associate events with actions, and alter the drawing state programmatically. The environment also supports scrolling around the screen on platforms that support multidimensional scrolling. This means that the canvas can be considered to have infinite extent if desired.

Some of the less obvious features added to this library are:
  • JSON
  • Network Requests
  • Classy Objects
  • Timer Events
I have a very similar interface already implemented in the NewScriptVM's C implementation, and I may unify all of these various code bases into a singular cross platform API. But for the time being, this is all one really needs to make compelling little webapps and games in under 600 lines of javascript.