Atrament
A small JS library for beautiful drawing and handwriting on the HTML Canvas
Atrament is a library that enables the user to draw smooth, natural drawings and handwriting on the HTML canvas.
The algorithm was originally developed about 2 weeks after I started learning JavaScript, as I wanted to build a
collaborative drawing space on the web, which ended up being
1WALL. I wanted the drawing to
feel natural and comfortable, and the result to be smooth and pleasing. Years later, I've taken the algorithm,
improved it, rewrote it in ES6 and made it into a neat little library.
FEATURES:
- Draw/Fill/Erase modes
- Adjustable adaptive smoothing
- Events tracking the drawing - this allows the app to "replay" or reconstruct the drawing, e.g. for undo functionality
- Adjustable line thickness and colour
Enjoy!
Installation
as a module
If you're using a tool like webpack or browserify to bundle your code, you can install it using npm.
- install atrament as a dependency using npm install --save atrament.
- You can access the Atrament class using import { Atrament } from 'atrament';
script tag
Include the script located at [dist/atrament.min.js](https://github.com/jakubfiala/atrament.js/raw/master/dist/atrament.min.js) in the `` tag of your HTML.
Alternatively, you can use Bower: bower install atrament and include bower_components/atrament/dist/atrament.min.js as a script tag.
polymer
Usage
- create a `