animation problem

I have 4 images in a column and would like them to move down in an animation. If the bottom most image gets below a certain y point, I would like to move it back to the top of the column. I would like the behaviour to repeat until I tell it to stop.


So this is what I am trying to just get the images to keep moving down:


@IBAction func SPIN(sender: AnyObject?) {

UIView.animateWithDuration(0.90, animations: {

for i in 0 ..< 4 {

self.reel1images[i].transform = CGAffineTransformMakeTranslation(0.0, 51.0)

}

}, completion: {

_ in

self.SPIN(nil)

})

}


As you can see in the completion I would like to call it again so as mentioned, the images just keep going down. But this isn't working. The images move down 50, but then stop....like the completion doesn't execute so SPIN isn't called again or something. Why?


Also, if I tell the animation to repeat, i.e.:


@IBAction func Spin(sender: AnyObject) {

UIView.animateWithDuration(1.0, delay: 0.0, options: .Repeat, animations: { () -> Void in

for i in 0 ..< 4 {

self.reel1images[i].transform = CGAffineTransformMakeTranslation(0.0, 51.0)

}

}, completion: nil)

}


..then it moves everything down 51, but then moves everything to the top again and repeats. Why does it move it everything back up? I would think it would just keep repeating moving everything down the 51.


Anyway once everything keeps moving down then I would put in the code to move the bottom one to the top if it's past a certain y position.


Any help on sorting this out is appreciated.

animation problem
 
 
Q