:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ParallaxBackground.xml. .. _class_ParallaxBackground: ParallaxBackground ================== **Inherits:** :ref:`CanvasLayer` **<** :ref:`Node` **<** :ref:`Object` A node used to create a parallax scrolling background. .. rst-class:: classref-introduction-group Description ----------- A ParallaxBackground uses one or more :ref:`ParallaxLayer` child nodes to create a parallax effect. Each :ref:`ParallaxLayer` can move at a different speed using :ref:`ParallaxLayer.motion_offset`. This creates an illusion of depth in a 2D game. If not used with a :ref:`Camera2D`, you must manually calculate the :ref:`scroll_offset`. \ **Note:** Each **ParallaxBackground** is drawn on one specific :ref:`Viewport` and cannot be shared between multiple :ref:`Viewport`\ s, see :ref:`CanvasLayer.custom_viewport`. When using multiple :ref:`Viewport`\ s, for example in a split-screen game, you need create an individual **ParallaxBackground** for each :ref:`Viewport` you want it to be drawn on. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`int` | layer | ``-100`` (overrides :ref:`CanvasLayer`) | +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`scroll_base_offset` | ``Vector2(0, 0)`` | +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`scroll_base_scale` | ``Vector2(1, 1)`` | +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`bool` | :ref:`scroll_ignore_camera_zoom` | ``false`` | +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`scroll_limit_begin` | ``Vector2(0, 0)`` | +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`scroll_limit_end` | ``Vector2(0, 0)`` | +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`scroll_offset` | ``Vector2(0, 0)`` | +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_ParallaxBackground_property_scroll_base_offset: .. rst-class:: classref-property :ref:`Vector2` **scroll_base_offset** = ``Vector2(0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_scroll_base_offset**\ (\ value\: :ref:`Vector2`\ ) - :ref:`Vector2` **get_scroll_base_offset**\ (\ ) The base position offset for all :ref:`ParallaxLayer` children. .. rst-class:: classref-item-separator ---- .. _class_ParallaxBackground_property_scroll_base_scale: .. rst-class:: classref-property :ref:`Vector2` **scroll_base_scale** = ``Vector2(1, 1)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_scroll_base_scale**\ (\ value\: :ref:`Vector2`\ ) - :ref:`Vector2` **get_scroll_base_scale**\ (\ ) The base motion scale for all :ref:`ParallaxLayer` children. .. rst-class:: classref-item-separator ---- .. _class_ParallaxBackground_property_scroll_ignore_camera_zoom: .. rst-class:: classref-property :ref:`bool` **scroll_ignore_camera_zoom** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_ignore_camera_zoom**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_ignore_camera_zoom**\ (\ ) If ``true``, elements in :ref:`ParallaxLayer` child aren't affected by the zoom level of the camera. .. rst-class:: classref-item-separator ---- .. _class_ParallaxBackground_property_scroll_limit_begin: .. rst-class:: classref-property :ref:`Vector2` **scroll_limit_begin** = ``Vector2(0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_limit_begin**\ (\ value\: :ref:`Vector2`\ ) - :ref:`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` to work. .. rst-class:: classref-item-separator ---- .. _class_ParallaxBackground_property_scroll_limit_end: .. rst-class:: classref-property :ref:`Vector2` **scroll_limit_end** = ``Vector2(0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_limit_end**\ (\ value\: :ref:`Vector2`\ ) - :ref:`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` to work. .. rst-class:: classref-item-separator ---- .. _class_ParallaxBackground_property_scroll_offset: .. rst-class:: classref-property :ref:`Vector2` **scroll_offset** = ``Vector2(0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_scroll_offset**\ (\ value\: :ref:`Vector2`\ ) - :ref:`Vector2` **get_scroll_offset**\ (\ ) The ParallaxBackground's scroll value. Calculated automatically when using a :ref:`Camera2D`, but can be used to manually manage scrolling when no camera is present. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`