DgsSetAlpha: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (DGS OOP Syntax changing)
Line 16: Line 16:
===Required Arguments===  
===Required Arguments===  
*'''guiElement:''' the DGS element whose visibility is to be changed
*'''guiElement:''' the DGS element whose visibility is to be changed
*'''alpha:''' The visibility/transparency of the DGS element. Ranges from 0 (fully transparent) to 1 (fully opaque). Default value is 0.80.
*'''alpha:''' The visibility/transparency of the DGS element. Ranges from 0 (fully transparent) to 1 (fully opaque). Default value is 1.


===Returns===
===Returns===

Revision as of 17:11, 16 June 2021

This changes the alpha level (the visibleness/transparency) of a DGS element

Syntax

bool dgsSetAlpha ( element guielement, float alpha )

DGS OOP Syntax Help! I don't understand this!

Note: DGSElement:setAlpha
Variable: .alpha
Counterpart: dgsGetAlpha

Required Arguments

  • guiElement: the DGS element whose visibility is to be changed
  • alpha: The visibility/transparency of the DGS element. Ranges from 0 (fully transparent) to 1 (fully opaque). Default value is 1.

Returns

Returns true if the dgs element's alpha was successfully changed, false otherwise.

Example

This creates a DGS window and allows a player to change it's alpha (the visibleness/transparency) value with a command.

DGS = exports.dgs
myWindow = DGS:dgsCreateWindow ( 0.30, 0.10, 0.5, 0.60, "DGS window title", true )

--Add a command handler to change the alpha of the DGS window.
--Usage example: '/alpha 0.8', where 0.8 is stored as alphaAmount
function changeAlpha ( commandName, alphaAmount )
	alphaAmount = tonumber(alphaAmount)
	DGS:dgsSetAlpha ( myWindow, alphaAmount )
end
addCommandHandler ( "alpha", changeAlpha )

See Also

General Functions

General Events