class_gradient.rst 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.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. A color interpolator resource which can be used to generate colors between user-defined color points.
  10. Description
  11. -----------
  12. 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.
  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 **)** |
  26. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`float<class_float>` | :ref:`get_offset<class_Gradient_method_get_offset>` **(** :ref:`int<class_int>` point **)** |
  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>` point **)** |
  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. Property Descriptions
  40. ---------------------
  41. .. _class_Gradient_property_colors:
  42. - :ref:`PoolColorArray<class_PoolColorArray>` **colors**
  43. +-----------+----------------------------------------------+
  44. | *Default* | ``PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 )`` |
  45. +-----------+----------------------------------------------+
  46. | *Setter* | set_colors(value) |
  47. +-----------+----------------------------------------------+
  48. | *Getter* | get_colors() |
  49. +-----------+----------------------------------------------+
  50. Gradient's colors returned as a :ref:`PoolColorArray<class_PoolColorArray>`.
  51. ----
  52. .. _class_Gradient_property_offsets:
  53. - :ref:`PoolRealArray<class_PoolRealArray>` **offsets**
  54. +-----------+---------------------------+
  55. | *Default* | ``PoolRealArray( 0, 1 )`` |
  56. +-----------+---------------------------+
  57. | *Setter* | set_offsets(value) |
  58. +-----------+---------------------------+
  59. | *Getter* | get_offsets() |
  60. +-----------+---------------------------+
  61. Gradient's offsets returned as a :ref:`PoolRealArray<class_PoolRealArray>`.
  62. Method Descriptions
  63. -------------------
  64. .. _class_Gradient_method_add_point:
  65. - void **add_point** **(** :ref:`float<class_float>` offset, :ref:`Color<class_Color>` color **)**
  66. Adds the specified color to the end of the ramp, with the specified offset.
  67. ----
  68. .. _class_Gradient_method_get_color:
  69. - :ref:`Color<class_Color>` **get_color** **(** :ref:`int<class_int>` point **)**
  70. Returns the color of the ramp color at index ``point``.
  71. ----
  72. .. _class_Gradient_method_get_offset:
  73. - :ref:`float<class_float>` **get_offset** **(** :ref:`int<class_int>` point **)**
  74. Returns the offset of the ramp color at index ``point``.
  75. ----
  76. .. _class_Gradient_method_get_point_count:
  77. - :ref:`int<class_int>` **get_point_count** **(** **)** |const|
  78. Returns the number of colors in the ramp.
  79. ----
  80. .. _class_Gradient_method_interpolate:
  81. - :ref:`Color<class_Color>` **interpolate** **(** :ref:`float<class_float>` offset **)**
  82. Returns the interpolated color specified by ``offset``.
  83. ----
  84. .. _class_Gradient_method_remove_point:
  85. - void **remove_point** **(** :ref:`int<class_int>` point **)**
  86. Removes the color at the index ``point``.
  87. ----
  88. .. _class_Gradient_method_set_color:
  89. - void **set_color** **(** :ref:`int<class_int>` point, :ref:`Color<class_Color>` color **)**
  90. Sets the color of the ramp color at index ``point``.
  91. ----
  92. .. _class_Gradient_method_set_offset:
  93. - void **set_offset** **(** :ref:`int<class_int>` point, :ref:`float<class_float>` offset **)**
  94. Sets the offset for the ramp color at index ``point``.
  95. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  96. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  97. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`