Difference between revisions of "Mesh:setColorArray"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Assigns a new content to the color array, dropping all the elements contained in the color array before the call and replacing them by those specified by the parameters. It accepts multiple values or a Lua array.
 
Assigns a new content to the color array, dropping all the elements contained in the color array before the call and replacing them by those specified by the parameters. It accepts multiple values or a Lua array.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
Mesh:setColorArray(colors)
 
Mesh:setColorArray(colors)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===
Line 13: Line 13:
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
-- sets the color array as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0)
 
-- sets the color array as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0)
 
mesh:setColorArray(0xff0000, 0.5, 0x00ff00, 0.7, 0x0000ff, 1.0)
 
mesh:setColorArray(0xff0000, 0.5, 0x00ff00, 0.7, 0x0000ff, 1.0)
Line 19: Line 19:
 
-- same as above but curly braces instead of parenthesis
 
-- same as above but curly braces instead of parenthesis
 
mesh:setColorArray{0xff0000, 0.5, 0x00ff00, 0.7, 0x0000ff, 1.0}
 
mesh:setColorArray{0xff0000, 0.5, 0x00ff00, 0.7, 0x0000ff, 1.0}
</source>
+
</syntaxhighlight>
  
 
{{Mesh}}
 
{{Mesh}}

Latest revision as of 14:30, 13 July 2023

Available since: Gideros 2012.09
Class: Mesh

Description

Assigns a new content to the color array, dropping all the elements contained in the color array before the call and replacing them by those specified by the parameters. It accepts multiple values or a Lua array.

Mesh:setColorArray(colors)

Parameters

colors: (any) color as hex format and alpha, or a table of colors and alphas

Example

-- sets the color array as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0)
mesh:setColorArray(0xff0000, 0.5, 0x00ff00, 0.7, 0x0000ff, 1.0)

-- same as above but curly braces instead of parenthesis
mesh:setColorArray{0xff0000, 0.5, 0x00ff00, 0.7, 0x0000ff, 1.0}