Gradient

Inherits: Resource < Reference < Object A color interpolator resource which can be used to generate colors between user-defined color points.

Description

Given a set of colors, this resource will interpolate them in order. This means that if you have color 1, color 2 and color 3, the ramp will interpolate from color 1 to color 2 and from color 2 to color 3. The ramp will initially have 2 colors (black and white), one (black) at ramp lower offset 0 and the other (white) at the ramp higher offset 1.

Properties

Methods

Enumerations

InterpolationMode:

  • GRADIENT_INTERPOLATE_LINEAR = 0 —- Linear interpolation.
  • GRADIENT_INTERPOLATE_CONSTANT = 1 —- Constant interpolation, color changes abruptly at each point and stays uniform between. This might cause visible aliasing when used for a gradient texture in some cases.
  • GRADIENT_INTERPOLATE_CUBIC = 2 —- Cubic interpolation.

    Property Descriptions

  • PoolColorArray colors PoolColorArray.

  • InterpolationMode interpolation_mode InterpolationMode for available modes.

  • PoolRealArray offsets PoolRealArray.

    Method Descriptions

  • add_point ( float offset, Color color ) Adds the specified color to the end of the ramp, with the specified offset.

  • Color get_color ( int point ) point.

  • float get_offset ( int point ) point.

  • int get_point_count ( ) const Returns the number of colors in the ramp.

  • Color interpolate ( float offset ) offset.

  • remove_point ( int point ) point.

  • set_color ( int point, Color color ) point.

  • set_offset ( int point, float offset ) point.