主要记录效果的字符(文档中不全)
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];
网友评论