动画和核心动画为基础的导航

本文深入探讨了iOS开发中UIView动画和CATransition层动画的实现与应用,包括如何使用UIView动画方法进行自定义动画,以及CATransition中不同过渡效果的设置与使用。通过实例演示了动画的开始、持续时间、动画过渡类型和效果参数的配置,旨在为开发者提供全面的动画与过渡效果解决方案。
1 uiview动画
  
 [UIView beginAnimations:@"Curl"context:nil];//动画開始  
 [UIView setAnimationDuration:0.75]; 
 [UIView setAnimationDelegate:self]; 
 [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:view cache:YES];  
 [view removeFromSuperview]; 
 [UIView commitAnimations];

2 CATransition层动画


CATransition *animation = [CATransition animation]; [animation setDuration:1.25f];  
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]]; 
 [animation setType:kCATransitionReveal]; 
[animation setSubtype: kCATransitionFromBottom]; 
[self.view.layer addAnimation:animation forKey:@"Reveal"]; 


这里使用了setType与setSubtype组合,这使用个比較保险,由于他的參数就是官方API里定义的,他们的參数说明能够參考例如以下: 
  
[animation setType:@"suckEffect"]; 
这里的suckEffect就是效果名称,能够用的效果主要有: 
  pageCurl 向上翻一页   
 pageUnCurl 向下翻一页   
 rippleEffect 滴水效果  
 
 suckEffect 收缩效果。如一块布被抽走   
 cube 立方体效果   
 oglFlip 上下翻转效果


3 核心动画

http://blog.youkuaiyun.com/dztianyu/article/details/13776043


 foldLayer = [CATransformLayer layer]; foldLayer.anchorPoint = CGPointMake(1.0f, 0.5f); foldLayer.zPosition = 0foldLayer.frame = CGRectMake(0, 0, width/2, height);         [foldLayer addSublayer:currentLeftLayer]; [zheyeLayer addSublayer:foldLayer];                  CATransform3D endTransform = CATransform3DIdentity;  endTransform.m34 = 1.0f/2500.f;        endTransform = CATransform3DRotate(endTransform, cosA, 0.0, 1.0, 0.0);           foldLayer.transform = endTransform;

版权声明:本文博客原创文章,博客,未经同意,不得转载。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值