Difference between revisions of "Mesh:setColor"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2012.09<br/>
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
+
'''Class:''' [[Mesh]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Mesh|Mesh]]<br/>
 
=== <translate>Description</translate> ===
 
<translate>
 
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 /></translate>
 
<source lang="lua">
 
Mesh:setColor(i,color,alpha)
 
</source>
 
<br />
 
  
=== <translate>Parameters</translate> ===
+
=== Description ===
'''i''': (number) <translate>index</translate> <br/>
+
Sets a color in the color array. Indices start from 1. If the color array is not large enough, it is automatically expanded.
'''color''': (number) <translate>color in hexedecial value</translate> <br/>
+
<syntaxhighlight lang="lua">
'''alpha''': (number, default=1.0) <translate>alpha value</translate> <br/>
+
Mesh:setColor(i,color,alpha)
<br />
+
</syntaxhighlight>
  
=== <translate>Examples</translate> ===
+
=== Parameters ===
'''Example'''<br/>
+
'''i''': (number) index<br/>
<source lang="lua">-- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0).
+
'''color''': (number) color in hexedecial value<br/>
 +
'''alpha''': (number, default=1.0) alpha value<br/>
 +
 
 +
=== Example ===
 +
<syntaxhighlight 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
 
mesh:setColor(1, 0xff0000, 0.5)  -- red with 0.5 alpha
 
mesh:setColor(2, 0x00ff00, 0.7)  -- green with 0.7 alpha
 
mesh:setColor(2, 0x00ff00, 0.7)  -- green with 0.7 alpha
mesh:setColor(3, 0x0000ff)      -- blue with 1.0 alpha</source>
+
mesh:setColor(3, 0x0000ff)      -- blue with 1.0 alpha
 +
</syntaxhighlight>
 +
 
 +
{{Mesh}}

Latest revision as of 14:30, 13 July 2023

Available since: Gideros 2012.09
Class: Mesh

Description

Sets a color in the color array. Indices start from 1. If the color array is not large enough, it is automatically expanded.

Mesh:setColor(i,color,alpha)

Parameters

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

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