Mesh:setColors: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
'''Available since:''' Gideros 2012.09<br/>
'''Available since:''' Gideros 2012.09<br/>
'''Class:''' [[Mesh]]<br/>
=== Description ===
=== Description ===
<br />
Sets zero or more colors to a mesh with a single function call.
Sets zero or more colors at color array with a single function call. It accepts multiple values or a Lua array.<br />
<syntaxhighlight lang="lua">
<br />
Mesh:setColors(colors)
<source lang="lua">
</syntaxhighlight>
Mesh:setColors(colors)
 
</source>
=== Parameters ===
=== Parameters ===
'''colors''': (any) <br/>
'''colors''': (any) multiple values or a Lua array<br/>
=== Examples ===
 
'''Example'''<br/>
=== Example ===
<source lang="lua">-- set 3 colors with seperate function calls<br />
'''Different setColor function calls'''
mesh:setColor(1, 0xff0000, 0.5)<br />
<syntaxhighlight lang="lua">
mesh:setColor(2, 0x00ff00, 0.7)<br />
-- sets 3 colors with seperate function calls
mesh:setColor(3, 0x0000ff)<br />
mesh:setColor(1, 0xff0000, 0.5)
<br />
mesh:setColor(2, 0x00ff00, 0.7)
-- set 3 colors with one function call<br />
mesh:setColor(3, 0x0000ff)
mesh:setColors(1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0)<br />
 
<br />
-- sets 3 colors with one function call
-- same as above<br />
mesh:setColors(1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0)
mesh:setColors{1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0}<br />
 
<br />
-- same as above
-- these two functions do nothing<br />
mesh:setColors{1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0}
mesh:setColors()<br />
 
mesh:setColors{}<br /></source>
-- these two functions do nothing
mesh:setColors()
mesh:setColors{}
</syntaxhighlight>
 
{{Mesh}}

Latest revision as of 13:30, 13 July 2023

Available since: Gideros 2012.09
Class: Mesh

Description

Sets zero or more colors to a mesh with a single function call.

Mesh:setColors(colors)

Parameters

colors: (any) multiple values or a Lua array

Example

Different setColor function calls

-- sets 3 colors with seperate function calls
mesh:setColor(1, 0xff0000, 0.5)
mesh:setColor(2, 0x00ff00, 0.7)
mesh:setColor(3, 0x0000ff)

-- sets 3 colors with one function call
mesh:setColors(1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0)

-- same as above
mesh:setColors{1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0}

-- these two functions do nothing
mesh:setColors()
mesh:setColors{}