Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
ParallaxLayer
已棄用: Use the Parallax2D node instead.
繼承: Node2D < CanvasItem < Node < Object
使用 ParallaxBackground 的視差滾動層。
說明
ParallaxLayer 必須是 ParallaxBackground 節點的子節點。每個 ParallaxLayer 都可以設定為相對於相機移動或 ParallaxBackground.scroll_offset 值。
該節點的子節點將受其滾動偏移量的影響。
注意:當該節點進入場景後,對其位置和比例的任何改變都將被忽略。
屬性
|
||
|
||
|
||
physics_interpolation_mode |
|
屬性說明
Vector2 motion_mirroring = Vector2(0, 0) 🔗
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.
Note: If you want the repetition to pixel-perfect match a 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 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).
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 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 CanvasLayer.offset property in the parent ParallaxBackground.
Note: Despite the name, the layer will not be mirrored, it will only be repeated.
Vector2 motion_offset = Vector2(0, 0) 🔗
該 ParallaxLayer 的偏移量,相對於父 ParallaxBackground 的 ParallaxBackground.scroll_offset。
Vector2 motion_scale = Vector2(1, 1) 🔗
複製視差圖層的運動。如果一個軸被設定為 0,它將不會滾動。