美文网首页
设置更改图片效果

设置更改图片效果

作者: 贵哥jk | 来源:发表于2016-08-11 16:48 被阅读10次

    主要记录效果的字符(文档中不全)

    NSString *name = [NSString stringWithFormat:@"pet_%ld",self.index];
    self.imageView.image = [UIImage imageNamed:name]; 
        CATransition *transition = [CATransition animation];
         /* The name of the transition. Current legal transition types include
        * `fade', `moveIn', `push' and `reveal'. Defaults to `fade'.
        pageCurl            向上翻一页
        pageUnCurl          向下翻一页
        rippleEffect        滴水效果
        suckEffect          收缩效果,如一块布被抽走
        cube                立方体效果
        oglFlip             上下翻转效果
        */
         NSArray *types = @[@"fade",
                           @"moveIn",
                           @"push",
                           @"reveal",
                           @"pageCurl",
                           @"pageUnCurl",
                           @"rippleEffect",
                           @"suckEffect",
                           @"cube",
                           @"oglFlip"
                           ];
        NSInteger index = random() % types.count;
        
        transition.type = types[index];
        transition.subtype = @"fromRight";
        transition.duration = 2.0;
        
        //1.5设置动画的起点
         transition.startProgress=0.2;
        transition.delegate = self;
        [self.imageView.layer addAnimation:transition forKey:nil];
    

    相关文章

      网友评论

          本文标题:设置更改图片效果

          本文链接:https://www.haomeiwen.com/subject/hfrssttx.html