Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
interactivesvg:gradientcolourrgb [2022/12/01 00:50] optrixinteractivesvg:gradientcolourrgb [2025/12/18 22:50] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====GradientColourRGB====
  
 +This function takes a value, and an array of value-colour combinations (usually created from [[GRADIENT_]]).
 +
 +It returns a colour that smoothly interpolates between the various values, allowing you to smoothly transition between colours as the value animates.
 +
 +===Example===
 +
 +<code>
 +var colourtouse = GradientColourRGB(myvalue,[[0, hexToRgbFloat("0000ff")],[0.4, hexToRgbFloat("00ff00")],[1, hexToRgbFloat("ff0000")]]);
 +</code>
 +
 +In the above example, a number between 0-1 named **myvalue** is converted into a colour.
 +
 +The colour will be red at 0, will fade to green at 0.4 and then fade to red at 1.
 +
 +The individual colours passed to GradientColourRGB are actually an array of three values in red-green-blue order - the //hexToRGBFloat// function takes care of the conversion of hex codes to arrays.