Ninjadoodle Posted September 14, 2014 Report Share Posted September 14, 2014 Hi guys What is the best way of tweening a sprites scale? Should I tween the width and height separately or is there some sort of percentage value? I tried using scale:0.5, but it doesn't seem to work. Thank you for any suggestions Link to comment Share on other sites More sharing options...
rich Posted September 14, 2014 Report Share Posted September 14, 2014 Removed: Sorry, wrong forum Link to comment Share on other sites More sharing options...
SebastianNette Posted September 14, 2014 Report Share Posted September 14, 2014 I haven't looked at panda's code (never worked with it), but since it's build on pixi:If you want to tween the scale, you have to tween the scale.x and the scale.y property.You can't just tween "scale". Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 14, 2014 Author Report Share Posted September 14, 2014 Hi @SebastianNette Thank you for your help I still can't seem to get the right syntax to get this working ... I can tween the width: and height: but I tried writing up the scale.x in many different ways and can't get it to work. I tried looking at the tween docs (the tween engine, panda's was based on, but can't find any info). Link to comment Share on other sites More sharing options...
SebastianNette Posted September 14, 2014 Report Share Posted September 14, 2014 Does this work?var tween = new game.Tween(sprite.scale);tween.to({x:0.5, y:0.5}, 1000);tween.start(); Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 14, 2014 Author Report Share Posted September 14, 2014 Oh I see! I'm trying to write my tweens inline because I have a lot of them and it makes things simpler. game.scene.addTween(infoFind1, {x:300}, 250, {delay:200, easing:game.Tween.Easing.Back.In}).start(); But I think my way of writing them might conflict with the way the engine works.From your example, it looks like I have to set the property I'm tweening before a do so. I can't think of a way to write up your example in the format I'm using. Thank you again for your help! I really appreciate it Link to comment Share on other sites More sharing options...
SebastianNette Posted September 14, 2014 Report Share Posted September 14, 2014 It should behave the same. Important is that you tween the scale property.new game.Tween(sprite.scale) So instead of infoFind1 you would tween the values of infoFind1.scale Ninjadoodle 1 Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 14, 2014 Author Report Share Posted September 14, 2014 Awesome! It works perfectly game.scene.addTween(sprite.scale, {x:0.9, y:0.9}, 250, {delay:0, easing:game.Tween.Easing.Back.In}).start(); Thank you heaps for taking the time out to help! I should send you a six pack of beer haha! Link to comment Share on other sites More sharing options...
Recommended Posts