moved animation logic to its own module