Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
83
rated 0 times [  84] [ 1]  / answers: 1 / hits: 21737  / 9 Years ago, wed, november 18, 2015, 12:00:00

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',
});

More From » fabricjs

 Answers
35

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


[#64356] Monday, November 16, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rayvenc

Total Points: 666
Total Questions: 125
Total Answers: 99

Location: Northern Ireland
Member since Mon, Nov 14, 2022
2 Years ago
;