Jump to content

textureContext rgba color in fill style


Recommended Posts

Hello !  


I have a plane with a DynamicTexture and I tried to do something like 

textureContext.fillStyle = "rgba(255, 255, 255, 0.2)";

but it does'nt apply the alpha value of 0,2 .

Maybe I'm too much demanding but if there is a solution it would be cool !


Here are some visual examples :

textureContext.fillStyle = "rgba(255, 255, 255, 0.5)"; // or textureContext.fillStyle = "white";


textureContext.fillStyle = "rgba(255, 255, 255, 0.2)";



Link to comment
Share on other sites

In fact the problem is I want to have a square with alpha = 0,5 for example and the text below totally opaque...

If I have both in the same textureContext and I put it in the opaciyTexture channel of the plane, it does the same like before :/

Maybe I have to put square and text in separated textures ?

 - square in opacityTexture

 - text in diffuseTexture   

I'll try it 

Link to comment
Share on other sites

It was my bad it works great now ! I've certainly put 0,5 instead of 0.5 or another noob fail...

Here is the code which works if somebody need it : 

var textureContext = texture.getContext();// Draws background of the pictogram on the texturetextureContext.fillStyle = "rgba(255, 255, 255, 0.5)";RANDO.Utils.roundRect(textureContext, 0, 0, picto_size.width, picto_size.height, 45);....textureContext.restore();texture.update();panel.material.opacityTexture   = texture;panel.material.emissiveTexture  = texture;

Thank you very much =)

Link to comment
Share on other sites

And if I want to add a pictogram.png on it ?


- I tried to put the pictogram in the opacityTexture channel of material 


--> it appears in more transparent 


- I tried to put it in the diffuseTexture channel of the material


 --> it changes all in black ?? 


- I finally put it in a child panel that I offseted of 100 on Y axis. 


--> it works but I find it not so clean in terms of code :/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...