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:
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 layerconst sprite = new PIXI.Sprite(texture);layer.addChild(sprite); Copy
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 layerconst sprite = new PIXI.Sprite(texture);layer.addChild(sprite);
The MoxiEntity instance managing logic for this container
Update layer position based on camera movement. Called by ParallaxBackgroundLogic each frame.
Current camera position in world space
Current camera scale/zoom
Global background scroll offset
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:
Example