Refactor animate().