Gradient.xml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Gradient" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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. See also [Curve] which supports more complex easing methods, but does not support colors.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="add_point">
  14. <return type="void" />
  15. <argument index="0" name="offset" type="float" />
  16. <argument index="1" name="color" type="Color" />
  17. <description>
  18. Adds the specified color to the end of the ramp, with the specified offset.
  19. </description>
  20. </method>
  21. <method name="get_color">
  22. <return type="Color" />
  23. <argument index="0" name="point" type="int" />
  24. <description>
  25. Returns the color of the ramp color at index [code]point[/code].
  26. </description>
  27. </method>
  28. <method name="get_offset">
  29. <return type="float" />
  30. <argument index="0" name="point" type="int" />
  31. <description>
  32. Returns the offset of the ramp color at index [code]point[/code].
  33. </description>
  34. </method>
  35. <method name="get_point_count" qualifiers="const">
  36. <return type="int" />
  37. <description>
  38. Returns the number of colors in the ramp.
  39. </description>
  40. </method>
  41. <method name="interpolate">
  42. <return type="Color" />
  43. <argument index="0" name="offset" type="float" />
  44. <description>
  45. Returns the interpolated color specified by [code]offset[/code].
  46. </description>
  47. </method>
  48. <method name="remove_point">
  49. <return type="void" />
  50. <argument index="0" name="point" type="int" />
  51. <description>
  52. Removes the color at the index [code]point[/code].
  53. </description>
  54. </method>
  55. <method name="set_color">
  56. <return type="void" />
  57. <argument index="0" name="point" type="int" />
  58. <argument index="1" name="color" type="Color" />
  59. <description>
  60. Sets the color of the ramp color at index [code]point[/code].
  61. </description>
  62. </method>
  63. <method name="set_offset">
  64. <return type="void" />
  65. <argument index="0" name="point" type="int" />
  66. <argument index="1" name="offset" type="float" />
  67. <description>
  68. Sets the offset for the ramp color at index [code]point[/code].
  69. </description>
  70. </method>
  71. </methods>
  72. <members>
  73. <member name="colors" type="PoolColorArray" setter="set_colors" getter="get_colors" default="PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 )">
  74. Gradient's colors returned as a [PoolColorArray].
  75. </member>
  76. <member name="interpolation_mode" type="int" setter="set_interpolation_mode" getter="get_interpolation_mode" enum="Gradient.InterpolationMode" default="0">
  77. Defines how the colors between points of the gradient are interpolated. See [enum InterpolationMode] for available modes.
  78. </member>
  79. <member name="offsets" type="PoolRealArray" setter="set_offsets" getter="get_offsets" default="PoolRealArray( 0, 1 )">
  80. Gradient's offsets returned as a [PoolRealArray].
  81. </member>
  82. </members>
  83. <constants>
  84. <constant name="GRADIENT_INTERPOLATE_LINEAR" value="0" enum="InterpolationMode">
  85. Linear interpolation.
  86. </constant>
  87. <constant name="GRADIENT_INTERPOLATE_CONSTANT" value="1" enum="InterpolationMode">
  88. 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.
  89. </constant>
  90. <constant name="GRADIENT_INTERPOLATE_CUBIC" value="2" enum="InterpolationMode">
  91. Cubic interpolation.
  92. </constant>
  93. </constants>
  94. </class>