Difference between revisions of "Legacy:BlendColors"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20110803103656/http://www.spheredev.org/wiki/BlendColors)
 
(filled)
 
Line 1: Line 1:
 
+
Returns a new [[API:Color|Color]] object that is the blended color of the two input colors. ('''c1''' and '''c2''')
 
 
Returns a new [[API:Color|Color]] object that is the blended color of the two input colors. (c1 and c2)
 
  
 
__TOC__
 
__TOC__
  
 
==Usage==
 
==Usage==
{{Usage|returns=Color|object={{{object}}}|func=BlendColors|params=c1, c2}}
+
{{Usage|returns=[[API:Color|Color]]|func=BlendColors|params=c1, c2}}
  
* '''param1''' type. param1 description
+
* '''c1''' [[API:Color|Color]]. a [[API:Color|Color]] object created with [[API:CreateColor|CreateColor]]
* '''param2''' type. param2 description
+
* '''c2''' [[API:Color|Color]]. a [[API:Color|Color]] object created with [[API:CreateColor|CreateColor]]
* '''paramN''' type. paramN description
 
  
 
==Examples==
 
==Examples==
(examples with syntaxhighlighted code)
+
<syntaxhighlight>
 +
var Red = CreateColor(255, 0, 0); //Creates a red color.
 +
 
 +
var Blue = CreateColor(0, 255, 0); //Creates a blue color.
 +
 
 +
var Purple = BlendColors(Red, Blue); //Creates a purple color by blending the red and blue colors.
 +
</syntaxhighlight>
  
 
==Notes==
 
==Notes==
(notes)
+
This command is useful for translucency effects, but Sphere supports alpha mapping natively, so it's usually not necessary. ( If you want to tint the whole screen use the [[API:ApplyColorMask|ApplyColorMask]] command. ) It's not efficient to call this command very often, so whenever possible, just create the blended color in the first place.
  
 
==See also==
 
==See also==
* see also
+
* Sphere [[API:Color|Color]] object
* see also
+
* [[API:CreateColor|CreateColor]]()
* see also
+
* [[API:ApplyColorMask|ApplyColorMask]]()
* etc
+
* [[API:BlendColorsWeighted|BlendColorsWeighted]]()
 +
 
  
 
{{API:Color/navbox}}
 
{{API:Color/navbox}}

Latest revision as of 04:50, 4 June 2013

Returns a new Color object that is the blended color of the two input colors. (c1 and c2)

Usage

Color BlendColors(c1, c2);


Examples

var Red = CreateColor(255, 0, 0); //Creates a red color.

var Blue = CreateColor(0, 255, 0); //Creates a blue color.

var Purple = BlendColors(Red, Blue); //Creates a purple color by blending the red and blue colors.

Notes

This command is useful for translucency effects, but Sphere supports alpha mapping natively, so it's usually not necessary. ( If you want to tint the whole screen use the ApplyColorMask command. ) It's not efficient to call this command very often, so whenever possible, just create the blended color in the first place.

See also


API:Color/navbox