This is refactored and enhanced version of code taken from this post: http://stackoverflow.com/a/10661872/2248909
bower install canvas-realistic-pen --save
- mrdob.com
- Alex http://stackoverflow.com/users/873836/alex
- Alexey Pedyashev
- penColor - Color of the pen. Allowed formats: Array - [0, 0, 0], Hex - #ccc, #cfc4c1, rgb(1, 2, 3), rgba(1, 2, 3, 0)
- brushSize: - widht of line
- destroy() - destroys the pen
- setPenColor(inColor) - sets penColor
- setBrushSize(inBrushSize) - sets brushSize
var canvas = document.getElementById('draw-canvas');
brush = new RealisticPen(canvas, {
penColor: [217, 101, 110],
brushSize: 3
});
brush.setPenColor('#cfa');
brush.setBrushSize(5);
- Fixed aliasing problem
- Removed following API methods:
- setBrushesCount()
- brushPressure()
- Removed config options:
- brushesCount
- brushPressure
Added canvas resizing on window resize
First release