kittykatattack / hexi

Make games the fun way!
MIT License
551 stars 83 forks source link

How to stop Pulse Tween effect? #51

Open Digital-Odyssey opened 6 years ago

Digital-Odyssey commented 6 years ago

Hi,

First off just i want to say i purchased both "Advanced Game with HTML5 & Javascript" and "The Advanced Game Developers Toolkit" as a follow up to the first book and they are both fantastic books.

I just have a quick question - is it possible to get the Pulse tween effect to stop after 3 pulses? If so how i would i go about doing it?

Thanks, appreciate any help you can provide.

kittykatattack commented 6 years ago

@PulsarMedia Thank you for posting this! There's isn't a feature to set the number of iterations, but I suppose you could count the number of frames that have elapsed, and stop the animation when that number reaches your target?

Digital-Odyssey commented 6 years ago

What would be your recommended approach to counting the frames? I am guessing i would need to run an interval loop to count them?

I tried using the onComplete method with a counter variable but that didn't seem to work.

Thanks for getting back to me.

kittykatattack commented 6 years ago

@PulsarMedia Probably just a variable to track the number of frames elapsed since the beginning of the tween, and stop the tween when your target number is reached?