class_gradient.rst 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Gradient.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Gradient:
  6. Gradient
  7. ========
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. A color interpolator resource which can be used to generate colors between user-defined color points.
  13. Properties
  14. ----------
  15. +---------------------------------------------+-------------------------------------------------+------------------------------------------+
  16. | :ref:`PoolColorArray<class_PoolColorArray>` | :ref:`colors<class_Gradient_property_colors>` | PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 ) |
  17. +---------------------------------------------+-------------------------------------------------+------------------------------------------+
  18. | :ref:`PoolRealArray<class_PoolRealArray>` | :ref:`offsets<class_Gradient_property_offsets>` | PoolRealArray( 0, 1 ) |
  19. +---------------------------------------------+-------------------------------------------------+------------------------------------------+
  20. Methods
  21. -------
  22. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`add_point<class_Gradient_method_add_point>` **(** :ref:`float<class_float>` offset, :ref:`Color<class_Color>` color **)** |
  24. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Color<class_Color>` | :ref:`get_color<class_Gradient_method_get_color>` **(** :ref:`int<class_int>` point **)** const |
  26. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`float<class_float>` | :ref:`get_offset<class_Gradient_method_get_offset>` **(** :ref:`int<class_int>` point **)** const |
  28. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_point_count<class_Gradient_method_get_point_count>` **(** **)** const |
  30. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Color<class_Color>` | :ref:`interpolate<class_Gradient_method_interpolate>` **(** :ref:`float<class_float>` offset **)** |
  32. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`remove_point<class_Gradient_method_remove_point>` **(** :ref:`int<class_int>` offset **)** |
  34. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_color<class_Gradient_method_set_color>` **(** :ref:`int<class_int>` point, :ref:`Color<class_Color>` color **)** |
  36. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_offset<class_Gradient_method_set_offset>` **(** :ref:`int<class_int>` point, :ref:`float<class_float>` offset **)** |
  38. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  39. Description
  40. -----------
  41. 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.
  42. Property Descriptions
  43. ---------------------
  44. .. _class_Gradient_property_colors:
  45. - :ref:`PoolColorArray<class_PoolColorArray>` **colors**
  46. +-----------+------------------------------------------+
  47. | *Default* | PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 ) |
  48. +-----------+------------------------------------------+
  49. | *Setter* | set_colors(value) |
  50. +-----------+------------------------------------------+
  51. | *Getter* | get_colors() |
  52. +-----------+------------------------------------------+
  53. Gradient's colors returned as a :ref:`PoolColorArray<class_PoolColorArray>`.
  54. .. _class_Gradient_property_offsets:
  55. - :ref:`PoolRealArray<class_PoolRealArray>` **offsets**
  56. +-----------+-----------------------+
  57. | *Default* | PoolRealArray( 0, 1 ) |
  58. +-----------+-----------------------+
  59. | *Setter* | set_offsets(value) |
  60. +-----------+-----------------------+
  61. | *Getter* | get_offsets() |
  62. +-----------+-----------------------+
  63. Gradient's offsets returned as a :ref:`PoolRealArray<class_PoolRealArray>`.
  64. Method Descriptions
  65. -------------------
  66. .. _class_Gradient_method_add_point:
  67. - void **add_point** **(** :ref:`float<class_float>` offset, :ref:`Color<class_Color>` color **)**
  68. Adds the specified color to the end of the ramp, with the specified offset.
  69. .. _class_Gradient_method_get_color:
  70. - :ref:`Color<class_Color>` **get_color** **(** :ref:`int<class_int>` point **)** const
  71. Returns the color of the ramp color at index ``point``.
  72. .. _class_Gradient_method_get_offset:
  73. - :ref:`float<class_float>` **get_offset** **(** :ref:`int<class_int>` point **)** const
  74. Returns the offset of the ramp color at index ``point``.
  75. .. _class_Gradient_method_get_point_count:
  76. - :ref:`int<class_int>` **get_point_count** **(** **)** const
  77. Returns the number of colors in the ramp.
  78. .. _class_Gradient_method_interpolate:
  79. - :ref:`Color<class_Color>` **interpolate** **(** :ref:`float<class_float>` offset **)**
  80. Returns the interpolated color specified by ``offset``.
  81. .. _class_Gradient_method_remove_point:
  82. - void **remove_point** **(** :ref:`int<class_int>` offset **)**
  83. Removes the color at the index ``offset``.
  84. .. _class_Gradient_method_set_color:
  85. - void **set_color** **(** :ref:`int<class_int>` point, :ref:`Color<class_Color>` color **)**
  86. Sets the color of the ramp color at index ``point``.
  87. .. _class_Gradient_method_set_offset:
  88. - void **set_offset** **(** :ref:`int<class_int>` point, :ref:`float<class_float>` offset **)**
  89. Sets the offset for the ramp color at index ``point``.