Difference between revisions of "GradientValue"

From Second Life Wiki
Jump to navigation Jump to search
m (better check)
m (condesed)
Line 26: Line 26:
     percentage /= 100.0;// convert to decimal for further use
     percentage /= 100.0;// convert to decimal for further use


     float red  = start.x + percentage*(end.x - start.x);
     return start + percentage*(end - start);
    float green = start.y + percentage*(end.y - start.y);
    float blue  = start.z + percentage*(end.z - start.z);
 
    return <red, green, blue>;
}
}
</lsl>
</lsl>
Line 47: Line 43:
     }
     }


     percentage /= 100.0;// convert to decimal for further use
     percentage /= 100.0;
 
    float red  = start.x + percentage*(end.x - start.x);
    float green = start.y + percentage*(end.y - start.y);
    float blue  = start.z + percentage*(end.z - start.z);


     return <red, green, blue>;
     return start + percentage*(end - start);
}
}



Revision as of 16:36, 8 January 2014

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 the vector between can be calculated, 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) {

   list colorParams = [start.x, start.y, start.z, end.x, end.y, end.z];
   if (percentage < 0.0

Examples

<lsl> vector GradientValue(vector start, vector end, float percentage) {

   list colorParams = [start.x, start.y, start.z, end.x, end.y, end.z];
if (percentage < 0.0

See Also

Constants

•  PRIM_COLOR
•  CHANGED_COLOR

Functions

•  llGetColor
•  llGetLinkPrimitiveParams
•  llSetColor
•  llSetLinkColor

Articles

•  Color and Scripting
•  Color