GradientValue: Difference between revisions
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m shorten desc |
Kireji Haiku (talk | contribs) m added check against percentage range |
||
| Line 2: | Line 2: | ||
|func=GradientValue | |func=GradientValue | ||
|mode=user | |mode=user | ||
|p1_type=vector|p1_name= | |p1_type=vector|p1_name=start|p1_desc=Gradient start color | ||
|p2_type=vector|p2_name= | |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 | |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| | |return_type=vector|return_text=that is the color vector between {{LSLP|start}} and {{LSLP|end}} depending upon {{LSLP|percentage}}. | ||
|func_footnote | |func_footnote | ||
|caveats | |caveats | ||
| Line 12: | Line 12: | ||
// Created by Ugleh Ulrik | // Created by Ugleh Ulrik | ||
vector GradientValue(vector | vector GradientValue(vector start, vector end, float percentage) | ||
{ | { | ||
percentage /= 100.0;// | if (percentage < 0.0 || 100.0 < percentage) return; | ||
percentage /= 100.0;// convert to decimal for further use | |||
float red = | float red = start.x + percentage*(end.x - start.x); | ||
float green = | float green = start.y + percentage*(end.y - start.y); | ||
float blue = | float blue = start.z + percentage*(end.z - start.z); | ||
return <red, green, blue>; | return <red, green, blue>; | ||
| Line 25: | Line 26: | ||
|examples= | |examples= | ||
<lsl> | <lsl> | ||
vector GradientValue(vector start, vector end, float percentage) | |||
vector GradientValue(vector | |||
{ | { | ||
percentage /= 100.0; | if (percentage < 0.0 || 100.0 < percentage) return; | ||
percentage /= 100.0; | |||
float red = | float red = start.x + percentage*(end.x - start.x); | ||
float green = | float green = start.y + percentage*(end.y - start.y); | ||
float blue = | float blue = start.z + percentage*(end.z - start.z); | ||
return <red, green, blue>; | return <red, green, blue>; | ||
Revision as of 17:01, 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.
| • 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 |