Files
godot-docs-l10n/classes/uk/class_polygon2d.rst

461 lines
24 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_Polygon2D:
Polygon2D
=========
**Успадковує:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
A 2D полігон.
.. rst-class:: classref-introduction-group
Опис
--------
Polygon2D визначається набором точок. Кожна точка з'єднана з наступною, а остання точка з'єднана з першою, що призводить до замкнутого полігону. Polygon2Ds можна заповнити кольором (суцільним або градієнтним) або заданою текстурою.
.. rst-class:: classref-reftable-group
Властивості
----------------------
.. table::
:widths: auto
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`bool<class_bool>` | :ref:`antialiased<class_Polygon2D_property_antialiased>` | ``false`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`Color<class_Color>` | :ref:`color<class_Polygon2D_property_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`int<class_int>` | :ref:`internal_vertex_count<class_Polygon2D_property_internal_vertex_count>` | ``0`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`float<class_float>` | :ref:`invert_border<class_Polygon2D_property_invert_border>` | ``100.0`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`bool<class_bool>` | :ref:`invert_enabled<class_Polygon2D_property_invert_enabled>` | ``false`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`offset<class_Polygon2D_property_offset>` | ``Vector2(0, 0)`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`polygon<class_Polygon2D_property_polygon>` | ``PackedVector2Array()`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`Array<class_Array>` | :ref:`polygons<class_Polygon2D_property_polygons>` | ``[]`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`skeleton<class_Polygon2D_property_skeleton>` | ``NodePath("")`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`texture<class_Polygon2D_property_texture>` | |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`texture_offset<class_Polygon2D_property_texture_offset>` | ``Vector2(0, 0)`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`float<class_float>` | :ref:`texture_rotation<class_Polygon2D_property_texture_rotation>` | ``0.0`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`texture_scale<class_Polygon2D_property_texture_scale>` | ``Vector2(1, 1)`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`uv<class_Polygon2D_property_uv>` | ``PackedVector2Array()`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
| :ref:`PackedColorArray<class_PackedColorArray>` | :ref:`vertex_colors<class_Polygon2D_property_vertex_colors>` | ``PackedColorArray()`` |
+-----------------------------------------------------+------------------------------------------------------------------------------+--------------------------+
.. rst-class:: classref-reftable-group
Методи
------------
.. table::
:widths: auto
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_bone<class_Polygon2D_method_add_bone>`\ (\ path\: :ref:`NodePath<class_NodePath>`, weights\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_bones<class_Polygon2D_method_clear_bones>`\ (\ ) |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`erase_bone<class_Polygon2D_method_erase_bone>`\ (\ index\: :ref:`int<class_int>`\ ) |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_bone_count<class_Polygon2D_method_get_bone_count>`\ (\ ) |const| |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`get_bone_path<class_Polygon2D_method_get_bone_path>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`get_bone_weights<class_Polygon2D_method_get_bone_weights>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bone_path<class_Polygon2D_method_set_bone_path>`\ (\ index\: :ref:`int<class_int>`, path\: :ref:`NodePath<class_NodePath>`\ ) |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bone_weights<class_Polygon2D_method_set_bone_weights>`\ (\ index\: :ref:`int<class_int>`, weights\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) |
+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Описи властивостей
------------------------------------
.. _class_Polygon2D_property_antialiased:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **antialiased** = ``false`` :ref:`🔗<class_Polygon2D_property_antialiased>`
.. rst-class:: classref-property-setget
- |void| **set_antialiased**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_antialiased**\ (\ )
Якщо ``true``, полігонні краї будуть антиалюзовані.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_color:
.. rst-class:: classref-property
:ref:`Color<class_Color>` **color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Polygon2D_property_color>`
.. rst-class:: classref-property-setget
- |void| **set_color**\ (\ value\: :ref:`Color<class_Color>`\ )
- :ref:`Color<class_Color>` **get_color**\ (\ )
Колір заливки полігону. Якщо встановлено :ref:`texture<class_Polygon2D_property_texture>`, він буде помножений на цей колір. Він також буде кольором за замовчуванням для вершин, не встановлених у :ref:`vertex_colors<class_Polygon2D_property_vertex_colors>`.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_internal_vertex_count:
.. rst-class:: classref-property
:ref:`int<class_int>` **internal_vertex_count** = ``0`` :ref:`🔗<class_Polygon2D_property_internal_vertex_count>`
.. rst-class:: classref-property-setget
- |void| **set_internal_vertex_count**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_internal_vertex_count**\ (\ )
Кількість внутрішніх вершин, використовуваних для УФ-картування.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_invert_border:
.. rst-class:: classref-property
:ref:`float<class_float>` **invert_border** = ``100.0`` :ref:`🔗<class_Polygon2D_property_invert_border>`
.. rst-class:: classref-property-setget
- |void| **set_invert_border**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_invert_border**\ (\ )
Додано відступи, що застосовуються до обмежувальної рамки, коли для :ref:`invert_enabled<class_Polygon2D_property_invert_enabled>` встановлено значення ``true``. Занадто мале значення може призвести до помилки «Неправильний полігон».
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_invert_enabled:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **invert_enabled** = ``false`` :ref:`🔗<class_Polygon2D_property_invert_enabled>`
.. rst-class:: classref-property-setget
- |void| **set_invert_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_invert_enabled**\ (\ )
Якщо ``true``, полігон буде перевернуто, що містить площу поза визначеними пунктами і продовжить до :ref:`invert_border<class_Polygon2D_property_invert_border>`.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_offset:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **offset** = ``Vector2(0, 0)`` :ref:`🔗<class_Polygon2D_property_offset>`
.. rst-class:: classref-property-setget
- |void| **set_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_offset**\ (\ )
Зміщення наноситься на кожну вершину.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_polygon:
.. rst-class:: classref-property
:ref:`PackedVector2Array<class_PackedVector2Array>` **polygon** = ``PackedVector2Array()`` :ref:`🔗<class_Polygon2D_property_polygon>`
.. rst-class:: classref-property-setget
- |void| **set_polygon**\ (\ value\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ )
- :ref:`PackedVector2Array<class_PackedVector2Array>` **get_polygon**\ (\ )
Перелік вершин полігону. Остаточний пункт буде підключений до першого.
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedVector2Array<class_PackedVector2Array>` for more details.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_polygons:
.. rst-class:: classref-property
:ref:`Array<class_Array>` **polygons** = ``[]`` :ref:`🔗<class_Polygon2D_property_polygons>`
.. rst-class:: classref-property-setget
- |void| **set_polygons**\ (\ value\: :ref:`Array<class_Array>`\ )
- :ref:`Array<class_Array>` **get_polygons**\ (\ )
Перелік полігонів, у випадку, якщо представлено більше одного. Кожен окремий полігон зберігається як :ref:`PackedInt32Array<class_PackedInt32Array>`, де кожен :ref:`int<class_int>` є індексом точки :ref:`polygon<class_Polygon2D_property_polygon>`. Якщо порожня, це властивість буде ігноруватися, і отриманий єдиний полігон буде складатися з усіх точок в полігоні :ref:`polygon<class_Polygon2D_property_polygon>`, використовуючи порядок, який вони зберігаються в.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_skeleton:
.. rst-class:: classref-property
:ref:`NodePath<class_NodePath>` **skeleton** = ``NodePath("")`` :ref:`🔗<class_Polygon2D_property_skeleton>`
.. rst-class:: classref-property-setget
- |void| **set_skeleton**\ (\ value\: :ref:`NodePath<class_NodePath>`\ )
- :ref:`NodePath<class_NodePath>` **get_skeleton**\ (\ )
Шлях до вершини :ref:`Skeleton2D<class_Skeleton2D>`, що використовується для деформацій на основі скелетів цього полігону. При порожньому або недійсному, не буде використовуватися скелетні деформації.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_texture:
.. rst-class:: classref-property
:ref:`Texture2D<class_Texture2D>` **texture** :ref:`🔗<class_Polygon2D_property_texture>`
.. rst-class:: classref-property-setget
- |void| **set_texture**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
- :ref:`Texture2D<class_Texture2D>` **get_texture**\ (\ )
Текстура полігонів. Використовуйте :ref:`uv<class_Polygon2D_property_uv>` для встановлення координат текстури.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_texture_offset:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **texture_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_Polygon2D_property_texture_offset>`
.. rst-class:: classref-property-setget
- |void| **set_texture_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_texture_offset**\ (\ )
Змішані зміщення текстури полігонів :ref:`texture<class_Polygon2D_property_texture>`. Якщо встановити до ``Vector2(0, 0)``, фактура походження (і верхній лівий кут) буде розміщена на полігоні.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_texture_rotation:
.. rst-class:: classref-property
:ref:`float<class_float>` **texture_rotation** = ``0.0`` :ref:`🔗<class_Polygon2D_property_texture_rotation>`
.. rst-class:: classref-property-setget
- |void| **set_texture_rotation**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_texture_rotation**\ (\ )
Поворот текстури в радіанах.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_texture_scale:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **texture_scale** = ``Vector2(1, 1)`` :ref:`🔗<class_Polygon2D_property_texture_scale>`
.. rst-class:: classref-property-setget
- |void| **set_texture_scale**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_texture_scale**\ (\ )
Величина множення координат :ref:`uv<class_Polygon2D_property_uv>` при використанні :ref:`texture<class_Polygon2D_property_texture>`. Більші значення зменшують текстуру, і навпаки.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_uv:
.. rst-class:: classref-property
:ref:`PackedVector2Array<class_PackedVector2Array>` **uv** = ``PackedVector2Array()`` :ref:`🔗<class_Polygon2D_property_uv>`
.. rst-class:: classref-property-setget
- |void| **set_uv**\ (\ value\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ )
- :ref:`PackedVector2Array<class_PackedVector2Array>` **get_uv**\ (\ )
Географічні координати тексту для кожної вершини полігону. УФ має бути одне значення для полігонної вершини. Якщо є менше, не визначені вершини будуть використовуватися ``Vector2(0, 0)``.
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedVector2Array<class_PackedVector2Array>` for more details.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_property_vertex_colors:
.. rst-class:: classref-property
:ref:`PackedColorArray<class_PackedColorArray>` **vertex_colors** = ``PackedColorArray()`` :ref:`🔗<class_Polygon2D_property_vertex_colors>`
.. rst-class:: classref-property-setget
- |void| **set_vertex_colors**\ (\ value\: :ref:`PackedColorArray<class_PackedColorArray>`\ )
- :ref:`PackedColorArray<class_PackedColorArray>` **get_vertex_colors**\ (\ )
Колір для кожної вершини. Кольори міжполіровані між вершинами, що призводить до гладких градієнтів. Для полігону слід бути одним. Якщо є менше, не визначені вершини будуть використовуватися :ref:`color<class_Polygon2D_property_color>`.
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedColorArray<class_PackedColorArray>` for more details.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Описи методів
--------------------------
.. _class_Polygon2D_method_add_bone:
.. rst-class:: classref-method
|void| **add_bone**\ (\ path\: :ref:`NodePath<class_NodePath>`, weights\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) :ref:`🔗<class_Polygon2D_method_add_bone>`
Додає кістку з вказаним ``path`` та ``weights``.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_method_clear_bones:
.. rst-class:: classref-method
|void| **clear_bones**\ (\ ) :ref:`🔗<class_Polygon2D_method_clear_bones>`
Видалити всі кістки з цього **Polygon2D**.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_method_erase_bone:
.. rst-class:: classref-method
|void| **erase_bone**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Polygon2D_method_erase_bone>`
Видаліть зазначену кісточку з цього **Polygon2D**.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_method_get_bone_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_bone_count**\ (\ ) |const| :ref:`🔗<class_Polygon2D_method_get_bone_count>`
Повертає кількість кісток в цьому **Polygon2D**.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_method_get_bone_path:
.. rst-class:: classref-method
:ref:`NodePath<class_NodePath>` **get_bone_path**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Polygon2D_method_get_bone_path>`
Повертає шлях до вузла, пов'язаної з зазначеною кісткою.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_method_get_bone_weights:
.. rst-class:: classref-method
:ref:`PackedFloat32Array<class_PackedFloat32Array>` **get_bone_weights**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Polygon2D_method_get_bone_weights>`
Повертає значення маси зазначеної кістки.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_method_set_bone_path:
.. rst-class:: classref-method
|void| **set_bone_path**\ (\ index\: :ref:`int<class_int>`, path\: :ref:`NodePath<class_NodePath>`\ ) :ref:`🔗<class_Polygon2D_method_set_bone_path>`
Встановлює шлях до вузла, пов'язаної з зазначеною кісткою.
.. rst-class:: classref-item-separator
----
.. _class_Polygon2D_method_set_bone_weights:
.. rst-class:: classref-method
|void| **set_bone_weights**\ (\ index\: :ref:`int<class_int>`, weights\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) :ref:`🔗<class_Polygon2D_method_set_bone_weights>`
Налаштовує значення маси для вказаної кістки.
.. |virtual| replace:: :abbr:`virtual (Зазвичай, цей метод перевизначається користувачем, щоб він мав вплив.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (Цей метод не має побічних ефектів. Не змінює ніяку змінну екземпляра об'єкта.)`
.. |vararg| replace:: :abbr:`vararg (Цей метод приймає будь-яке число аргументів після описаних тут.)`
.. |constructor| replace:: :abbr:`constructor (Цей метод використовується для побудови типів.)`
.. |static| replace:: :abbr:`static (Цей метод не потребує екземпляра для виклику, його можна викликати безпосередньо за допомогою назви класу.)`
.. |operator| replace:: :abbr:`operator (Цей метод описує дійсний оператор для взаємодії з цим типом як з лівим операндом.)`
.. |bitfield| replace:: :abbr:`BitField (Це значення є цілим числом, складеним у вигляді бітової маски з наступних прапорів.)`
.. |void| replace:: :abbr:`void (Значення не повертається.)`