CALayer--跳转动画

- (void)CATransition{

    //转场代码必须得要和转场动画在同一个方法当中.
    //创建动画
    CATransition *anim = [CATransition animation];
    anim.type = @"push";
    anim.duration = 1;


    [self.imageV.layer addAnimation:anim forKey:nil];
    
    [self performSelector:@selector(nextAnimition) withObject:self afterDelay:2];
    //转场代码
    
    _i++;
    if (_i > 3) {
        _i = 1;
    }
    NSString *imageName = [NSString stringWithFormat:@"%d",_i];
    self.imageV.image = [UIImage imageNamed:imageName];
    
    
   
}

- (void)nextAnimition
{
       CATransition *anim = [CATransition animation];
        //设置转场类型
        anim.type = @"rippleEffect";
    
        //设置转场的方向
        anim.subtype = kCATransitionFromBottom;
        //设置动画的开始点.
        anim.startProgress = 0.2;
        //设置动画的结束点.
        anim.endProgress = 0.8;
    
        anim.duration = 1;
        [self.imageV.layer addAnimation:anim forKey:nil];
 
}

  • anim.type


    屏幕快照 2017-01-20 下午3.30.06.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容