image-mask
Dynamically add transparent mask to image.
Install
npm install image-mask --save
API
new ImageMask(source, pixels: bool)
- create new masked image (returns canvas element).source
: Img element, image object or canvas.pixels
: Use pixel coordinates instead of percentage. Default: false
.mask(array)
- apply mask..getImg(callback)
- returns img element.
Usage
Example usage:
;let maskImage = document;documentbody; maskImage; // 2 points = line// 4 points = quadratic curve// 6 points = bezier curve
Result will be:
.mask
also returns canvas, so you can append it like this:
element;
Result will be:
License
MIT