CATransition page curl from top

若如初见. 提交于 2020-01-13 07:27:10

问题


I wanted to know if anyone managed a pagecurl from the top using the CATRANSITION. I have the following :

CATransition *animation = [CATransition animation];
 [animation setDelegate:self];
 [animation setDuration:0.35];
 [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
 animation.type = @"pageCurl";

 animation.subtype = kCATransitionFromTop;

 animation.fillMode = kCAFillModeForwards;

 animation.endProgress = 0.30;
 [animation setRemovedOnCompletion:NO];
 [self.view.layer addAnimation:animation forKey:@"pageCurlAnimation"];

but unfortunately, it always does the page curl from the bottom. I will be very grateful if anyone can tell me how to do a page curl from the top.

Many thanks.


回答1:


Found the answer, need to set subtype to from right!




回答2:


I've got this working. You need to set animation.type = @"pageUnCurl"; - who would have thought! Thanks apple.

CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.5];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
animation.type = @"pageUnCurl";

animation.subtype = kCATransitionFromTop;
animation.fillMode = kCAFillModeForwards;
animation.startProgress = 0.3;
[animation setRemovedOnCompletion:NO];

[self.helpView.layer addAnimation:animation forKey:@"pageCurlAnimation"];



回答3:


subtype = KCATransitionFromLeft or KCATransitionFromRight 

you can also remove the animation.endProgress if you want a total animation of curl page . =)



来源:https://stackoverflow.com/questions/3652724/catransition-page-curl-from-top

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!