私人资料库
本博客大部分技术文章,均从网络搜索得来,旨在收集整理技术资料,文章版权归属原作者,由此引起的任何版权问题,与本人无关。

转自:http://hi.baidu.com/before%CB%AF%BE%F5/blog/item/7983724e75abe0ebd62afc50.html

 

 

 1 - (void) first_animations
 2 {
 3     [UIView beginAnimations:nil context:nil];
 4     [UIView setAnimationRepeatCount:1];
 5     [UIView setAnimationDuration:1];
 6     [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; 
 7     [UIView setAnimationDelegate:self];
 8     [UIView setAnimationDidStopSelector:@selector(resetView)];
 9     
10     CGAffineTransform oneTransform = CGAffineTransformRotate(self.animatView.transform, degreesToRadian(180));
11     CGAffineTransform twoTransform = CGAffineTransformTranslate(self.animatView.transform,0,-100);
12     CGAffineTransform newTransform = CGAffineTransformConcat(oneTransform, twoTransform);
13     [self.animatView setTransform:newTransform];
14     [UIView commitAnimations];
15 }
16 - (void) second_animations
17 {
18     CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"];
19     [animation setDuration:1];
20     [animation setRepeatCount:0];
21     [animation setAutoreverses:YES];//自动反向动画
22     [animation setFromValue:[NSNumber numberWithFloat:1.0]];
23     [animation setToValue:[NSNumber numberWithFloat:0]];
24     [animation setDelegate:self];
25     [self.animatView.layer addAnimation:animation forKey:@"firstView-Opacity"];
26 }
27 - (void) third_animations
28 {
29     [UIView beginAnimations:nil context:nil];
30     [UIView setAnimationRepeatCount:1];
31     [UIView setAnimationDuration:1];
32     [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; 
33     [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.containView cache:YES];
34     [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)];
35     [UIView commitAnimations];
36 }
37 - (void) fourth_animations
38 {
39     CATransition *transition = [CATransition animation];
40     transition.duration = 1.0f;          /*  间隔时间*/
41     transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];  /* 动画的开始与结束的快慢*/
42     transition.type = @"pageCurl";  //@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip"
43     transition.subtype = kCATransitionFromRight;
44     transition.removedOnCompletion = YES;
45     transition.fillMode = kCAFillModeBackwards;
46     transition.delegate = self;
47     [self.animatView.layer addAnimation:transition forKey:nil];  
48 }
49 -(void) resetView
50 {
51     [self.animatView setTransform:CGAffineTransformRotate(self.animatView.transform, degreesToRadian(180))];
52     self.animatView.frame = CGRectMake(00280200);
53 }
54 #pragma mark Delegate Methods
55 - (void)animationDidStop:(CAAnimation *) theAnimation finished:(BOOL) flag {
56     self.animatView.frame = CGRectMake(00280200);
57 }
58 
59 #define degreesToRadian(x) (M_PI * (x) / 180.0)

 

有错误,请参考

http://hi.baidu.com/before%CB%AF%BE%F5/blog/item/b504f62dd10a7a291f3089f6.html

 

posted on 2011-08-29 09:30  该显示名称已被其他用户使用  阅读(439)  评论(0)    收藏  举报