New animation code

Rewrote the animation code to take the actual size of the image into
account.
Merge branch 'develop'