Jump to content

Alpha on Widget?


Yue
 Share

Recommended Posts

Hello.

That's pretty easy to do, you just have to change the background color and pass a Vec4 for each channel (red, green, blue and alpha)

Here is a little example in Lua :

--A little example of panel creation with a transparent background
local panel=Widget:Panel(0,0,64,64,gui:GetBase())
panel:SetBool("border",true)
panel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,0.75)) --Vec4(r,g,b,a)

 

And here is the result :

Example in game (I've changed the code from the example code above to avoid conflict with my menu)

 

  • Like 2
  • Thanks 1

Just making games for fun. Currently working on T3-L4

Linka logo

Link to comment
Share on other sites

6 hours ago, Ttiki said:

Hello.

That's pretty easy to do, you just have to change the background color and pass a Vec4 for each channel (red, green, blue and alpha)

Here is a little example in Lua :


--A little example of panel creation with a transparent background
local panel=Widget:Panel(0,0,64,64,gui:GetBase())
panel:SetBool("border",true)
panel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,0.75)) --Vec4(r,g,b,a)

 

And here is the result :

Example in game (I've changed the code from the example code above to avoid conflict with my menu)

 

image.thumb.png.b9fca45e89f58e44582b4dc78641490b.png

 

Thank you very much, always something new to learn in this community. One question, the color of the text can still be changed that way, because what I have done is to modify directly the Button.lua, panel.lua etc..

 

 

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.

Guest
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.

 Share

×
×
  • Create New...