Input type | Output type |
float | color |
The gradient function returns colors from the gradient of the layer in which the formula is used. It returns the color at the specified index value.
The settings on the Inside and Outside tabs of the Layer Properties tool window are used to transform the index value before looking it up in the gradient. If they're set to the default values (Color Density: 1; Transfer Function: Linear; Gradient Offset: 0), then the gradient is mapped to the range 0..1 of the index value.
By changing the coloring settings, the user can adjust the mapping as desired. So, the gradient function interprets the argument exactly in the same way as Ultra Fractal interprets the #index value returned by a normal coloring algorithm.
You can use the gradient function inside classes. If the class is used from an inside coloring algorithm, the settings on the Inside tab are used. Otherwise, the settings from the Outside tab are used.
Examples:
; Put the first color from the gradient in c. color c = gradient(0) ; Acts as a normal coloring algorithm. #color = gradient(myIndex)
See Also
Writing direct coloring
algorithms
Coloring settings
Gradients