Search code examples
javascriptphaser-frameworktween

Phaser (3.24.1) How to tween a TileSprite?


I would like to tween a TileSprite by tilePositionX and tilePositionY.

scene.load.image('sky', 'assets/images/sky.png');
const sky = scene.add.tileSprite(0, 0, 1000, 600, 'sky');
scene.add.tween(sky); // "Uncaught TypeError: n is null"

Solution

  • Examples 1 2

    scene.tweens.add({
        targets: sky,
        tilePositionY: { from: 0, to: -180 },
        ease: 'Linear',
        duration: 5000,
        repeat: 0,
        yoyo: false
    });