added code for pause the animation with a click