The .opacity() function does now work with any shapes currently. Does anyone have a code snippet that they have gotten to work with opacity or is this a problem with the code.
Do you have a code example that isn't working? I'm not sure I understand the problem.
doc.save()
.rect(0, 306, 612, 90)
.opacity(.2)
.fill("red");
Opacity never works. I debugged the lib and in the src code .fill somehow overrides opacity to 1 everytime.
Internally, when fill is called with a color it calls fillColor first, which assumes an opacity of 1.0 if none is given. If you write it like this, it should work:
doc.save()
.rect(0, 306, 612, 90)
.fillColor('red', 0.2)
.fill()
fillColor takes a color and an opacity. If you want to set both the fill and stroke opacity, set the fillColor first, then call opacity and finally fill.
Most helpful comment
Internally, when
fillis called with a color it callsfillColorfirst, which assumes an opacity of1.0if none is given. If you write it like this, it should work:fillColortakes a color and an opacity. If you want to set both the fill and stroke opacity, set thefillColorfirst, then callopacityand finallyfill.