I have a circle being rendered in fabric.js version 1.6.0-rc.1:
var circlePatrol = new fabric.Circle({
top: 300,
left: 180,
radius: 200,
strokeDashArray: [10, 10],
stroke: 'black',
strokeWidth: 10,
fill: 'white',
opacity: 0.2
});
I want to set the background as transparent but retain the stroke around the circle. Is this possible in fabric.js? The opacity is also being applied to the stroke/border, I am trying to apply it to the background of the circle only.
I have tried this as well with a transparent background, still no luck:
var circlePatrol = new fabric.Circle({
top: 300,
left: 180,
radius: 200,
strokeDashArray: [10, 10],
stroke: 'black',
strokeWidth: 10,
backgroundColor: 'transparent',
});
You can set fill: 'rgba(0,0,0,0)'
.
var circlePatrol = new fabric.Circle({
top: 0,
left: 0,
radius: 200,
strokeDashArray: [10, 10],
stroke: 'black',
strokeWidth: 10,
fill: 'rgba(0,0,0,0)'
});
JSFiddle
Another option is to use 'transparent' value in fill
const rect = new fabric.Rect({
top: 10,
left: 10,
width: 50,
height: 50,
hasBorder: true,
stroke: 'yellow',
strokeWidth: 3,
fill:'transparent'
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With