Extracted code to isAnimationFinished() function