gradientValue
Revision as of 16:42, 8 January 2014 by Kireji Haiku (talk | contribs) (got rid of back-and-forth-conversion and added intra-wiki links)
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector GradientValue( vector startColor, vector endColor, float percentage );Returns a vector that is the color vector between startColor and endColor depending upon percentage.
| • vector | startColor | – | Gradient start color | |
| • vector | endColor | – | Gradient end color | |
| • float | percentage | – | Percentage from startColor to endColor in the range (0.0 <= percentage <= 100.0) |
Specification
<lsl> // Created by Ugleh Ulrik
vector GradientValue(vector startColor, vector endColor, float percentage) {
percentage /= 100.0;// percentage to decimal for further use
float red = startColor.x + percentage*(endColor.x - startColor.x); float green = startColor.y + percentage*(endColor.y - startColor.y); float blue = startColor.z + percentage*(endColor.z - startColor.z);
return <red, green, blue>;
} </lsl>
Examples
<lsl> //Created by Ugleh Ulrik
vector GradientValue(vector startColor, vector endColor, float percentage) {
percentage /= 100.0;// percentage to decimal for further use
float red = startColor.x + percentage*(endColor.x - startColor.x); float green = startColor.y + percentage*(endColor.y - startColor.y); float blue = startColor.z + percentage*(endColor.z - startColor.z);
return <red, green, blue>;
}
default {
state_entry()
{
vector maroon = <0.522, 0.078, 0.294>;
vector teal = <0.224, 0.800, 0.800>;
vector ColorBetween = GradientValue(maroon, teal, 50.0);
// ColorBetween = <0.373, 0.439, 0.547>
llSetColor(ColorBetween, ALL_SIDES); }
}
</lsl>See Also
Constants
| • | PRIM_COLOR | |||
| • | CHANGED_COLOR |
Functions
| • | llGetColor | |||
| • | llGetLinkPrimitiveParams | |||
| • | llSetColor | |||
| • | llSetLinkColor |
Articles
| • | Color and Scripting | |||
| • | Color |