首页 > 解决方案 > Phaser (3.24.1) 如何补间 TileSprite?

问题描述

我想通过 tilePositionX 和 tilePositionY 对 TileSprite 进行补间。

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"

标签: javascriptphaser-frameworktween

解决方案


示例1 2

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

推荐阅读