Making custom animations cycle through next and prev actions