Added reverse functionality for animation loops