Phos for WebGL
JavaScript Perl Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


README - Phos and Phosphor

Copyright 2009 David J. Goehrig <>
All Rights Reserved


Phos is a javascript library designed to make programming HTML5 canvas applications easier.  Most of
what it does is provide a coherent API for building interactive components.  It provides a unified
widget / drawing / event statemachine which seeks to minimize the overall complexity of the derived

Phosphor is a javascript development environment that allows the programmer to directly manipulate
the contents of live javascript objects.  The basic concept is that each text block can either be
evaluated (by pressing enter) or inspected (by right clicking).  For properties of objects, their
values can be set by changing the contents of the slot and then pressing enter.

Together Phos and Phosphor allow for the development of rich internet applications, in a dynamic and
exploratory fashion.  The user can either extend existing objects, or create new derived objects 
using "classy objects".  Rather than a traditional javascript prototype based inheritance, any object
can act as a "class".  Instances of that "class" are spawned using the "clone()" method.

Getting Started

The easiest way to use Phosphor is to include both phos.js and phosphor.js in your HTML file:

	<script src="phos.js"></script>
	<script src="phosphor.js"></script> 

Then you initialize the system by invoking phos's boot function when the body loads:

	<body onload="boot(); Phosphor.init()">

This will by default add a canvas to the body object and set it to full window size.  If you'd like 
to preset the canvas side simply add a canvas element with the id='canvas'.

	<canvas id="canvas" height="320" width="240"></canvas>

You can then use the Phosphor system in your very little 320x240 canvas.  


For a brief tutorial on how to use the Phosphor environment open the file Tutorial.html.  Under
Mac OS X you can open the file from the command line using:

	open Tutorial.html

Since Phos and Phosphor can be embedded into any HTML page, 


Both Phos and Phosphor are licensed under the GPL3 license. A copy of the license can be found in
the git repository and is available from the Free Software Foundation at:

If you'd like to submit your own fixes, extensions, or features please feel free to send them to:

	dave at

I'm always happy to incorporate good ideas, especially if they make things simpler, smaller, and
faster.  If you'd like to use Phos or Phosphor in a commercial product, licensing and support
arrangements can also be made to meet your needs.

Keeping Up To Date

The latest and greatest source code is always available for both Phos and Phosphor at:

In order to obtain the latest version of the source code from git you can use the git command:

	git clone git://

To stay up to date, you can grab the most current version using the command:

	git pull

End Transmission