2.0.2 • Published 5 years ago
canvas-autograph v2.0.2
canvas-autograph
Install
npm install canvas-autographyarn add canvas-autographUsage
import Autograph from 'canvas-autograph';
new Autograph(options);API
options configuration
| Params | Desc | Types | Required | Default |
|---|---|---|---|---|
| el | specify the rendered dom element selector | string | yes | - |
| font | set the font of the canvas text | string | no | '14px Arial' |
| alpha | set the transparency of the canvas | number | no | 1 |
| imgType | set the type of generated image | string | no | 'png' |
| offsetX | set the x axis offset of the path | number | no | 0 |
| offsetY | set the y axis offset of the path | number | no | 0 |
| fillColor | set the fill color | string | no | '#fff' |
| lineWidth | set line width | number | no | 3 |
| strokeColor | set path color | string | no | '#000' |
instance method
| Function | Desc | Callback Parameter |
|---|---|---|
| onSaveUrl | save picture | (color) => Promise |
| onClear | clear canvas | () => void |
| destroy | destroy the instance | () => void |