Difference between revisions of "GradientValue"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m (added check against percentage range) |
Kireji Haiku (talk | contribs) m (fixed check) |
||
Line 5: | Line 5: | ||
|p2_type=vector|p2_name=end|p2_desc=Gradient end color | |p2_type=vector|p2_name=end|p2_desc=Gradient end color | ||
|p3_type=float|p3_name=percentage|p3_desc=Percentage in the range (0.0 to 100.0) from start to end | |p3_type=float|p3_name=percentage|p3_desc=Percentage in the range (0.0 to 100.0) from start to end | ||
|return_type=vector|return_text=that is the color vector between {{LSLP|start}} and {{LSLP|end}} depending upon {{LSLP|percentage}}. | |return_type=vector|return_text=that is the color vector between {{LSLP|start}} and {{LSLP|end}} depending upon {{LSLP|percentage}} if percentage is in range, else returns <code>{{LSL VR|-1|-1|-1}}</code>. | ||
|func_footnote | |func_footnote | ||
|caveats | |caveats | ||
Line 14: | Line 14: | ||
vector GradientValue(vector start, vector end, float percentage) | vector GradientValue(vector start, vector end, float percentage) | ||
{ | { | ||
if (percentage < 0.0 || 100.0 < percentage) return; | if (percentage < 0.0 || 100.0 < percentage) return <-1, -1, -1>; | ||
percentage /= 100.0;// convert to decimal for further use | percentage /= 100.0;// convert to decimal for further use | ||
Line 28: | Line 28: | ||
vector GradientValue(vector start, vector end, float percentage) | vector GradientValue(vector start, vector end, float percentage) | ||
{ | { | ||
if (percentage < 0.0 || 100.0 < percentage) | if (percentage < 0.0 || 100.0 < percentage) <-1, -1, -1>; | ||
percentage /= 100.0; | percentage /= 100.0; | ||
Line 48: | Line 48: | ||
// ColorBetween = <0.373, 0.439, 0.547> | // ColorBetween = <0.373, 0.439, 0.547> | ||
llSetColor(ColorBetween, ALL_SIDES); | if (ColorBetween != <-1, -1, -1>) | ||
llSetColor(ColorBetween, ALL_SIDES); | |||
} | } | ||
} | } |
Revision as of 16:08, 8 January 2014
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector GradientValue( vector start, vector end, float percentage );Returns a vector that is the color vector between start and end depending upon percentage if percentage is in range, else returns <-1, -1, -1>
.
• vector | start | – | Gradient start color | |
• vector | end | – | Gradient end color | |
• float | percentage | – | Percentage in the range (0.0 to 100.0) from start to end |
Specification
<lsl> // Created by Ugleh Ulrik
vector GradientValue(vector start, vector end, float percentage) {
if (percentage < 0.0
Examples
<lsl> vector GradientValue(vector start, vector end, float percentage) {
if (percentage < 0.0See Also
Constants
• | PRIM_COLOR | |||
• | CHANGED_COLOR |
Functions
• | llGetColor | |||
• | llGetLinkPrimitiveParams | |||
• | llSetColor | |||
• | llSetLinkColor |
Articles
• | Color and Scripting | |||
• | Color |