Extracted code to isAnimationFinished() function
Small refactor animation code