Fixed glitch with setAnimationDirection