项目的任务,需要实现一个类似于下图的翻转动画,图片在翻转的同时,还要进行改变。翻转过去用时1秒,翻转回来用时1秒,展示3秒
single.gif
-(void)startTransformAnimation{
WeakSelf(weakSelf)
CustomBtn *btn = [_banner viewWithTag:26];
[UIView animateWithDuration:1.0 animations:^{
btn.topImage.layer.transform = CATransform3DMakeRotation((M_PI/2), 0,1,0);
} completion:^(BOOL finished) {
[weakSelf changeImgWithBtn:btn];
[UIView animateWithDuration:1.0 animations:^{
btn.topImage.layer.transform = CATransform3DMakeRotation(0, 0,1,0);
} completion:^(BOOL finished) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,(int64_t)(3.0* NSEC_PER_SEC)),dispatch_get_main_queue(),^{
[weakSelf startTransformAnimation];
});
}];
}];
}
切换图片