设置更改图片效果

2016-08-11  本文已影响10人  贵哥jk

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

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];
上一篇下一篇

猜你喜欢

热点阅读