Fixed animation to work in both dimensions