Mesh:setColor: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "<source" to "<syntaxhighlight"
Line 5: Line 5:
=== Description ===
=== Description ===
Sets a color in the color array. Indices start from 1. If the color array is not large enough, it is automatically expanded.
Sets a color in the color array. Indices start from 1. If the color array is not large enough, it is automatically expanded.
<source lang="lua">
<syntaxhighlight lang="lua">
Mesh:setColor(i,color,alpha)
Mesh:setColor(i,color,alpha)
</source>
</source>
Line 15: Line 15:


=== Example ===
=== Example ===
<source lang="lua">
<syntaxhighlight lang="lua">
-- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0)
-- 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

Revision as of 13:28, 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. <syntaxhighlight lang="lua"> Mesh:setColor(i,color,alpha) </source>

Parameters

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

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(2, 0x00ff00, 0.7) -- green with 0.7 alpha mesh:setColor(3, 0x0000ff) -- blue with 1.0 alpha </source>