Ninjadoodle Posted January 22, 2018 Share Posted January 22, 2018 Hi @enpu I'm trying to tween the scale of a container, and I've tried every possible combination but nothing seems to work. Setting the scale like this works fine ... game.scene.mg.scale.set(2); however when I try using a tween, nothing happens ... game.Timer.add(250, function() { game.Tween.add(game.scene.mg, { scale: 2 }, 500, { delay: 100, easing: 'Back.In', }).start(); }); I've also tried -> game.Tween.add(game.scene.mg.scale as well as using scaleX: 2 and scaleY: 2 for the tween. Thanks heaps in advance! Quote Link to comment Share on other sites More sharing options...
enpu Posted January 22, 2018 Share Posted January 22, 2018 @Ninjadoodle https://www.panda2.io/docs/api/Container If you look at Container documentation, you can see that the scale property is Vector. https://www.panda2.io/docs/api/Vector Then if you take a look at Vector class, you can see it has properties x and y. Those are the properties that you should tween. https://www.panda2.io/playground#tween-basic Just like in this basic Tween example we are tweening position property's x and y values, and position is also Vector. So it's just the same for scale: var tween = new game.Tween(container.scale); tween.to({ x: 2, y: 2 }, 2000); // Scale container to 200% in 2 seconds tween.start(); Makes sense? Ninjadoodle 1 Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted January 22, 2018 Author Share Posted January 22, 2018 Ahhh, yup makes sense now Eventually I'll learn how to use the docs properly lol. Thanks for the explanation! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.