prime31/GoKit — pull request #43 by zapdot (2014-03-06 02:10:41+00:00)
Title: Event overhaul and Flow performance improvements.

* Fixed some naming and formatting inconsistencies.
* Changed log messages that resulted in tweens not being added to collections from normal log messages to error messages.
* GoTweenChain.prepend() did not place the item in the proper position in the List
* Collections (Flows/Chains) had some inconsistencies on how they computed totalDuration.
* Collections (Flows/Chains) that were reversed or looping back on PingPong did not have their tweenFlowItems processing in the proper order. Since tweenFlowItems are sorted based on startTime, it makes sense to iterate over the list backwards when the tween is moving backwards.
* AbstractGoTweenCollection now pays more attention to the state of the tweenFlowItems. We filter out all tweens that have completed, and ones that have not started yet. (State for all tweens within a Collection is refreshed when the Collection is reversed, when goTo is called, and when the Collection finishes an iteration.)
This has the benefit of providing a nominal speed boost to users of large flows, and by providing safety with animating the same property in a Flow (provided they’re not overlapping.)
* AbstractGoTween.rewind() and .complete() did not previously force an update, now it does.
* For simplicity’s sake of tracking overall playback direction, events, and filtering -- all tweens that are added to a Chain/Flow must now match the isReversed property of the parent they are being added to. Chains/Flows take much more control over the direction in which child tweens are playing.
* Chains/Flows now properly set their child tweens to the right play direction and position when a goTo is called.
* Tweens are guaranteed to have one frame where they are at the defined start and end positions.
* Events Overhaul. Every tween now has six events that have callbacks:
* onInit: Called before the tween initializes it’s properties.
* onBegin: Called whenever the tween is at the “start” of its timeline.
* onIterationStart: Called whenever the tween reaches the start of an iteration. Will happen one frame after a previous loop finishes.
* onUpdate: Called after the tween has been updated.
* onIterationEnd: Called whenever the tween reaches the end of an iteration.
* onComplete: Called whenever the tween stops playing on its own.

**NOTES:**
* onInit is only called once.
* onBegin/onComplete and onIterationStart/End fire every time they reach their respective positions, and these positions on the timeline are relative to the tween’s play direction. Playing forwards, Begin is at T = 0, and Complete is T = totalDuration. Reversing the tween flips those values around.