refactoring; first animation in realtime, but works very slowly