Phaser API Documentation

scrollFactorX: number


The horizontal scroll factor of this Container.

The scroll factor controls the influence of the movement of a Camera upon this Container.

When a camera scrolls it will change the location at which this Container is rendered on-screen. It does not change the Containers actual position values.

For a Container, setting this value will only update the Container itself, not its children. If you wish to change the scrollFactor of the children as well, use the setScrollFactor method.

A value of 1 means it will move exactly in sync with a camera. A value of 0 means it will not move at all, even if the camera moves. Other values control the degree to which the camera movement is mapped to this Container.

Please be aware that scroll factor values other than 1 are not taken in to consideration when calculating physics collisions. Bodies always collide based on their world position, but changing the scroll factor is a visual adjustment to where the textures are rendered, which can offset them from physics bodies if not accounted for in your code.

Default: 1
Since: 3.4.0