refactor animateSwap