Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:WindowSetAlpha

From RoR Wiki

UI Lua API · Window functions
Version: WAR 1.4.8

Sets a window's alpha (opacity).

WindowSetAlpha(windowName, alpha)

Arguments

windowName
string – Name of the window.
alpha
number – New alpha, from 0 (invisible) to 1 (opaque).

Returns

Nothing.

Details

  • Values below 0 are stored as 0 and values above 1 as 1.
  • If the window already has this alpha, nothing happens.
  • The alpha the window is drawn with is its own alpha multiplied by the alpha of its parents. Child windows are updated, so fading a parent fades all of its children. The children keep their own alpha values; WindowGetAlpha on a child still returns the child's own value.
  • Only the window's alpha changes. Text alpha is a separate setting; see WindowSetFontAlpha.
  • A running alpha animation overwrites the value on its next frame. Stop it first with WindowStopAlphaAnimation.
  • The function needs at least two arguments and only reads the last two.

Errors

  • Error in function call 'WindowSetAlpha': Window %s does not exist

Example

Fading a tooltip, window and text together, from easystem_tooltips/source/tooltips.lua:

function Tooltips.SetTooltipAlpha( alpha )
    WindowSetAlpha( Tooltips.curTooltipWindow, alpha )
    WindowSetFontAlpha( Tooltips.curTooltipWindow, alpha )
end

See also