class_parallaxlayer.rst 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ParallaxLayer.xml.
  6. .. _class_ParallaxLayer:
  7. ParallaxLayer
  8. =============
  9. **Deprecated:** Use the :ref:`Parallax2D<class_Parallax2D>` node instead.
  10. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  11. A parallax scrolling layer to be used with :ref:`ParallaxBackground<class_ParallaxBackground>`.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. A ParallaxLayer must be the child of a :ref:`ParallaxBackground<class_ParallaxBackground>` node. Each ParallaxLayer can be set to move at different speeds relative to the camera movement or the :ref:`ParallaxBackground.scroll_offset<class_ParallaxBackground_property_scroll_offset>` value.
  16. This node's children will be affected by its scroll offset.
  17. \ **Note:** Any changes to this node's position and scale made after it enters the scene will be ignored.
  18. .. rst-class:: classref-reftable-group
  19. Properties
  20. ----------
  21. .. table::
  22. :widths: auto
  23. +---------------------------------------------------------------------+------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  24. | :ref:`Vector2<class_Vector2>` | :ref:`motion_mirroring<class_ParallaxLayer_property_motion_mirroring>` | ``Vector2(0, 0)`` |
  25. +---------------------------------------------------------------------+------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  26. | :ref:`Vector2<class_Vector2>` | :ref:`motion_offset<class_ParallaxLayer_property_motion_offset>` | ``Vector2(0, 0)`` |
  27. +---------------------------------------------------------------------+------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  28. | :ref:`Vector2<class_Vector2>` | :ref:`motion_scale<class_ParallaxLayer_property_motion_scale>` | ``Vector2(1, 1)`` |
  29. +---------------------------------------------------------------------+------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  30. | :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` | physics_interpolation_mode | ``2`` (overrides :ref:`Node<class_Node_property_physics_interpolation_mode>`) |
  31. +---------------------------------------------------------------------+------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  32. .. rst-class:: classref-section-separator
  33. ----
  34. .. rst-class:: classref-descriptions-group
  35. Property Descriptions
  36. ---------------------
  37. .. _class_ParallaxLayer_property_motion_mirroring:
  38. .. rst-class:: classref-property
  39. :ref:`Vector2<class_Vector2>` **motion_mirroring** = ``Vector2(0, 0)`` :ref:`🔗<class_ParallaxLayer_property_motion_mirroring>`
  40. .. rst-class:: classref-property-setget
  41. - |void| **set_mirroring**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  42. - :ref:`Vector2<class_Vector2>` **get_mirroring**\ (\ )
  43. The interval, in pixels, at which the **ParallaxLayer** is drawn repeatedly. Useful for creating an infinitely scrolling background. If an axis is set to ``0``, the **ParallaxLayer** will be drawn only once along that direction.
  44. \ **Note:** If you want the repetition to pixel-perfect match a :ref:`Texture2D<class_Texture2D>` displayed by a child node, you should account for any scale applied to the texture when defining this interval. For example, if you use a child :ref:`Sprite2D<class_Sprite2D>` scaled to ``0.5`` to display a 600x600 texture, and want this sprite to be repeated continuously horizontally, you should set the mirroring to ``Vector2(300, 0)``.
  45. \ **Note:** If the length of the viewport axis is bigger than twice the repeated axis size, it will not repeat infinitely, as the parallax layer only draws 2 instances of the layer at any given time. The visibility window is calculated from the parent :ref:`ParallaxBackground<class_ParallaxBackground>`'s position, not the layer's own position. So, if you use mirroring, **do not** change the **ParallaxLayer** position relative to its parent. Instead, if you need to adjust the background's position, set the :ref:`CanvasLayer.offset<class_CanvasLayer_property_offset>` property in the parent :ref:`ParallaxBackground<class_ParallaxBackground>`.
  46. \ **Note:** Despite the name, the layer will not be mirrored, it will only be repeated.
  47. .. rst-class:: classref-item-separator
  48. ----
  49. .. _class_ParallaxLayer_property_motion_offset:
  50. .. rst-class:: classref-property
  51. :ref:`Vector2<class_Vector2>` **motion_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_ParallaxLayer_property_motion_offset>`
  52. .. rst-class:: classref-property-setget
  53. - |void| **set_motion_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  54. - :ref:`Vector2<class_Vector2>` **get_motion_offset**\ (\ )
  55. The ParallaxLayer's offset relative to the parent ParallaxBackground's :ref:`ParallaxBackground.scroll_offset<class_ParallaxBackground_property_scroll_offset>`.
  56. .. rst-class:: classref-item-separator
  57. ----
  58. .. _class_ParallaxLayer_property_motion_scale:
  59. .. rst-class:: classref-property
  60. :ref:`Vector2<class_Vector2>` **motion_scale** = ``Vector2(1, 1)`` :ref:`🔗<class_ParallaxLayer_property_motion_scale>`
  61. .. rst-class:: classref-property-setget
  62. - |void| **set_motion_scale**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  63. - :ref:`Vector2<class_Vector2>` **get_motion_scale**\ (\ )
  64. Multiplies the ParallaxLayer's motion. If an axis is set to ``0``, it will not scroll.
  65. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  66. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  67. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  68. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  69. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  70. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  71. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  72. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  73. .. |void| replace:: :abbr:`void (No return value.)`