Difference between revisions of "Category:LSL Alpha"
Lady Sumoku (talk | contribs) m (Replaced old <LSL> block with <source lang="lsl2">) |
m (Replaced <source> with <syntaxhighlight>) |
||
(One intermediate revision by one other user not shown) | |||
Line 4: | Line 4: | ||
==Build Mode== | ==Build Mode== | ||
In Build Mode, the alpha is represented by a percentage, ranging from '''0%''' to '''100%'''. Take extra care when moving viewer transparency settings to scripts and back. In the editor a higher number is more transparent, while in scripts a higher number is | In Build Mode, the alpha is represented by a percentage, ranging from '''0%''' to '''100%'''. Take extra care when moving viewer transparency settings to scripts and back. In the editor a higher number is more transparent, while in scripts a higher number is less transparent. | ||
==Examples== | ==Examples== | ||
Line 13: | Line 13: | ||
|- | |- | ||
| [[llSetAlpha]] | | [[llSetAlpha]] | ||
| < | | <syntaxhighlight lang="lsl2">llSetAlpha(1.0, ALL_SIDES);</syntaxhighlight> This will set the object's sides' alpha to opaque, or '''0%'''. | ||
|- | |- | ||
| [[llSetLinkAlpha]] | | [[llSetLinkAlpha]] | ||
| < | | <syntaxhighlight lang="lsl2">llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);</syntaxhighlight> | ||
This will set link-set's alpha to transparent, or '''100%'''. | This will set link-set's alpha to transparent, or '''100%'''. | ||
|- | |- | ||
| [[llSetPrimitiveParams]] | | [[llSetPrimitiveParams]] | ||
| < | | <syntaxhighlight lang="lsl2">llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, llGetColor(ALL_SIDES), 0.5]); | ||
// Using llGetColor this way may not give the desired result (it returns the average color)</ | // Using llGetColor this way may not give the desired result (it returns the average color)</syntaxhighlight> | ||
This will set the object's alpha to translucent, or '''50%'''. | This will set the object's alpha to translucent, or '''50%'''. | ||
|- | |- | ||
| [[llSetLinkPrimitiveParams]] | | [[llSetLinkPrimitiveParams]] | ||
| < | | <syntaxhighlight lang="lsl2">llSetLinkPrimitiveParams(LINK_SET, [PRIM_COLOR, ALL_SIDES, llGetColor(ALL_SIDES), 0.5]); | ||
// Using llGetColor this way may not give the desired result (it returns the average color).</ | // Using llGetColor this way may not give the desired result (it returns the average color).</syntaxhighlight> | ||
This will set the link-set's alpha to translucent, or '''50%'''. | This will set the link-set's alpha to translucent, or '''50%'''. | ||
|- | |- | ||
| [[llSetLinkPrimitiveParamsFast]] | | [[llSetLinkPrimitiveParamsFast]] | ||
| < | | <syntaxhighlight lang="lsl2">llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR, ALL_SIDES, llGetColor(ALL_SIDES), 0.5]); | ||
// Using llGetColor this way may not give the desired result (it returns the average color).</ | // Using llGetColor this way may not give the desired result (it returns the average color).</syntaxhighlight> | ||
This will set the link-set's alpha to translucent, or '''50%'''. | This will set the link-set's alpha to translucent, or '''50%'''. | ||
|- | |- |
Latest revision as of 11:08, 17 April 2022
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
The term "Alpha" refers to how translucent an object (or, in this case, a prim) is. In Second Life, the alpha property is set by the scripting functions llSetAlpha, llSetLinkAlpha, llSetPrimitiveParams, and llSetLinkPrimitiveParams. These functions use a float value. When set to 0.0, the object/prim is fully transparent. When set to 1.0, the object is opaque. Sometimes, Residents refer to a transparent texture as alpha texture. This is a texture with an alpha map, not to be confused with this prim property. See llSetTexture and TEXTURE_TRANSPARENT instead.
Build Mode
In Build Mode, the alpha is represented by a percentage, ranging from 0% to 100%. Take extra care when moving viewer transparency settings to scripts and back. In the editor a higher number is more transparent, while in scripts a higher number is less transparent.
Examples
Below are examples on how one may set the alpha of an object.
Function | LSL Example & Description |
---|---|
llSetAlpha | llSetAlpha(1.0, ALL_SIDES);
|
llSetLinkAlpha | llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
This will set link-set's alpha to transparent, or 100%. |
llSetPrimitiveParams | llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, llGetColor(ALL_SIDES), 0.5]);
// Using llGetColor this way may not give the desired result (it returns the average color)
This will set the object's alpha to translucent, or 50%. |
llSetLinkPrimitiveParams | llSetLinkPrimitiveParams(LINK_SET, [PRIM_COLOR, ALL_SIDES, llGetColor(ALL_SIDES), 0.5]);
// Using llGetColor this way may not give the desired result (it returns the average color).
This will set the link-set's alpha to translucent, or 50%. |
llSetLinkPrimitiveParamsFast | llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR, ALL_SIDES, llGetColor(ALL_SIDES), 0.5]);
// Using llGetColor this way may not give the desired result (it returns the average color).
This will set the link-set's alpha to translucent, or 50%. |
Pages in category "LSL Alpha"
The following 25 pages are in this category, out of 25 total.