Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tsand/responsive-sketchpad

A completely responsive, HTML5 canvas sketchpad for use on desktop and mobile browsers
https://github.com/tsand/responsive-sketchpad

canvas html5-canvas-sketchpad javascript mobile-sketchpad responsive

Last synced: 7 days ago
JSON representation

A completely responsive, HTML5 canvas sketchpad for use on desktop and mobile browsers

Awesome Lists containing this project

README

        

# Responsive-Sketchpad

[![npm version](https://img.shields.io/npm/v/responsive-sketchpad)](https://www.npmjs.com/package/responsive-sketchpad)
[![Build](https://github.com/tsand/responsive-sketchpad/workflows/Build/badge.svg)](https://github.com/tsand/responsive-sketchpad/actions)

A completely responsive, HTML5 canvas sketchpad for use on desktop and mobile browsers with no dependencies.

[Demo](https://tsand.github.io/responsive-sketchpad/)

### Installation

`npm install responsive-sketchpad`

> Follow [node-canvas](https://www.npmjs.com/package/canvas) setup instructions

### Example Usage

```html








```

```js
// script.js
var Sketchpad = require('responsive-sketchpad');

// Initialize Sketchpad
var el = document.getElementById('sketchpad');
var pad = new Sketchpad(el, {
line: {
color: '#f44335',
size: 5
}
});

// Set line color
pad.setLineColor('#f44336');

// Set line size
pad.setLineSize(10);

// Undo
pad.undo();

// Redo
pad.redo();

// Clear canvas
pad.clear();

// Resize canvas
pad.resize(100);

// Make read only
pad.setReadOnly(true);
```