class_polygon2d.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Polygon2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Polygon2D:
  5. Polygon2D
  6. =========
  7. **Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A 2D polygon.
  12. Member Functions
  13. ----------------
  14. +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`get_texture_rotation<class_Polygon2D_get_texture_rotation>` **(** **)** const |
  16. +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`set_texture_rotation<class_Polygon2D_set_texture_rotation>` **(** :ref:`float<class_float>` texture_rotation **)** |
  18. +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
  19. Member Variables
  20. ----------------
  21. .. _class_Polygon2D_antialiased:
  22. - :ref:`bool<class_bool>` **antialiased** - If ``true`` polygon edges will be anti-aliased. Default value: ``false``.
  23. .. _class_Polygon2D_color:
  24. - :ref:`Color<class_color>` **color** - The polygon's fill color. If ``texture`` is defined, it will be multiplied by this color. It will also be the default color for vertices not set in ``vertex_colors``.
  25. .. _class_Polygon2D_invert_border:
  26. - :ref:`float<class_float>` **invert_border** - Added padding applied to the bounding box when using ``invert``. Setting this value too small may result in a "Bad Polygon" error. Default value: ``100``.
  27. .. _class_Polygon2D_invert_enable:
  28. - :ref:`bool<class_bool>` **invert_enable** - If ``true`` polygon will be inverted, containing the area outside the defined points and extending to the ``invert_border``. Default value: ``false``.
  29. .. _class_Polygon2D_offset:
  30. - :ref:`Vector2<class_vector2>` **offset** - The offset applied to each vertex.
  31. .. _class_Polygon2D_polygon:
  32. - :ref:`PoolVector2Array<class_poolvector2array>` **polygon** - The polygon's list of vertices. The final point will be connected to the first.
  33. .. _class_Polygon2D_texture:
  34. - :ref:`Texture<class_texture>` **texture** - The polygon's fill texture. Use ``uv`` to set texture coordinates.
  35. .. _class_Polygon2D_texture_offset:
  36. - :ref:`Vector2<class_vector2>` **texture_offset** - Amount to offset the polygon's ``texture``. If ``(0, 0)`` the texture's origin (its top-left corner) will be placed at the polygon's ``position``.
  37. .. _class_Polygon2D_texture_rotation:
  38. - :ref:`float<class_float>` **texture_rotation** - The texture's rotation in degrees.
  39. .. _class_Polygon2D_texture_scale:
  40. - :ref:`Vector2<class_vector2>` **texture_scale** - Amount to multiply the ``uv`` coordinates when using a ``texture``. Larger values make the texture smaller, and vice versa.
  41. .. _class_Polygon2D_uv:
  42. - :ref:`PoolVector2Array<class_poolvector2array>` **uv** - Texture coordinates for each vertex of the polygon. There should be one ``uv`` per polygon vertex. If there are fewer, undefined vertices will use ``(0, 0)``.
  43. .. _class_Polygon2D_vertex_colors:
  44. - :ref:`PoolColorArray<class_poolcolorarray>` **vertex_colors** - Color for each vertex. Colors are interpolated between vertices, resulting in smooth gradients. There should be one per polygon vertex. If there are fewer, undefined vertices will use ``color``.
  45. Description
  46. -----------
  47. A Polygon2D is defined by a set of points. Each point is connected to the next, with the final point being connected to the first, resulting in a closed polygon. Polygon2Ds can be filled with color (solid or gradient) or filled with a given texture.
  48. Member Function Description
  49. ---------------------------
  50. .. _class_Polygon2D_get_texture_rotation:
  51. - :ref:`float<class_float>` **get_texture_rotation** **(** **)** const
  52. Return the rotation in radians of the texture polygon.
  53. .. _class_Polygon2D_set_texture_rotation:
  54. - void **set_texture_rotation** **(** :ref:`float<class_float>` texture_rotation **)**
  55. Set the amount of rotation of the polygon texture, ``texture_rotation`` is specified in radians and clockwise rotation.