1.0.3 • Published 4 years ago

js-drawer v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

js-drawer

Javascript drawer tool, use to draw something and animate it.

If you like it, STAR it please :)

Online demo: Demo

Source code: Code

Installation

  • npm install --save js-drawer

Example Code

import Drawer from 'js-drawer';

const drawer = new Drawer({
    container: document.body,
    width: document.body.clientWidth,
    height: document.body.clientHeight,
    loop: 3000,
    size: 1,
    speed: 20,
    color: '#000000',
    toolBar: true,
});

drawer.setColor('red');
drawer.setSize('20');
drawer.setState('pencil');
setTimeout(() => {
    drawer.animate();
}, 5000);

Drawer configuration

NameTypeDescDefaultRequired
containerDOM ObjectDOM elementbodyfalse
widthNumberCanvas width400false
heightNumberCanvas height400false
sizeNumberStroke size1false
colorStringStroke color#000000false
speedNumberAnimation speed20false
loopNumberAnimation next loop waiting time3000false

Drawer API

NameTypeDescParameterParam Example
setColorFunctionSet stroke color before draw next linecolorString#fff
setSizeFunctionSet stroke size before draw next linesizeNumber20
setStateFunctionSet stroke state before draw next linestateStringpen / pencil / rect
animateFunctionMake animation use exsiting graph

License

MIT

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago