Anderberg Posted July 26, 2014 Share Posted July 26, 2014 I am having trouble when tweening the frame of an atlas sprite. The issue appears on the iPad, but not on the computer. I am using GSAP's TweenMax and here is parts of the code:new TweenMax(this.rightWing, 5, { frame: this.rightWing.frame + 4, ease: SteppedEase.config(4)})This should tween the rightWing over 5 seconds and change frame from 1 to 5, in 4 steps. It works perfectly on all of my browsers on my computer, but not on the iPad, it only shows the first frame. I have debugged it and the frame does change, but the graphics do not update. Have anyone encountered a similar issue? Link to comment Share on other sites More sharing options...
lewster32 Posted July 26, 2014 Share Posted July 26, 2014 Does it work when setting the render mode to Phaser.CANVAS on your desktop browsers? Also, in TweenMax you have roundProps too, I don't know if that will fix it but I suspect for this you'd be better off using that since you're just wanting integers, rather than specifically defined steps:new TweenMax(this.rightWing, 5, { frame: this.rightWing.frame + 4, roundProps: ['frame']}) Link to comment Share on other sites More sharing options...
Anderberg Posted July 26, 2014 Author Share Posted July 26, 2014 It does not work when using Phaser.CANVAS. Do you know why that is? I realized that I have another animation that uses the same atlas and that one works:TweenMax.to(this.beak, 0.2, { frame: this.beak.frame+1, roundProps: 'frame', ease: Power0.easeInOut, repeat: -1, yoyo: true});(Also, thanks for pointing out the roundProps!) Link to comment Share on other sites More sharing options...
lewster32 Posted July 26, 2014 Share Posted July 26, 2014 Hmm, I'm stumped - especially if you have another one that's working. Can you swap them around to check if it's where you're doing it that's causing the issue? Link to comment Share on other sites More sharing options...
Anderberg Posted July 26, 2014 Author Share Posted July 26, 2014 I've been doing a lot of digging and it seems that the issue is that I tint the sprite. Without tinting it the frame graphics will update accordingly. Does that spark any idea of where the problem might lie? Edit:I added a minimal tint change when updating the frame, it now seems to work. However it is of course not optimal to do unnecessary tints. In other words: Changing frame when in CANVAS mode works when...... no tint has been applied.... you change the frame and the tint. Link to comment Share on other sites More sharing options...
lewster32 Posted July 26, 2014 Share Posted July 26, 2014 That sounds like a possible bug to me then - are you using the latest version of Phaser (2.0.7)? If so, I'd maybe put a small test case together in Codepen or JSFiddle and submit an issue on Github. jdnichollsc 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted January 15, 2015 Share Posted January 15, 2015 Hi guys! ¿What happened with this bug? Regards, Nicholls Link to comment Share on other sites More sharing options...
jdnichollsc Posted January 16, 2015 Share Posted January 16, 2015 Hi guys! Look at this answer: http://greensock.com/forums/topic/11177-animate-phaser-sprite-with-tweenmax-frame-by-frame/var frames = this.player.animations.frameData.getFrames();TweenMax.to(this.player, 2, { frame: frames[frames.length - 1].index, roundProps: 'frame', ease: Linear.easeNone, repeat: -1, yoyo: true}); Regards, Nicholls Link to comment Share on other sites More sharing options...
Anderberg Posted January 17, 2015 Author Share Posted January 17, 2015 Hi Nicholls!Great that you took another look at it! I haven't been able to try your solution since my code has changed so much since this issue was reported.The tinting-then-changing-frame issue is still a problem in Phaser (Canvas only), so I am not quite positive that your solution actually fixes that. Is your sprite tinted? Are you able to change frame without re-tinting it? Link to comment Share on other sites More sharing options...
jdnichollsc Posted January 17, 2015 Share Posted January 17, 2015 Hi! See my example: http://codepen.io/jdnichollsc/pen/ZYeWEr Regards, Nicholls Link to comment Share on other sites More sharing options...
Anderberg Posted January 22, 2015 Author Share Posted January 22, 2015 I took the liberty of changing your pen to expose the error: http://codepen.io/AnderbergE/pen/ByZBLy I've changed:* Game runs on CANVAS, not AUTO. The bug is not shown when you use webGL.* Added a tint to the ninja. (I also found that I created a codepen with the issue before: http://codepen.io/AnderbergE/pen/GpiAe) jdnichollsc 1 Link to comment Share on other sites More sharing options...
Recommended Posts