While bumping I took a fresh look again and might have solved it. I am sure it could be improved but...
kenburns1 is overtop of kenburns2. They switch z positions and get a new image and then fade - rinse and repeat. I will add scaling to fully recreate the kenburns effect but this is working for me.
Code:
-(void)crossFade {
NSArray *imgArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"image4_large.png"],
[UIImage imageNamed:@"image5_large.png"],
[UIImage imageNamed:@"image9_large.png"],
[UIImage imageNamed:@"toc_gallery01.jpg"],
[UIImage imageNamed:@"toc_gallery02.jpg"],
nil];
if (kenBurns1.alpha == 1.0) {
kenBurns2.alpha = 1.0;
UIViewAnimationOptions options = UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveEaseOut;
[UIView animateWithDuration:1.0 delay:0.0 options:options
animations:^{
kenBurns1.alpha = 0.0;
}
completion:^(BOOL finished){
[kenBurns1 removeFromSuperview];
[self.view insertSubview:kenBurns1 atIndex:0];
kenBurns1.image = [imgArray objectAtIndex:view1Index];
if (view1Index == 4) {
view1Index = 0;
} else {
view1Index++;
}
}];
} else if (kenBurns1.alpha == 0.0) {
kenBurns1.alpha = 1.0;
UIViewAnimationOptions options = UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveEaseOut;
[UIView animateWithDuration:1.0 delay:0.0 options:options
animations:^{
kenBurns2.alpha = 0.0;
}
completion:^(BOOL finished){
[kenBurns2 removeFromSuperview];
[self.view insertSubview:kenBurns2 atIndex:0];
kenBurns2.image = [imgArray objectAtIndex:view2Index];
if (view2Index == 4) {
view2Index = 0;
} else {
view2Index++;
}
}];
}
}