We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to dynamically affect a PShape's transparency without changing its color.
There are methods setFill(R,G,B,A) and then disableStyle() combined with fill(R,G,B,A) but they require me to also set the svg's color.
But what if the original .svg has several colors which need to be conserved? Using the aforementioned methods will simply set one color for the entire PShape, which is definitely undesirable.
Other issue: Setting the opacity of the PShape to 0 does not actually make the PShape transparent, it sets its color to the color of the background. Which means, if the background is white, then if the PShape is over an ellipse of a different color, instead of displaying simply the ellipse (because opacity of PShape is 0, so should be invisible) the sketch displays the parts of the PShape that overlap the ellipse in white color, which is also definitely undesirable.
The renderer I am using is P3D.
Do you know any solutions to the two problems described above?
Answers
You can render the PShape into a PGraphics, which allows you to use tint() to set the alpha channel.