drawille-canvas-blessed-contrib

0.1.3 • Public • Published

drawille-canvas

anim

HTML5 Canvas API for drawille.

Install

$ npm install drawille-canvas

In node v0.10 it's a bit slow, with node v0.11 it runs very smoothly.

Usage

See example, check out in the console (node example) or in the browser (example.html).

API

new Canvas(width, height)

Creates a new Canvas with the given dimensions. For method details, see CanvasRenderingContext2D on MDN

c.fillRect(x, y, w, h)

Fills the given area of the canvas.

c.clearRect(x, y, w, h)

Clears the given area of the canvas.

c.save()

Save the current transformation matrix on the stack.

c.restore()

Restore the last transformation matrix.

c.translate(x, y)

Translate the current transformation matrix.

c.rotate(a)

Rotate the current transformation matrix with the given angles.

c.scale(x, y)

Scale the current transformation matrix.

c.beginPath()

Start a new path.

c.closePath()

Close the current path.

c.moveTo(x, y)

Moves the starting point of the next segment to the given coordinates.

c.lineTo(x, y)

Connects the starting point with the given point with a straight line.

c.stroke()

Stroke the current path.

TODO

  • add .fill to fill paths
  • add .arc, .arcTo

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i drawille-canvas-blessed-contrib

Weekly Downloads

56,870

Version

0.1.3

License

MIT

Last publish

Collaborators

  • yaron