Added support for looping animations.