Noise:setColorLookup

From GiderosMobile
Revision as of 15:30, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")


Available since: Gideros 2020.5
Class: Noise

Description


Set a color table used by texture generator functions: Noise:getTexture and Noise:getTileTexture

<syntaxhighlight lang="lua"> Noise:setColorLookup(colors) </source>

Parameters

colors: (table) color table (see example for details)


Example <syntaxhighlight lang="lua"> require "FastNoise" -- color table is a table of tables, each containing up to 3 values... -- first value: height (number) must be in range [0..1]
-- second value: color (number) in hex format
-- third value: alpha (number, default = 1) must be in range [0..1] (optional)

local n = Noise.new() n:setColorLookup{ {0.3, 0x4b3c37}, {0.4, 0xffffff, 0.8}, {0.45, 0x5c443d}, {0.55, 0x3f6a14, 0.9}, {0.6, 0x589718}, {0.7, 0x3666c6}, {0.9, 0xd1d080}, {1, 0x3463c3}, }</source>