1.1.6 • Published 7 years ago

sketchpad-mod v1.1.6

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

sketchpad-mod npm version

SketchpadMod this is a simple sketchpad project for drawing, saving and recovering picture easily. NPM

Installation

Use npm:

npm install sketchpad-mod --save

Usage

Having a canvas on the DOM:

<canvas id="sketchpad-mod"></canvas>

You should simply configure it by instantiating the SketchpadMod:

import SketchpadMod from 'sketchpad-mod';

const sketchpadMod = new SketchpadMod({
  element: '#sketchpad-mod',
  width: 400,
  height: 400
});

After that, the API provides a variety of functionalities:

// undo
sketchpadMod.undo();

// redo
sketchpadMod.redo();

// Change color
sketchpadMod.color = '#FF0000';

// Change stroke size
sketchpadMod.penSize = 10;

// Playback each sketchpad stroke (10 ms is the time between each line piece)
sketchpadMod.animate(10);

// Set size for size canvas (one size for width and height)
sketchpadMod.setCanvasSize(100);

// Set size for size canvas (one size for width and height)
sketchpadMod.readOnly = true;

// Recover sketchpad JSON or Object Settings
sketchpadMod.toJSON();
sketchpadMod.toObject();

// By recovering the sketchpad JSON or Object you can then clone the sketchpad by coding:
const settings = sketchpadMod.toObject();
settings.element = '#other-sketchpad-mod';
const otherSketchpadMod = new SketchpadMod(settings);
1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago