WoW:API UIObject SetAlpha: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Reformat, expand.)
(Parent/child alpha relationship is not multiplicative)
Line 17: Line 17:
== Notes ==
== Notes ==


Transparency is applied to child objects the same as scaling. If a parent is set to e.g 0.5, and a child is set to 1, the child will still be shown as 0.5. If a parent and child both are set to 0.5, the result will be 0.5 * 0.5 = 0.25 for the child.
Transparency is '''not''' applied to child objects the same as scaling. The parent frame's alpha is inherited if and only if the child's alpha has not been set or has been set to 1. If the child frame's alpha has been set to anything other than 1, then that alpha value is absolute and is unaffected by the parent frame's alpha setting, meaning a parent frame can be "dimmer" than its child frames.
 
''Note'': it may have behaved multiplicatively like SetScale() in previous patches, and the current behavior (patch 2.06) may be a bug. This is unconfirmed.


If you attempt to set the same value more than once it will detect this and return early after the first attempt.
If you attempt to set the same value more than once it will detect this and return early after the first attempt.

Revision as of 19:48, 2 February 2007

Widget API ← UIObject < SetAlpha

Sets the alpha (transparency) of the given object.

MyObject:SetAlpha(alpha)

Arguments

Alpha
Number - a floating-point number between 0 and 1. 1 is fully opaque, 0 is transparent.

Example

MyFrame:SetAlpha(.75); 

Makes the frame translucent, more visible than not.

Notes

Transparency is not applied to child objects the same as scaling. The parent frame's alpha is inherited if and only if the child's alpha has not been set or has been set to 1. If the child frame's alpha has been set to anything other than 1, then that alpha value is absolute and is unaffected by the parent frame's alpha setting, meaning a parent frame can be "dimmer" than its child frames.

Note: it may have behaved multiplicatively like SetScale() in previous patches, and the current behavior (patch 2.06) may be a bug. This is unconfirmed.

If you attempt to set the same value more than once it will detect this and return early after the first attempt.