Polylines transparency issue

Started by Jakes, January 31, 2020, 10:17:47 AM

Previous topic - Next topic

Jakes

Hello, I've been working around with Polylines and it seems that the method Polyline.setPercentage(float) is not working properly or might be something I am missing. For any value other than 1 the line turns fully invisible.

Is this an issue?

EgonOlsen

#1
I don't think so. setPercentage(<float>) isn't about transparency, it's about how much (in terms of length) is visible of the polyline. But because it can't cut a line segment in half, it can only make full segments visible or invisible. That means that a Polyline that consists of a single line segment, will only be visible at 100%.

For transparency, there's actually the setTransparencyMode() method to enable it and the color attribute of a Polyline to set the desired value.

EgonOlsen

#2
Like so:


Polyline pl=new Polyline(line, new Color(255,255,255,100));
pl.setWidth(10);
pl.setTransparencyMode(Object3D.TRANSPARENCY_MODE_DEFAULT);

Jakes

#3
Ah ok, so it uses the alpha channel of the color for the transparency. Thanks