Added a check to only update when animation is playing