Moved animation code to separate component