【问题标题】:Using Phaser, trying to tween text using Js使用 Phaser,尝试使用 Js 补间文本
【发布时间】:2016-01-30 22:08:56
【问题描述】:

不知道如何使用 Phaser 对文本进行补间。这是我的代码:

text1 = "Home";
textStyle1 = {font: '150px Tahoma', fill:'#ffffff', align: 'center'};
textHolder1 = game.add.text(0,0,text1,textStyle1);

textTween1 = game.add.tween(text1);
textTween1.to({x:1000},5000, 'Linear',true, 0);

我只是想让文本移动。

【问题讨论】:

    标签: javascript text tween phaser-framework


    【解决方案1】:

    您的补间当前已添加到文本字符串中。您需要将补间添加到您的 Phaser.Text 对象 textHolder1

    var textTween1 = game.add.tween(textHolder1);
    textTween1.to({ x: 1000 }, 5000, Phaser.Easing.Linear.None, true, 0);
    

    我可能还建议将补间定义切换为 Phaser.Easing.Linear.None 而不是 'Linear',就像我在上面所做的那样。它不会影响功能,但可能会对您有所帮助。

    简单的错误,通常最容易被忽视。 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-22
      • 1970-01-01
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多