A UIControl which can be used for containing and laying out other UI controls. Inherits from UIControl.
|Property Name||Return Type||Description||Tags|
| || ||If ||Read-Write|
| || ||Controls the opacity of the panel's contents by multiplying the alpha component of descendants' colors. Note that other UIPanels and UIContainers in the hierarchy may also contribute their own opacity values. A resulting alpha value of 1 or greater is fully opaque, 0 is fully transparent.||Read-Write|
This example shows how to fade in/out a UI Panel based on calls to
local UI_PANEL = script:GetCustomProperty("UIPanel"):WaitForObject() local LERP_SPEED = 14 local isShowing = false UI_PANEL.opacity = 0 function Show() isShowing = true end function Hide() isShowing = false end function Tick(deltaTime) -- Select desired opacity based on state targetOpacity = 0 if isShowing then targetOpacity = 1 end -- Keep the time delta between 0 and 1 local t = CoreMath.Clamp(deltaTime * LERP_SPEED) -- Interpolate the opacity value towards the desired value UI_PANEL.opacity = CoreMath.Lerp(UI_PANEL.opacity, targetOpacity, t) end
Last update: June 5, 2022