Initializes the canvas element and fires up the render loop.
Default canvas size is 600x600, you can override it by calling init(true) to make it fill the screen or init(w,h) for a custom width (w) and height (h).
clear() will clear the canvas.
clearp(..) will do something similar, but only partially, used to achieve a Persistence effect. (notice: it clears to white, not transparent)
rect(..) will create a Rectangle a the coordinates (x,y) with the specified width (w) and height (h).
rectf(..) means filled rectangle. rects(..) means stroked rectangle.
Those are direct shorthands of fillRect and strokeRect, thus have their coordinate match the top left edge, for coordinate-centered rects, check boxf/boxs
box(..) acts just like rect(..), but with centered coordinates.
circle(..) creates a circle at the coordinates (x,y) with the given radius (r). Coordinates are centered.
circlef(..) means filled circle. circles(..) means stroked circle.
oval(..) creates an oval at the coordinates (x,y) with the given radiuses (rx,ry). Coordinates are centered.
ovalf(..) means filled oval. ovals(..) means stroked oval.
poly(..) creates a regular polygon at the coordinates (x,y) with the given radius (r), the number of sides (s) and rotation offset (o). Coordinates are centered.
polyf(..) means filled polygon. polys(..) means stroked polygon.
line(..) creates a line from point (x1,y1) to point (x2,y2)
color(..) specifies the current color for all primitives.
The alpha (a) parameter is optional and defaults to 1.
colors(..) specifies fill color. colorf(..) specifies stroke color.
Current time in seconds (t) and milliseconds (ms).
Updated during the render loop.
All Math functions (Math.sin, Math.cos ..) are exposed on the global scope.
init();
function render() {
clearp(0.1);
circlef(300+sin(t/100)*100,300+cos(t/100)*100,10)
};