iOS 动画(二)

[html]  view plain copy
  1. UIBezierPath *movePath = [UIBezierPath bezierPath];  
  2.    [movePath moveToPoint:center];  
  3.    [movePath addQuadCurveToPoint:toPos  
  4.                     controlPoint:CGPointMake(toPos.x, center.y)];  
  5.      
  6.    CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];  
  7.    moveAnim.path = movePath.CGPath;  
  8.    moveAnim.removedOnCompletion = YES;      
  9.      
  10.    CABasicAnimation *shrink = [CABasicAnimation animationWithKeyPath:@"transform.scale"];  
  11.    shrink.fromValue = [NSNumber numberWithDouble:0.1];  
  12.    shrink.toValue = [NSNumber numberWithDouble:12.0];  
  13.    shrink.fillMode=kCAFillModeForwards;  
  14.    shrink.removedOnCompletion=YES;  
  15.      
  16.    CABasicAnimation *opacityAnim = [CABasicAnimation animationWithKeyPath:@"opacity"];  
  17.    opacityAnim.fromValue = [NSNumber numberWithFloat:1.0];  
  18.    opacityAnim.toValue = [NSNumber numberWithFloat:0.0];  
  19.    opacityAnim.removedOnCompletion = YES;  
  20.      
  21.    CAAnimationGroup *animGroup = [CAAnimationGroup animation];  
  22.    animGroup.animations = [NSArray arrayWithObjects:moveAnim, shrink,opacityAnim, nil];  
  23.    animGroup.duration = 1.0;  
  24.    animGroup.delegate = self;  
  25.    [theLayer addAnimation:animGroup forKey:nil];  

2。
[html]  view plain copy
  1. CATransition* animation = [CATransition animation];  
  2. [animation setType:kCATransitionMoveIn];  
  3. [animation setSubtype:kCATransitionFromLeft];  
  4. [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];  
  5. [animation setDuration:1.0f];  
  6. animation.delegate = self;  
  7. [self.preShowLayer addAnimation:animation forKey:@"detailanimated"];  

3。
[html]  view plain copy
  1. [UIView beginAnimations:@"enterComment" context:nil];  
  2. [UIView setAnimationDuration:0.3];  
  3. [UIView setAnimationDelegate:self];  
  4.   
  5. sendCommentView.frame = CGRectMake(sendCommentView.frame.origin.x, 480, sendCommentView.frame.size.width, sendCommentView.frame.size.height);  
  6. [UIView commitAnimations];  
4。
[html]  view plain copy
  1. [UIView beginAnimations:@"switch321View" context:nil];  
  2. [UIView setAnimationDuration:0.3f];  
  3. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  
  4. //[UIView setAnimationDelegate:self];  
  5. [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.animation321View cache:YES];  
  6. [UIView commitAnimations];  

5。
[html]  view plain copy
  1. [UIView beginAnimations:@"switch321View" context:nil];  
  2. [UIView setAnimationDuration:0.3f];  
  3. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  
  4. //[UIView setAnimationDelegate:self];  
  5. [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.animation321View cache:YES];  
  6. [UIView commitAnimations];  
  7. [UIView animateWithDuration:0.3 animations:^{  
  8.     self.functionView.frame = CGRectMake(self.functionView.frame.origin.x, KScrollTableUp, self.functionView.frame.size.width, self.functionView.frame.size.height + (KScrollTableDown - KScrollTableUp));  
  9. } completion:^(BOOL finished) {  
  10.     _animatingWithScrollTable = NO;  
  11. }];  


6.

[html]  view plain copy
  1. [UIView transitionWithView: self.view  
  2.                         duration:1.0   
  3.                          options:UIViewAnimationOptionTransitionFlipFromLeft  
  4.                       animations:^{  
  5.                           self.mapView.hidden   = YES;  
  6.                           self.tableView.hidden = NO; }  
  7.                       completion:nil];  


7

[html]  view plain copy
  1. [UIView transitionFromView:(displayingPrimary ? primaryView : secondaryView)    
  2.       toView:(displayingPrimary ? secondaryView : primaryView)    
  3.       duration:1.0    
  4.       options:(displayingPrimary ? UIViewAnimationOptionTransitionFlipFromRight :    
  5.                   UIViewAnimationOptionTransitionFlipFromLeft)    
  6.       completion:^(BOOL finished) {    
  7.           if (finished) {    
  8.               displayingPrimary = !displayingPrimary;    
  9.           }    
  10.   }];   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值