# js-drawer

> Javascript drawer

Latest version **1.0.3** (published 2020-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install js-drawer
pnpm add js-drawer
yarn add js-drawer
bun add js-drawer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-02-27 |
| First published | 2020-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 35.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | renhongl |
| Maintainers | renhongl |
| Keywords | javascript, drawer, canvas, painter |

## Links

- npm: https://www.npmjs.com/package/js-drawer
- Homepage: https://github.com/renhongl/js-drawer
- npm.io page: https://npm.io/package/js-drawer

## Dependencies (1)

- [@babel/polyfill](https://npm.io/package/@babel/polyfill.md) ^7.8.3

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-02-27
- 1.0.2 — 2020-02-27
- 1.0.1 — 2020-02-24
- 1.0.0 — 2020-02-24

## README

# js-drawer

Javascript drawer tool, use to draw something and animate it.

If you like it, **[STAR](https://github.com/renhongl/js-drawer)** it please :)

Online demo: [Demo](https://renhongl.github.io/source/drawer/)

Source code: [Code](https://github.com/renhongl/js-drawer)

<!--more-->

## Installation

* `npm install --save js-drawer`

## Example Code

```js
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

Name|Type|Desc|Default|Required
---|---|---|---|---
container|DOM Object|DOM element|body|false
width|Number|Canvas width|400|false
height|Number|Canvas height|400|false
size|Number|Stroke size|1|false
color|String|Stroke color|#000000|false
speed|Number|Animation speed|20|false
loop|Number|Animation next loop waiting time|3000|false


## Drawer API

Name|Type|Desc|Parameter|Param Example
---|---|---|---|---|---|
setColor|Function|Set stroke color before draw next line|color[String]|#fff
setSize|Function|Set stroke size before draw next line|size[Number]|20
setState|Function|Set stroke state before draw next line|state[String]|pen / pencil / rect
animate|Function|Make animation use exsiting graph||



## License

MIT

---
_Source: https://npm.io/package/js-drawer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
