small refactoring of animation