mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
classref: Sync with current master branch (f87858a8f)
This commit is contained in:
@@ -14,124 +14,141 @@ ParallaxBackground
|
||||
|
||||
A node used to create a parallax scrolling background.
|
||||
|
||||
.. rst-class:: classref-introduction-group
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
A ParallaxBackground uses one or more :ref:`ParallaxLayer<class_ParallaxLayer>` child nodes to create a parallax effect. Each :ref:`ParallaxLayer<class_ParallaxLayer>` can move at a different speed using :ref:`ParallaxLayer.motion_offset<class_ParallaxLayer_property_motion_offset>`. This creates an illusion of depth in a 2D game. If not used with a :ref:`Camera2D<class_Camera2D>`, you must manually calculate the :ref:`scroll_offset<class_ParallaxBackground_property_scroll_offset>`.
|
||||
|
||||
.. rst-class:: classref-reftable-group
|
||||
|
||||
Properties
|
||||
----------
|
||||
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | layer | ``-100`` (overrides :ref:`CanvasLayer<class_CanvasLayer_property_layer>`) |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_offset<class_ParallaxBackground_property_scroll_base_offset>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_scale<class_ParallaxBackground_property_scroll_base_scale>` | ``Vector2(1, 1)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`scroll_ignore_camera_zoom<class_ParallaxBackground_property_scroll_ignore_camera_zoom>` | ``false`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_begin<class_ParallaxBackground_property_scroll_limit_begin>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_end<class_ParallaxBackground_property_scroll_limit_end>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_offset<class_ParallaxBackground_property_scroll_offset>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | layer | ``-100`` (overrides :ref:`CanvasLayer<class_CanvasLayer_property_layer>`) |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_offset<class_ParallaxBackground_property_scroll_base_offset>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_scale<class_ParallaxBackground_property_scroll_base_scale>` | ``Vector2(1, 1)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`scroll_ignore_camera_zoom<class_ParallaxBackground_property_scroll_ignore_camera_zoom>` | ``false`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_begin<class_ParallaxBackground_property_scroll_limit_begin>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_end<class_ParallaxBackground_property_scroll_limit_end>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`scroll_offset<class_ParallaxBackground_property_scroll_offset>` | ``Vector2(0, 0)`` |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
----
|
||||
|
||||
.. rst-class:: classref-descriptions-group
|
||||
|
||||
Property Descriptions
|
||||
---------------------
|
||||
|
||||
.. _class_ParallaxBackground_property_scroll_base_offset:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **scroll_base_offset**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+-------------------------------+
|
||||
| *Default* | ``Vector2(0, 0)`` |
|
||||
+-----------+-------------------------------+
|
||||
| *Setter* | set_scroll_base_offset(value) |
|
||||
+-----------+-------------------------------+
|
||||
| *Getter* | get_scroll_base_offset() |
|
||||
+-----------+-------------------------------+
|
||||
:ref:`Vector2<class_Vector2>` **scroll_base_offset** = ``Vector2(0, 0)``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_scroll_base_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
|
||||
- :ref:`Vector2<class_Vector2>` **get_scroll_base_offset** **(** **)**
|
||||
|
||||
The base position offset for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_ParallaxBackground_property_scroll_base_scale:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **scroll_base_scale**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+------------------------------+
|
||||
| *Default* | ``Vector2(1, 1)`` |
|
||||
+-----------+------------------------------+
|
||||
| *Setter* | set_scroll_base_scale(value) |
|
||||
+-----------+------------------------------+
|
||||
| *Getter* | get_scroll_base_scale() |
|
||||
+-----------+------------------------------+
|
||||
:ref:`Vector2<class_Vector2>` **scroll_base_scale** = ``Vector2(1, 1)``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_scroll_base_scale** **(** :ref:`Vector2<class_Vector2>` value **)**
|
||||
- :ref:`Vector2<class_Vector2>` **get_scroll_base_scale** **(** **)**
|
||||
|
||||
The base motion scale for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_ParallaxBackground_property_scroll_ignore_camera_zoom:
|
||||
|
||||
- :ref:`bool<class_bool>` **scroll_ignore_camera_zoom**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+-------------------------------+
|
||||
| *Default* | ``false`` |
|
||||
+-----------+-------------------------------+
|
||||
| *Setter* | set_ignore_camera_zoom(value) |
|
||||
+-----------+-------------------------------+
|
||||
| *Getter* | is_ignore_camera_zoom() |
|
||||
+-----------+-------------------------------+
|
||||
:ref:`bool<class_bool>` **scroll_ignore_camera_zoom** = ``false``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_ignore_camera_zoom** **(** :ref:`bool<class_bool>` value **)**
|
||||
- :ref:`bool<class_bool>` **is_ignore_camera_zoom** **(** **)**
|
||||
|
||||
If ``true``, elements in :ref:`ParallaxLayer<class_ParallaxLayer>` child aren't affected by the zoom level of the camera.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_ParallaxBackground_property_scroll_limit_begin:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **scroll_limit_begin**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+------------------------+
|
||||
| *Default* | ``Vector2(0, 0)`` |
|
||||
+-----------+------------------------+
|
||||
| *Setter* | set_limit_begin(value) |
|
||||
+-----------+------------------------+
|
||||
| *Getter* | get_limit_begin() |
|
||||
+-----------+------------------------+
|
||||
:ref:`Vector2<class_Vector2>` **scroll_limit_begin** = ``Vector2(0, 0)``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_limit_begin** **(** :ref:`Vector2<class_Vector2>` value **)**
|
||||
- :ref:`Vector2<class_Vector2>` **get_limit_begin** **(** **)**
|
||||
|
||||
Top-left limits for scrolling to begin. If the camera is outside of this limit, the background will stop scrolling. Must be lower than :ref:`scroll_limit_end<class_ParallaxBackground_property_scroll_limit_end>` to work.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_ParallaxBackground_property_scroll_limit_end:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **scroll_limit_end**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+----------------------+
|
||||
| *Default* | ``Vector2(0, 0)`` |
|
||||
+-----------+----------------------+
|
||||
| *Setter* | set_limit_end(value) |
|
||||
+-----------+----------------------+
|
||||
| *Getter* | get_limit_end() |
|
||||
+-----------+----------------------+
|
||||
:ref:`Vector2<class_Vector2>` **scroll_limit_end** = ``Vector2(0, 0)``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_limit_end** **(** :ref:`Vector2<class_Vector2>` value **)**
|
||||
- :ref:`Vector2<class_Vector2>` **get_limit_end** **(** **)**
|
||||
|
||||
Bottom-right limits for scrolling to end. If the camera is outside of this limit, the background will stop scrolling. Must be higher than :ref:`scroll_limit_begin<class_ParallaxBackground_property_scroll_limit_begin>` to work.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_ParallaxBackground_property_scroll_offset:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **scroll_offset**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+--------------------------+
|
||||
| *Default* | ``Vector2(0, 0)`` |
|
||||
+-----------+--------------------------+
|
||||
| *Setter* | set_scroll_offset(value) |
|
||||
+-----------+--------------------------+
|
||||
| *Getter* | get_scroll_offset() |
|
||||
+-----------+--------------------------+
|
||||
:ref:`Vector2<class_Vector2>` **scroll_offset** = ``Vector2(0, 0)``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_scroll_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
|
||||
- :ref:`Vector2<class_Vector2>` **get_scroll_offset** **(** **)**
|
||||
|
||||
The ParallaxBackground's scroll value. Calculated automatically when using a :ref:`Camera2D<class_Camera2D>`, but can be used to manually manage scrolling when no camera is present.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user