Create images using JavaScript.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
canvasrenderer2.js

README.md

canvasrenderer2

This is a newer version of my original canvasrenderer script (Python).

This one is written in JavaScript, for using with node.js.

In this newer version you can use CoffeeScript to write your scripts, as well as using other node.js' modules to do stuff.

Installation

Install CoffeeScript and node-canvas, then download this and make a symlink to this script.

Usage

canvasrenderer script.js

For CoffeeScript use:

canvasrenderer script.coffee

API

I know that this API is ugly and hackish, but is made in order to be compatible with the old version.

newFile(width, height): create a new canvas with width w and height h.

saveFile(name): save file to a file called name.png

Variables

canvas: the canvas

ctx: the 2d context

w: current canvas width

h: current canvas height