animation loop logic in, acting weird