Creating loops for animation