Q:

How to use transition in CAKeyframeAnimation

I want to show a few images using CAKeyframeAnimation, how can I perform transitions between images? Or how can I add CATransition to the animation? Such as: image1 eases out then image2 eases in, image2 fades out then image3 fades in, etc          

A:

CAKeyframeAnimation :
- (void)animateImages
{
    CAKeyframeAnimation *keyframeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"contents"];
    keyframeAnimation.values = self.imagesArray;

    keyframeAnimation.repeatCount = 1.0f;
    keyframeAnimation.duration = kAnimationDuration; // static const with your value

    keyframeAnimation.delegate = self;

    keyframeAnimation.removedOnCompletion = NO;
    keyframeAnimation.fillMode = kCAFillModeForwards;

    CALayer *layer = self.animationImageView.layer;

    [layer addAnimation:keyframeAnimation
                 forKey:@"girlAnimation"];
}

A:

One layer for one image works good. I can add animation at the begin/end of every layer to show in/out transition.

