Difference between revisions of "Mesh:setColor"

From GiderosMobile
Line 2: Line 2:
 
'''Available since:''' Gideros 2012.09<br/>
 
'''Available since:''' Gideros 2012.09<br/>
 
=== Description ===
 
=== Description ===
<br />
+
<translate><br />
 
Sets a color at color array. Indices are start from 1. If the color array is not large enough, it&#039;s expanded automatically.<br />
 
Sets a color at color array. Indices are start from 1. If the color array is not large enough, it&#039;s expanded automatically.<br />
<br />
+
<br /></translate>
 
<source lang="lua">
 
<source lang="lua">
 
  Mesh:setColor(i,color,alpha)
 
  Mesh:setColor(i,color,alpha)
 
</source>
 
</source>
 
=== Parameters ===
 
=== Parameters ===
'''i''': (number) index <br/>
+
'''i''': (number) <translate>index</translate> <br/>
'''color''': (number) color in hexedecial value <br/>
+
'''color''': (number) <translate>color in hexedecial value</translate> <br/>
'''alpha''': (number, default=1.0) alpha value <br/>
+
'''alpha''': (number, default=1.0) <translate>alpha value</translate> <br/>
 
=== Examples ===
 
=== Examples ===
 
'''Example'''<br/>
 
'''Example'''<br/>
<source lang="lua">-- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0).<br />
+
<source lang="lua">-- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0).
mesh:setColor(1, 0xff0000, 0.5)  -- red with 0.5 alpha<br />
+
mesh:setColor(1, 0xff0000, 0.5)  -- red with 0.5 alpha
mesh:setColor(2, 0x00ff00, 0.7)  -- green with 0.7 alpha<br />
+
mesh:setColor(2, 0x00ff00, 0.7)  -- green with 0.7 alpha
mesh:setColor(3, 0x0000ff)      -- blue with 1.0 alpha<br /></source>
+
mesh:setColor(3, 0x0000ff)      -- blue with 1.0 alpha</source>

Revision as of 14:33, 23 August 2018

Available since: Gideros 2012.09

Description


Sets a color at color array. Indices are start from 1. If the color array is not large enough, it's expanded automatically.

 Mesh:setColor(i,color,alpha)

Parameters

i: (number) index
color: (number) color in hexedecial value
alpha: (number, default=1.0) alpha value

Examples

Example

-- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0).
mesh:setColor(1, 0xff0000, 0.5)  -- red with 0.5 alpha
mesh:setColor(2, 0x00ff00, 0.7)  -- green with 0.7 alpha
mesh:setColor(3, 0x0000ff)       -- blue with 1.0 alpha