Reputation:
Using the fabric.js
library, I can set line width and color as follows:
canvas.freeDrawingBrush.width = 5;
canvas.freeDrawingBrush.color = "#f00";
Is there a way to set the opacity too? Couldn't find anything in the documentation, neither on the net anywhere.
Upvotes: 3
Views: 2241
Reputation: 2945
Instead of using a hexadecimal color code, you can set color
to use rgba
, like below:
canvas.freeDrawingBrush.color = 'rgba(255, 0, 0, 0.1)';
Upvotes: 5