makotok/Hanappe — pull request #29 by EricYim (2013-02-16 05:20:10+00:00)
Title: New features to Animation.

I've made the following changes to hanappe-framework:

- Add abilities to pause and resume animations.
- Change behaviour so that manually stopping an animation will not trigger the onComplete callback.
- Improve response to the changing of throttle, especially if the animation has nested parallel/sequence/loop.
- Update animation_sample.lua to demonstrate the above changes.

Two things require extra attention:
1. It's related to the definition of Animation.isRunning. In my modification, with the introduction of Animation.isPaused, isRunning becomes more like MOAIAction.isActive rather than MOAIAction.isBusy. For example, when an animation, a, is paused, a:isRunning() and a:isPaused() will both return true. This may not be a problem, but I can also understand if someone finds the naming confusing.
2. In the original code, calling stop() on an animation will only stop the currentCommand of each registered context. For example, in the animation sample, calling anim2:stop() will stop the character from translating, but not sprite index animating. I'm not sure what the original intension was, but I find the behaviour strange. So in my modification, calling stop() will stop all registered commands (i.e. in self._commands). The same behaviour applies to pause() and resume().