class_gradient.rst 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Gradient.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Gradient:
  5. Gradient
  6. ========
  7. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Color interpolator node.
  12. Member Functions
  13. ----------------
  14. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_point<class_Gradient_add_point>` **(** :ref:`float<class_float>` offset, :ref:`Color<class_color>` color **)** |
  16. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Color<class_color>` | :ref:`get_color<class_Gradient_get_color>` **(** :ref:`int<class_int>` point **)** const |
  18. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`PoolColorArray<class_poolcolorarray>` | :ref:`get_colors<class_Gradient_get_colors>` **(** **)** const |
  20. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`get_offset<class_Gradient_get_offset>` **(** :ref:`int<class_int>` point **)** const |
  22. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`PoolRealArray<class_poolrealarray>` | :ref:`get_offsets<class_Gradient_get_offsets>` **(** **)** const |
  24. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`get_point_count<class_Gradient_get_point_count>` **(** **)** const |
  26. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Color<class_color>` | :ref:`interpolate<class_Gradient_interpolate>` **(** :ref:`float<class_float>` offset **)** |
  28. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`remove_point<class_Gradient_remove_point>` **(** :ref:`int<class_int>` offset **)** |
  30. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_color<class_Gradient_set_color>` **(** :ref:`int<class_int>` point, :ref:`Color<class_color>` color **)** |
  32. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_colors<class_Gradient_set_colors>` **(** :ref:`PoolColorArray<class_poolcolorarray>` colors **)** |
  34. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_offset<class_Gradient_set_offset>` **(** :ref:`int<class_int>` point, :ref:`float<class_float>` offset **)** |
  36. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_offsets<class_Gradient_set_offsets>` **(** :ref:`PoolRealArray<class_poolrealarray>` offsets **)** |
  38. +----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  39. Member Variables
  40. ----------------
  41. - :ref:`PoolColorArray<class_poolcolorarray>` **colors** - Gradient's colors returned as a [PoolColorArray].
  42. - :ref:`PoolRealArray<class_poolrealarray>` **offsets** - Gradient's offsets returned as a [PoolRealArray].
  43. Description
  44. -----------
  45. Given a set of colors, this node will interpolate them in order, meaning, that if you have color 1, color 2 and color3, the ramp will interpolate (generate the colors between two colors) from color 1 to color 2 and from color 2 to color 3. Initially the ramp will have 2 colors (black and white), one (black) at ramp lower offset offset 0 and the other (white) at the ramp higher offset 1.
  46. Member Function Description
  47. ---------------------------
  48. .. _class_Gradient_add_point:
  49. - void **add_point** **(** :ref:`float<class_float>` offset, :ref:`Color<class_color>` color **)**
  50. Adds the specified color to the end of the ramp, with the specified offset
  51. .. _class_Gradient_get_color:
  52. - :ref:`Color<class_color>` **get_color** **(** :ref:`int<class_int>` point **)** const
  53. Returns the color of the ramp color at index *point*
  54. .. _class_Gradient_get_colors:
  55. - :ref:`PoolColorArray<class_poolcolorarray>` **get_colors** **(** **)** const
  56. Returns the colors in the ramp
  57. .. _class_Gradient_get_offset:
  58. - :ref:`float<class_float>` **get_offset** **(** :ref:`int<class_int>` point **)** const
  59. Returns the offset of the ramp color at index *point*
  60. .. _class_Gradient_get_offsets:
  61. - :ref:`PoolRealArray<class_poolrealarray>` **get_offsets** **(** **)** const
  62. Returns the offsets for the colors in this ramp
  63. .. _class_Gradient_get_point_count:
  64. - :ref:`int<class_int>` **get_point_count** **(** **)** const
  65. Returns the number of colors in the ramp
  66. .. _class_Gradient_interpolate:
  67. - :ref:`Color<class_color>` **interpolate** **(** :ref:`float<class_float>` offset **)**
  68. Returns the interpolated color specified by *offset*
  69. .. _class_Gradient_remove_point:
  70. - void **remove_point** **(** :ref:`int<class_int>` offset **)**
  71. Removes the color at the index *offset*
  72. .. _class_Gradient_set_color:
  73. - void **set_color** **(** :ref:`int<class_int>` point, :ref:`Color<class_color>` color **)**
  74. Sets the color of the ramp color at index *point*
  75. .. _class_Gradient_set_colors:
  76. - void **set_colors** **(** :ref:`PoolColorArray<class_poolcolorarray>` colors **)**
  77. Sets the colors for the specified amount of elements. Calling this function with a different number of elements than previously defined causes the ramp to resize its colors and offsets array to accommodate the new elements.
  78. .. _class_Gradient_set_offset:
  79. - void **set_offset** **(** :ref:`int<class_int>` point, :ref:`float<class_float>` offset **)**
  80. Sets the offset for the ramp color at index *point*
  81. .. _class_Gradient_set_offsets:
  82. - void **set_offsets** **(** :ref:`PoolRealArray<class_poolrealarray>` offsets **)**
  83. Sets the offset for the specified amount of elements. Calling this function with a different number of elements than previously defined causes the ramp to resize its colors and offsets array to accommodate the new elements, all new colors will be black by default.