You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently(p5.js/1.5.0), stroke() is being processed to specify 255 as the fourth argument.
p5.RendererGL.prototype.stroke=function(r,g,b,a){//@todo allow transparency in stroking currently doesn't have//any impact and causes problems with specularMaterialarguments[3]=255;varcolor=_main.default.prototype.color.apply(this._pInst,arguments);this.curStrokeColor=color._array;};
This seems to be a process that always sets the transparency of the line to 1, but it is a meaningless process. Because you can achieve line transparency like this:
(However, it seems that strokeJoin will be implemented, so it will look different in the next version.)
This is because if there are two or fewer arguments, the third and subsequent arguments are ignored.
Therefore, you can draw a transparent line even if you pass two arguments as follows.
I don't know why p5.js has to set the line opacity to 1 in webgl, and it's not something to discuss here, but if p5.js wants to achieve this, the resulting color object should set the alpha value with setAlpha().
Or it can be more easily realized if the 4th component is set to 1 when setting curStrokeColor.
However, it was decided that this specification will be abolished in the previous pull request(#5985). At that time, the code to set to 255 remained.
This is unnecessary processing. because it is ignored if there are less than 2 arguments. In the case of 3, the maximum value is automatically set if nothing is specified. For four, it goes without saying.
(To be more specific, there is no guarantee that 255 is the maximum alpha value.)
If the user doesn't explicitly specify alpha, the process for color has already been implemented, so I think this should be omitted.
The text was updated successfully, but these errors were encountered:
Topic
Currently(p5.js/1.5.0), stroke() is being processed to specify 255 as the fourth argument.
This seems to be a process that always sets the transparency of the line to 1, but it is a meaningless process. Because you can achieve line transparency like this:
(However, it seems that strokeJoin will be implemented, so it will look different in the next version.)
This is because if there are two or fewer arguments, the third and subsequent arguments are ignored.
Therefore, you can draw a transparent line even if you pass two arguments as follows.
I don't know why p5.js has to set the line opacity to 1 in webgl, and it's not something to discuss here, but if p5.js wants to achieve this, the resulting color object should set the alpha value with setAlpha().
Or it can be more easily realized if the 4th component is set to 1 when setting curStrokeColor.
However, it was decided that this specification will be abolished in the previous pull request(#5985). At that time, the code to set to 255 remained.
This is unnecessary processing. because it is ignored if there are less than 2 arguments. In the case of 3, the maximum value is automatically set if nothing is specified. For four, it goes without saying.
(To be more specific, there is no guarantee that 255 is the maximum alpha value.)
If the user doesn't explicitly specify alpha, the process for color has already been implemented, so I think this should be omitted.
The text was updated successfully, but these errors were encountered: