@moxijs/core - v0.3.4
    Preparing search index...

    Class ParallaxLayer

    Individual parallax layer that scrolls at a different speed based on scrollScale.

    Inspired by Godot's ParallaxLayer node.

    The scrollScale property controls how fast the layer moves relative to the camera:

    • 0.0 = Static (doesn't move with camera, good for UI/HUD)
    • 0.2 = Slow (appears far away, like sky)
    • 0.5 = Medium (mid-ground elements)
    • 0.9 = Fast (foreground elements)
    • 1.0 = Moves with camera (game entities)
    • 1.0 = Faster than camera (reverse parallax effect)

    const layer = new ParallaxLayer({
    scrollScale: new PIXI.Point(0.5, 0.5), // Half camera speed
    scrollOffset: new PIXI.Point(0, 0)
    });

    // Add sprites to the layer
    const sprite = new PIXI.Sprite(texture);
    layer.addChild(sprite);

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    mirroring: boolean = false
    moxiEntity: MoxiEntity<Container<ContainerChild>>

    The MoxiEntity instance managing logic for this container

    repeatSize: Point = ...
    scrollOffset: Point = ...
    scrollScale: Point = ...

    Methods

    • Update layer position based on camera movement. Called by ParallaxBackgroundLogic each frame.

      Parameters

      • cameraPos: Point

        Current camera position in world space

      • cameraScale: Point

        Current camera scale/zoom

      • backgroundOffset: Point

        Global background scroll offset

      Returns void