2
0

Gradient.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Gradient" inherits="Resource" version="4.0">
  3. <brief_description>
  4. A color interpolator resource which can be used to generate colors between user-defined color points.
  5. </brief_description>
  6. <description>
  7. 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 gradient will interpolate from color 1 to color 2 and from color 2 to color 3. The gradient will initially have 2 colors (black and white), one (black) at gradient lower offset 0 and the other (white) at the gradient higher offset 1.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_point">
  13. <return type="void" />
  14. <argument index="0" name="offset" type="float" />
  15. <argument index="1" name="color" type="Color" />
  16. <description>
  17. Adds the specified color to the end of the gradient, with the specified offset.
  18. </description>
  19. </method>
  20. <method name="get_color">
  21. <return type="Color" />
  22. <argument index="0" name="point" type="int" />
  23. <description>
  24. Returns the color of the gradient color at index [code]point[/code].
  25. </description>
  26. </method>
  27. <method name="get_offset">
  28. <return type="float" />
  29. <argument index="0" name="point" type="int" />
  30. <description>
  31. Returns the offset of the gradient color at index [code]point[/code].
  32. </description>
  33. </method>
  34. <method name="get_point_count" qualifiers="const">
  35. <return type="int" />
  36. <description>
  37. Returns the number of colors in the gradient.
  38. </description>
  39. </method>
  40. <method name="interpolate">
  41. <return type="Color" />
  42. <argument index="0" name="offset" type="float" />
  43. <description>
  44. Returns the interpolated color specified by [code]offset[/code].
  45. </description>
  46. </method>
  47. <method name="remove_point">
  48. <return type="void" />
  49. <argument index="0" name="point" type="int" />
  50. <description>
  51. Removes the color at the index [code]point[/code].
  52. </description>
  53. </method>
  54. <method name="reverse">
  55. <return type="void" />
  56. <description>
  57. Reverses/mirrors the gradient.
  58. </description>
  59. </method>
  60. <method name="set_color">
  61. <return type="void" />
  62. <argument index="0" name="point" type="int" />
  63. <argument index="1" name="color" type="Color" />
  64. <description>
  65. Sets the color of the gradient color at index [code]point[/code].
  66. </description>
  67. </method>
  68. <method name="set_offset">
  69. <return type="void" />
  70. <argument index="0" name="point" type="int" />
  71. <argument index="1" name="offset" type="float" />
  72. <description>
  73. Sets the offset for the gradient color at index [code]point[/code].
  74. </description>
  75. </method>
  76. </methods>
  77. <members>
  78. <member name="colors" type="PackedColorArray" setter="set_colors" getter="get_colors" default="PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1)">
  79. Gradient's colors returned as a [PackedColorArray].
  80. </member>
  81. <member name="interpolation_mode" type="int" setter="set_interpolation_mode" getter="get_interpolation_mode" enum="Gradient.InterpolationMode" default="0">
  82. Defines how the colors between points of the gradient are interpolated. See [enum InterpolationMode] for available modes.
  83. </member>
  84. <member name="offsets" type="PackedFloat32Array" setter="set_offsets" getter="get_offsets" default="PackedFloat32Array(0, 1)">
  85. Gradient's offsets returned as a [PackedFloat32Array].
  86. </member>
  87. </members>
  88. <constants>
  89. <constant name="GRADIENT_INTERPOLATE_LINEAR" value="0" enum="InterpolationMode">
  90. Linear interpolation.
  91. </constant>
  92. <constant name="GRADIENT_INTERPOLATE_CONSTANT" value="1" enum="InterpolationMode">
  93. 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.
  94. </constant>
  95. <constant name="GRADIENT_INTERPOLATE_CUBIC" value="2" enum="InterpolationMode">
  96. Cubic interpolation.
  97. </constant>
  98. </constants>
  99. </class>