I can't figure out how to play a non looping animation a second time after it plays once. I set this parameter to false, the non looping animation plays as expected, but I can't get it to play a second time. The animation seems to only load frame 1 and stops.
walkAnimation:apply(skeleton, event.time / 1000, false) --set to true "LOOPS" animationIt seems if looping is set to false, a variable is set somewhere when a non looping animation completes that is not being reset on loading the next non looping animation.
The problem may be in my code to load animations, but my code plays looping animations properly. I only have problems loading successive non looping animations.
Any help on this would be appreciated.
I realize the suggestion below would be a "Wish List" feature in the Corona runtimes.
An nice option would be to change the boolean (true/false) in the paramenter to a number. 0 = loop infinitely (which is "true" now), 1 = 1x loop, 2 = 2x loop, -1 = stop at frame 1, -10 = stop at frame 10, etc.
Also, I made this comment in another post, but didn't get a response from Nate:
This would be a "Wish List" feature to be added to the Corona runtimes.
I'm working in Corona SDK and I am wondering if I can access the keyframes so I can stop the animation at any frame or keyframe location. I could then start the animation from that frame and continue the animation to another frame on the timeline. I would also like to be able to play the animation in reverse, let's say from frame 60 back to 40.
I've got a cannon and I'd like to control it's up and down movements in order for it to aim. The user touches the cannon it loads and becomes active, the further the user drags back away from the cannon, the more powerful the shot. They can adjust their aim, if they drag back and down, the cannon fires up (opposite direction) and when they drag back and up, the cannon aims and fires downward, opposite of the drag.
If I could access the frames and also play the animation in reverse, the cannon would aim up and down relative to the users drag, creating a very interactive animation.
An example somewhere in code would be:
if skeleton.frame == 45 then
stopAnimation() --remove runtime listener
or if last frame in animation is 60 then
if skeleton.frame == 60 then
Obviously the ability to utilize keyframes would be the most versatile, but at a minimum, an AnimationComplete = true return flag or the option to add an onComplete() as a parameter would be nice when an animation completes (last frame) so I can initiate the next animation or call a function to do something else. Right now I'm using a timer to start the next animation. This is doable, but requires converting the specific animations frames into miliseconds and creating a specific timer for each transition of animations. If the animation is stopped during it's execution for some reason (hero was destroyed), the specific timer calling the next animation needs to be canceled and nil'd.