CALayer动画内容超过2张图像是不可能的?

时间:2014-01-22 15:28:32

标签: ios iphone quartz-core cakeyframeanimation

是否有人设法通过成功插值在3张图片之间设置了contents CALayer属性的动画。似乎动画无法管理两个以上图像之间的插值。我的CGImages大小相同。

        CAKeyframeAnimation * animation =
        [CAKeyframeAnimation animationWithKeyPath:@"contents"];
        animation.calculationMode = kCAAnimationLinear;
        animation.beginTime       = AVCoreAnimationBeginTimeAtZero;
        animation.duration        = duration;
        animation.fillMode        = kCAFillModeBoth;
        animation.removedOnCompletion = NO;

        CGFloat width1  = CGImageGetWidth(image1.CGImage);
        CGFloat height1 = CGImageGetHeight(image1.CGImage);

        CGFloat width2  = CGImageGetWidth(image2.CGImage);
        CGFloat height2 = CGImageGetHeight(image2.CGImage);

        CGFloat width3  = CGImageGetWidth(image3.CGImage);
        CGFloat height3 = CGImageGetHeight(image3.CGImage);

        NSLog(@"first: W:%f H:%f, second: W:%f H:%f, third: W:%f H:%f",width1,height1,width2,height2,width3,height3);


        animation.keyTimes        = @[@0.0,@0.1,@0.3,@0.6,@1.0];

        animation.values          =
        @[(id)image1.CGImage,
          (id)image1.CGImage,
          (id)image2.CGImage,
          (id)image2.CGImage,
          (id)image3.CGImage];

日志

2014-01-22 16:05:24.985 myApp[8527:60b] first: W:2592.000000 H:1936.000000, second: W:2592.000000 H:1936.000000, third: W:2592.000000 H:1936.000000

0 个答案:

没有答案