https://github.com/component/sketch
Turn a canvas into a sketch pad
https://github.com/component/sketch
Last synced: 7 months ago
JSON representation
Turn a canvas into a sketch pad
- Host: GitHub
- URL: https://github.com/component/sketch
- Owner: component
- Created: 2012-08-31T16:13:22.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-10-09T23:39:17.000Z (almost 12 years ago)
- Last Synced: 2024-05-08T17:06:45.373Z (about 1 year ago)
- Language: JavaScript
- Size: 149 KB
- Stars: 10
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# Sketch
Turn a canvas into a sketch pad.

## Installation
```
$ component install component/sketch
```
## API### sketch(canvas)
Turn the given `canvas` into a sketch pad.
```js
var sketch = require('sketch');
sketch(canvas);
```### Sketch#add(object)
Add drawable `object` that _must_ provide a `.draw(ctx)` method.
### Sketch#size(n)
Set pen size.
### Sketch#color(string)
Set pen color.
### Sketch#opacity(n)
Set pen opacity.
### Sketch#clear()
Clear the objects and re-draw.
### Sketch#reset()
Reset the sketch defaults and clear the canvas.
## License
MIT