Home > canvasrenderer2

canvasrenderer2

Canvasrenderer2 is a project mainly written in JavaScript, it's free.

Create images using JavaScript.

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