Jump to content

How to tween scale in Phaser 3


makalu
 Share

Recommended Posts

In Phaser 2 we could tween scale like in the topic linked below.  How is this done in Phaser 3?

It looks like the sprite Scale property has changed to scaleX and scaleY, which I thought maybe I could tween like this, but this didn't seem to work:

this.scene.tweens.add({
targets     : [ this.scaleX, this.scaleY ],
x: 10,
y: 10,
ease        : 'Linear',
duration    : duration,
yoyo        : false,
repeat      : 0,
callbackScope   : this
});

 

 

Link to comment
Share on other sites

On 10/21/2018 at 4:51 AM, makalu said:

Just figured it out, using scaleX and scaleY... 


this.scene.tweens.add({
  targets     : [ this ],
  scaleX: 10,
  scaleY: 10,
  ease        : 'Linear',
  duration    : duration,
  yoyo        : false,
  repeat      : 0,
  callbackScope   : this
});
this.scene.tweens.add({
  targets     : this ,
  scale       : 10
  ease        : 'Linear',
  duration    : 500,
});

You can simplify it.
targets only needs to be an array if it's multiple targets.
scale: 1 does both X&Y
yoyo default is false, as 0 of repeat and "this" of callbackScope. :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...