Author Topic: Polylines transparency issue  (Read 2391 times)

Offline Jakes

  • int
  • **
  • Posts: 63
    • View Profile
Polylines transparency issue
« on: January 31, 2020, 10:17:47 am »
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?
« Last Edit: January 31, 2020, 11:21:56 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Polylines transparency issue
« Reply #1 on: January 31, 2020, 10:38:46 am »
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.
« Last Edit: January 31, 2020, 11:22:06 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Polylines transparency issue
« Reply #2 on: January 31, 2020, 10:39:57 am »
Like so:

Code: [Select]
Polyline pl=new Polyline(line, new Color(255,255,255,100));
pl.setWidth(10);
pl.setTransparencyMode(Object3D.TRANSPARENCY_MODE_DEFAULT);
« Last Edit: January 31, 2020, 11:22:12 am by EgonOlsen »

Offline Jakes

  • int
  • **
  • Posts: 63
    • View Profile
Re: Polylines transparency issue
« Reply #3 on: January 31, 2020, 01:49:46 pm »
Ah ok, so it uses the alpha channel of the color for the transparency. Thanks
« Last Edit: January 31, 2020, 03:26:24 pm by Jakes »