ParallaxLayer

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

A ParallaxLayer must be the child of a ParallaxBackground node. Each ParallaxLayer can be set to move at different speeds relative to the camera movement or the ParallaxBackground.ScrollOffset value.

This node's children will be affected by its scroll offset.

Note: Any changes to this node's position and scale made after it enters the scene will be ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsParallaxLayer() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode2D

func (self *Extension[T]) AsNode2D() Node2D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsParallaxLayer

func (self *Extension[T]) AsParallaxLayer() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.ParallaxLayer

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode2D

func (self Instance) AsNode2D() Node2D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsParallaxLayer

func (self Instance) AsParallaxLayer() Instance

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MotionMirroring

func (self Instance) MotionMirroring() Vector2.XY

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.

func (Instance) MotionOffset

func (self Instance) MotionOffset() Vector2.XY

The ParallaxLayer's offset relative to the parent ParallaxBackground's ParallaxBackground.ScrollOffset.

func (Instance) MotionScale

func (self Instance) MotionScale() Vector2.XY

Multiplies the ParallaxLayer's motion. If an axis is set to 0, it will not scroll.

func (Instance) SetMotionMirroring

func (self Instance) SetMotionMirroring(value Vector2.XY)

SetMotionMirroring sets the property returned by [GetMirroring].

func (Instance) SetMotionOffset

func (self Instance) SetMotionOffset(value Vector2.XY)

SetMotionOffset sets the property returned by [GetMotionOffset].

func (Instance) SetMotionScale

func (self Instance) SetMotionScale(value Vector2.XY)

SetMotionScale sets the property returned by [GetMotionScale].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL