• Stars
    star
    378
  • Rank 113,272 (Top 3 %)
  • Language
    JavaScript
  • Created over 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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)

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

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

Fill the given area of the canvas.

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

Clear 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)

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

c.lineTo(x, y)

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

c.arc(x, y, radius, start_angle, end_angle, anticlockwise)

Draw an arc between two angles at centre x, y.

c.stroke()

Stroke the current path.

c.fill()

Fill the current path.

c.getContext('2d')

Return canvas itself, for compliance with browser.

c.width, c.height

Canvas dimensions.

c.toString()

Return the current content of canvas as a string with braille characters.

c.getImageData(sx, sy, sw, sh)

Return an ImageData object { width, height, data }, representing the underlying canvas data for the area of the canvas denoted by the rectangle which starts at sx, sy and has an sw width and sh height. data property is a string with braille characters.

c.putImageData(imagedata, dx, dy [, dirtyX, dirtyY, dirtyWidth, dirtyHeight])

Paint data from the given imagedata object { width, height, data } onto the canvas. If a dirty rectangle is provided, only the area from that rectangle is painted.

License

MIT

More Repositories

1

node-drawille

Drawing in terminal with unicode braille characters
JavaScript
1,008
star
2

node-bresenham

JavaScript
66
star
3

es6-dic

JavaScript
13
star
4

node-fourier-motzkin

Fourier-Motzkin Elimination
JavaScript
11
star
5

funny-accidents

JavaScript
8
star
6

dotfiles

Lua
8
star
7

spacegame

JavaScript
7
star
8

node-tumblr-map

JavaScript
6
star
9

node-round-robin-database

JavaScript
6
star
10

advent-of-code-2019

Clojure
5
star
11

koa-parse-json

Parse JSON request body, with sane stacktrace
JavaScript
5
star
12

opencl-buddhabrot

C
4
star
13

node-drawille-spark

JavaScript
4
star
14

node-tinder-analytics

JavaScript
3
star
15

node-ts-openapi-dsl

TypeScript
3
star
16

aoc-21-clj

Clojure
3
star
17

arukereso-laptop-search

JavaScript
3
star
18

co-lock

JavaScript
3
star
19

cv

HTML
2
star
20

haskell-sudoku

Haskell
2
star
21

aoc-2018-clj

Clojure
2
star
22

spline-playground

JavaScript
2
star
23

danyi.me

JavaScript
1
star
24

clj-euler

Clojure
1
star
25

lena-fft

C++
1
star
26

rmc-demo

Created for toolchain: https://cloud.ibm.com/devops/toolchains/bba09526-84e5-488a-acac-55831f93f3ba?env_id=ibm%3Ayp%3Aus-south
Shell
1
star
27

node-subset-sum

Polynomial approximation of the subset-sum problem
JavaScript
1
star
28

node-ngram

create ngram tokens from a string
JavaScript
1
star
29

nodebp-spacegame

JavaScript
1
star
30

counter_react

first react code
JavaScript
1
star
31

cr-spline-editor

JavaScript
1
star
32

newman-coverage-example

TypeScript
1
star
33

node-gossip

I'm just playing with es6, go away :-)
JavaScript
1
star
34

rtx3080

JavaScript
1
star
35

pyettier

NextGen™ formatter
1
star
36

resmon

Simple parser/wrapper for `sar(1)`
JavaScript
1
star
37

advent-of-code-2015-clj

Clojure
1
star
38

koa-continuation-local-storage

JavaScript
1
star
39

sudoku

C++
1
star
40

advent-of-code-2020

Clojure
1
star
41

random-webgl-art

JavaScript
1
star
42

bsc-thesis

TeX
1
star
43

volman

JavaScript
1
star
44

projective-transformation

JavaScript
1
star
45

gha-test

1
star
46

node-jadeite

Jade-like template library
JavaScript
1
star
47

node-i3-protocol

encode&decode i3 ipc messages
JavaScript
1
star
48

docker-iojs

1
star
49

node-i3-client

Control i3 from `node`!
1
star
50

madbence

1
star
51

node-mail-relay

JavaScript
1
star
52

fearlesscode_szoftlab

Java
1
star
53

react-onlab-preso

JavaScript
1
star