Sign in to follow this  
makalu

How to tween scale in Phaser 3

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
});

 

 

Share this post


Link to post
Share on other sites

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
});

Share this post


Link to post
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. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.