Difference between revisions of "Legacy:BlendColors"
From Spherical
(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| | + | {{Usage|returns=[[API:Color|Color]]|func=BlendColors|params=c1, c2}} |
− | * ''' | + | * '''c1''' [[API:Color|Color]]. a [[API:Color|Color]] object created with [[API:CreateColor|CreateColor]] |
− | * ''' | + | * '''c2''' [[API:Color|Color]]. a [[API:Color|Color]] object created with [[API:CreateColor|CreateColor]] |
− | |||
==Examples== | ==Examples== | ||
− | ( | + | <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== | ||
− | ( | + | 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== | ||
− | * | + | * Sphere [[API:Color|Color]] object |
− | * | + | * [[API:CreateColor|CreateColor]]() |
− | * | + | * [[API:ApplyColorMask|ApplyColorMask]]() |
− | * | + | * [[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)
Contents
Usage
Color BlendColors(c1, c2);
- c1 Color. a Color object created with CreateColor
- c2 Color. a Color object created with CreateColor
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
- Sphere Color object
- CreateColor()
- ApplyColorMask()
- BlendColorsWeighted()