libgdx/libgdx — pull request #2591 by cypherdare (2014-11-16 05:46:23+00:00)
Title: Add animated gif support to TexturePacker 

This allows animated gifs to be included for texture packing, automatically indexed for loading into an Animation. In my workflow I found it cumbersome to produce many png files for an animation, many of which were repeated to get the pauses necessary in certain animations.

To allow for varied time delays per frame, a float version of a GCD is calculated, and frames of animation are repeated (aliased) to get timings that match the original gif. The GCD delay is output to console, and is the value that when used in the Animation constructor, will result in an Animation with timings that match the original gif. The float GCD algorithm requires some maximum allowable time error, so I added a setting for `maxAnimationDelayError`. This is the permissible variation in delay (in seconds) for each frame. Usually, the result will be significantly more accurate than the error. If the error setting is set to 0, then this step is skipped and no frames are repeated.

I had to do a bit of a refactor for empty images to allow animations with empty frames. I figure that empty frames in an animation are not a mistake, and must be kept as timing placeholders, so for gifs only, the `ignoreBlankImages` setting is ignored. Also, the `useIndices` setting is ignored for gifs, since there can be no animation without indices.