Files
godot-docs-l10n/classes/uk/class_gradient.rst
Rémi Verschelde c3f2364c10 Sync classref with 4.6 branch
Lots of translations invalidated (fuzzied) as we just synced Weblate.
2025-12-19 16:39:51 +01:00

347 lines
17 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_Gradient:
Gradient
========
**Успадковує:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Перехід кольору.
.. rst-class:: classref-introduction-group
Опис
--------
Цей ресурс описує перехід кольорів шляхом визначення набору кольорових точок і способів інтерполяції між ними.
Дивіться також :ref:`Curve<class_Curve>`, який підтримує більш складні методи ослаблення, але не підтримує кольори.
.. rst-class:: classref-reftable-group
Властивості
----------------------
.. table::
:widths: auto
+-----------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------------+
| :ref:`PackedColorArray<class_PackedColorArray>` | :ref:`colors<class_Gradient_property_colors>` | ``PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1)`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------------+
| :ref:`ColorSpace<enum_Gradient_ColorSpace>` | :ref:`interpolation_color_space<class_Gradient_property_interpolation_color_space>` | ``0`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------------+
| :ref:`InterpolationMode<enum_Gradient_InterpolationMode>` | :ref:`interpolation_mode<class_Gradient_property_interpolation_mode>` | ``0`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------------+
| :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`offsets<class_Gradient_property_offsets>` | ``PackedFloat32Array(0, 1)`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------------+
.. rst-class:: classref-reftable-group
Методи
------------
.. table::
:widths: auto
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_point<class_Gradient_method_add_point>`\ (\ offset\: :ref:`float<class_float>`, color\: :ref:`Color<class_Color>`\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Color<class_Color>` | :ref:`get_color<class_Gradient_method_get_color>`\ (\ point\: :ref:`int<class_int>`\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_offset<class_Gradient_method_get_offset>`\ (\ point\: :ref:`int<class_int>`\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_point_count<class_Gradient_method_get_point_count>`\ (\ ) |const| |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_point<class_Gradient_method_remove_point>`\ (\ point\: :ref:`int<class_int>`\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`reverse<class_Gradient_method_reverse>`\ (\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Color<class_Color>` | :ref:`sample<class_Gradient_method_sample>`\ (\ offset\: :ref:`float<class_float>`\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_color<class_Gradient_method_set_color>`\ (\ point\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_offset<class_Gradient_method_set_offset>`\ (\ point\: :ref:`int<class_int>`, offset\: :ref:`float<class_float>`\ ) |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Переліки
----------------
.. _enum_Gradient_InterpolationMode:
.. rst-class:: classref-enumeration
enum **InterpolationMode**: :ref:`🔗<enum_Gradient_InterpolationMode>`
.. _class_Gradient_constant_GRADIENT_INTERPOLATE_LINEAR:
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationMode<enum_Gradient_InterpolationMode>` **GRADIENT_INTERPOLATE_LINEAR** = ``0``
Лінійна інтерполяція.
.. _class_Gradient_constant_GRADIENT_INTERPOLATE_CONSTANT:
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationMode<enum_Gradient_InterpolationMode>` **GRADIENT_INTERPOLATE_CONSTANT** = ``1``
Постійна інтерполяція, колір різко змінюється в кожній точці та залишається однорідним між ними. У деяких випадках це може спричинити видиме згладжування при використанні для градієнтної текстури.
.. _class_Gradient_constant_GRADIENT_INTERPOLATE_CUBIC:
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationMode<enum_Gradient_InterpolationMode>` **GRADIENT_INTERPOLATE_CUBIC** = ``2``
Кубічна інтерполяція.
.. rst-class:: classref-item-separator
----
.. _enum_Gradient_ColorSpace:
.. rst-class:: classref-enumeration
enum **ColorSpace**: :ref:`🔗<enum_Gradient_ColorSpace>`
.. _class_Gradient_constant_GRADIENT_COLOR_SPACE_SRGB:
.. rst-class:: classref-enumeration-constant
:ref:`ColorSpace<enum_Gradient_ColorSpace>` **GRADIENT_COLOR_SPACE_SRGB** = ``0``
колірний простір sRGB.
.. _class_Gradient_constant_GRADIENT_COLOR_SPACE_LINEAR_SRGB:
.. rst-class:: classref-enumeration-constant
:ref:`ColorSpace<enum_Gradient_ColorSpace>` **GRADIENT_COLOR_SPACE_LINEAR_SRGB** = ``1``
Лінійний колірний простір sRGB.
.. _class_Gradient_constant_GRADIENT_COLOR_SPACE_OKLAB:
.. rst-class:: classref-enumeration-constant
:ref:`ColorSpace<enum_Gradient_ColorSpace>` **GRADIENT_COLOR_SPACE_OKLAB** = ``2``
Колірний простір `Oklab <https://bottosson.github.io/posts/oklab/>`__. Цей колірний простір забезпечує плавний і рівномірний перехід між кольорами.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Описи властивостей
------------------------------------
.. _class_Gradient_property_colors:
.. rst-class:: classref-property
:ref:`PackedColorArray<class_PackedColorArray>` **colors** = ``PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1)`` :ref:`🔗<class_Gradient_property_colors>`
.. rst-class:: classref-property-setget
- |void| **set_colors**\ (\ value\: :ref:`PackedColorArray<class_PackedColorArray>`\ )
- :ref:`PackedColorArray<class_PackedColorArray>` **get_colors**\ (\ )
Кольори градієнта як :ref:`PackedColorArray<class_PackedColorArray>`.
\ **Примітка:** налаштування цієї властивості оновлює всі кольори одночасно. Щоб оновити будь-який колір окремо, використовуйте :ref:`set_color()<class_Gradient_method_set_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-item-separator
----
.. _class_Gradient_property_interpolation_color_space:
.. rst-class:: classref-property
:ref:`ColorSpace<enum_Gradient_ColorSpace>` **interpolation_color_space** = ``0`` :ref:`🔗<class_Gradient_property_interpolation_color_space>`
.. rst-class:: classref-property-setget
- |void| **set_interpolation_color_space**\ (\ value\: :ref:`ColorSpace<enum_Gradient_ColorSpace>`\ )
- :ref:`ColorSpace<enum_Gradient_ColorSpace>` **get_interpolation_color_space**\ (\ )
The color space used to interpolate between points of the gradient. It does not affect the returned colors, which will always use nonlinear sRGB encoding.
\ **Note:** This setting has no effect when :ref:`interpolation_mode<class_Gradient_property_interpolation_mode>` is set to :ref:`GRADIENT_INTERPOLATE_CONSTANT<class_Gradient_constant_GRADIENT_INTERPOLATE_CONSTANT>`.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_property_interpolation_mode:
.. rst-class:: classref-property
:ref:`InterpolationMode<enum_Gradient_InterpolationMode>` **interpolation_mode** = ``0`` :ref:`🔗<class_Gradient_property_interpolation_mode>`
.. rst-class:: classref-property-setget
- |void| **set_interpolation_mode**\ (\ value\: :ref:`InterpolationMode<enum_Gradient_InterpolationMode>`\ )
- :ref:`InterpolationMode<enum_Gradient_InterpolationMode>` **get_interpolation_mode**\ (\ )
Алгоритм, що використовується для інтерполяції між точками градієнта.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_property_offsets:
.. rst-class:: classref-property
:ref:`PackedFloat32Array<class_PackedFloat32Array>` **offsets** = ``PackedFloat32Array(0, 1)`` :ref:`🔗<class_Gradient_property_offsets>`
.. rst-class:: classref-property-setget
- |void| **set_offsets**\ (\ value\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ )
- :ref:`PackedFloat32Array<class_PackedFloat32Array>` **get_offsets**\ (\ )
Зміщення градієнта як :ref:`PackedFloat32Array<class_PackedFloat32Array>`.
\ **Примітка:** встановлення цієї властивості оновлює всі зміщення одночасно. Щоб оновити будь-яке зсув окремо, використовуйте :ref:`set_offset()<class_Gradient_method_set_offset>`.
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedFloat32Array<class_PackedFloat32Array>` for more details.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Описи методів
--------------------------
.. _class_Gradient_method_add_point:
.. rst-class:: classref-method
|void| **add_point**\ (\ offset\: :ref:`float<class_float>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Gradient_method_add_point>`
Додає зазначений колір до градієнта, з вказаним офсетом.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_get_color:
.. rst-class:: classref-method
:ref:`Color<class_Color>` **get_color**\ (\ point\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Gradient_method_get_color>`
Повертає колір градієнта color за індексом ``point``.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_get_offset:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_offset**\ (\ point\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Gradient_method_get_offset>`
Повертає зміщення кольору градієнта за індексом ``point``.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_get_point_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_point_count**\ (\ ) |const| :ref:`🔗<class_Gradient_method_get_point_count>`
Повертає кількість кольорів в градієнті.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_remove_point:
.. rst-class:: classref-method
|void| **remove_point**\ (\ point\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Gradient_method_remove_point>`
Видаляє колір за індексом ``point``.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_reverse:
.. rst-class:: classref-method
|void| **reverse**\ (\ ) :ref:`🔗<class_Gradient_method_reverse>`
Змінює/дзеркалює градієнт.
\ **Примітка.** Цей метод відображає всі точки навколо середини градієнта, що може призвести до неочікуваних результатів, якщо :ref:`interpolation_mode<class_Gradient_property_interpolation_mode>` встановлено на :ref:`GRADIENT_INTERPOLATE_CONSTANT<class_Gradient_constant_GRADIENT_INTERPOLATE_CONSTANT>`.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_sample:
.. rst-class:: classref-method
:ref:`Color<class_Color>` **sample**\ (\ offset\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Gradient_method_sample>`
Повертає інтерпольований колір, заданий параметром ``offset``. Значення ``offset`` має бути між ``0.0`` та ``1.0`` (включно). Використання значення, меншого за ``0.0``, поверне той самий колір, що й ``0.0``, а використання значення, більшого за ``1.0``, поверне той самий колір, що й ``1.0``. Якщо ваше вхідне значення не знаходиться в цьому діапазоні, спробуйте використати :ref:`@GlobalScope.remap()<class_@GlobalScope_method_remap>` для вхідного значення з вихідними значеннями, встановленими на ``0.0`` та ``1.0``.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_set_color:
.. rst-class:: classref-method
|void| **set_color**\ (\ point\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Gradient_method_set_color>`
Встановлює колір градієнта за індексом ``point``.
.. rst-class:: classref-item-separator
----
.. _class_Gradient_method_set_offset:
.. rst-class:: classref-method
|void| **set_offset**\ (\ point\: :ref:`int<class_int>`, offset\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Gradient_method_set_offset>`
Встановлює зміщення для кольору градієнта за індексом ``point``.
.. |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 (Значення не повертається.)`