pixelated-canvas
TypeScript icon, indicating that this package has built-in type declarations

0.5.4 • Public • Published

Pixelated Canvas

A canvas that lets you draw in a pixelated, 8-bit style.

Example

Demo

See a live demo.

Quickstart

import Canvas from 'pixelated-canvas';
const canvas = new Canvas();
canvas.render(document.body);

API

The following props are supported:

  • width
  • height
  • xPixels
  • yPixels
const canvas = new Canvas({
  width: 500,
  height: 500,
  xPixels: 20,
  yPixels: 10,
});

pixelSize can also be set after instantiation with:

canvas.setPixelSize(20, 20);

The following callbacks are supported:

  • onMouseDown
  • onMouseUp
  • onMouseMove
canvas.onMouseDown((e) => {
});

canvas.onMouseUp((e) => {
});

canvas.onMouseMove((e) => {
});

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i pixelated-canvas

Weekly Downloads

0

Version

0.5.4

License

MIT

Unpacked Size

17.3 kB

Total Files

6

Last publish

Collaborators

  • thekevinscott